Text and Data
This page may contain outdated information. It will be updated as soon as possible.
There are two main input and output types: Text
and Data
.
Text
is a simple string input and output type, while Data
is a structure very similar to a dictionary in Python. It is a key-value pair data structure.
We've created a few components to help you work with these types. Let's see how a few of them work.
Data To Text
This is a component that takes in Data and outputs a Text
. It does this using a template string and concatenating the values of the Data
, one per line.
If we have the following Data:
_10{_10 "sender_name": "Alice",_10 "message": "Hello!"_10}_10{_10 "sender_name": "John",_10 "message": "Hi!"_10}
And the template string is: {sender_name}: {message}
The output is:
_10Alice: Hello!_10John: Hi!
Create Data
This component allows you to create a Data
from a number of inputs. You can add as many key-value pairs as you want (as long as it is less than 15). Once you've picked that number you'll need to write the name of the Key and can pass Text
values from other components to it.
Documents To Data
This component takes in a LangChain Document
and outputs a Data
. It does this by extracting the page_content
and the metadata
from the Document
and adding them to the Data
as text and data respectively.
Why is this useful?
The idea was to create a unified way to work with complex data in Langflow and to make it easier to work with data that is not just a simple string. This way you can create more complex workflows and use the data in more ways.
What's next?
We are planning to integrate an array of modalities to Langflow, such as images, audio, and video. This will allow you to create even more complex workflows and use cases. Stay tuned for more updates! 🚀