[Docs] - Migration Folder (#2066)
* Move input/output and text/record to components, and combine docs into one * Combine global env docs into one * Update links * Remove unused files * Clean up docs for compatibility, migration, and possible install issues
This commit is contained in:
commit
b81d82f49b
26 changed files with 287 additions and 386 deletions
|
|
@ -1,35 +1,42 @@
|
|||
import ThemedImage from "@theme/ThemedImage";
|
||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
import Admonition from "@theme/Admonition";
|
||||
import ReactPlayer from "react-player";
|
||||
import Admonition from "@theme/Admonition";
|
||||
|
||||
# Global Environment Variables
|
||||
# Global Variables
|
||||
|
||||
Langflow 1.0 alpha includes the option to add **Global Environment Variables** for your application.
|
||||
Global Variables are a useful feature of Langflow, allowing you to define reusable variables accessed from any Text field in your project.
|
||||
|
||||
## Add a global variable to a project
|
||||
## TL;DR
|
||||
|
||||
In this example, you'll add the `openai_api_key` credential as a global environment variable to the **Basic Prompting** starter project.
|
||||
- Global Variables are reusable variables accessible from any Text field in your project.
|
||||
- To create one, click the 🌐 button in a Text field and then **+ Add New Variable**.
|
||||
- Define the **Name**, **Type**, and **Value** of the variable.
|
||||
- Click **Save Variable** to create it.
|
||||
- All Credential Global Variables are encrypted and accessible only by you.
|
||||
- Set _`LANGFLOW_STORE_ENVIRONMENT_VARIABLES`_ to _`true`_ in your `.env` file to add all variables in _`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`_ to your user's Global Variables.
|
||||
|
||||
For more information on the starter flow, see [Basic prompting](../starter-projects/basic-prompting.mdx).
|
||||
|
||||
1. From the Langflow dashboard, click **New Project**.
|
||||
2. Select **Basic Prompting**.
|
||||
## Creating and Adding a Global Variable
|
||||
|
||||
The **Basic Prompting** flow is created.
|
||||
To create and add a global variable, click the 🌐 button in a Text field, and then click **+ Add New Variable**.
|
||||
|
||||
3. To create an environment variable for the **OpenAI** component:
|
||||
1. In the **OpenAI API Key** field, click the **Globe** button, and then click **Add New Variable**.
|
||||
2. In the **Variable Name** field, enter `openai_api_key`.
|
||||
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
|
||||
4. For the variable **Type**, select **Credential**.
|
||||
5. In the **Apply to Fields** field, select **OpenAI API Key** to apply this variable to all fields named **OpenAI API Key**.
|
||||
Text fields are where you write text without opening a Text area, and are identified with the 🌐 icon.
|
||||
|
||||
For example, to create an environment variable for the **OpenAI** component:
|
||||
1. In the **OpenAI API Key** text field, click the 🌐 button, then **Add New Variable**.
|
||||
2. Enter `openai_api_key` in the **Variable Name** field.
|
||||
3. Paste your OpenAI API Key (`sk-...`) in the **Value** field.
|
||||
4. Select **Credential** for the **Type**.
|
||||
5. Choose **OpenAI API Key** in the **Apply to Fields** field to apply this variable to all fields named **OpenAI API Key**.
|
||||
6. Click **Save Variable**.
|
||||
|
||||
You now have a `openai_api_key` global environment variable for your Langflow project.
|
||||
Subsequently, clicking the 🌐 button in a Text field will display the new variable in the dropdown.
|
||||
|
||||
<Admonition type="tip">
|
||||
You can also create global variables in **Settings** > **Variables and
|
||||
Secrets**.
|
||||
You can also create global variables in **Settings** > **Variables and Secrets**.
|
||||
</Admonition>
|
||||
|
||||
<ZoomableImage
|
||||
|
|
@ -41,10 +48,54 @@ You now have a `openai_api_key` global environment variable for your Langflow pr
|
|||
style={{ width: "40%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
4. To view and manage your project's global environment variables, visit **Settings** > **Variables and Secrets**.
|
||||
To view and manage your project's global environment variables, visit **Settings** > **Variables and Secrets**.
|
||||
|
||||
For more on variables in HuggingFace Spaces, see [Managing Secrets](https://huggingface.co/docs/hub/spaces-overview#managing-secrets).
|
||||
|
||||
{/* All variables are encrypted */}
|
||||
|
||||
<Admonition type="warning">
|
||||
All Credential Global Variables are encrypted and accessible only by you.
|
||||
</Admonition>
|
||||
|
||||
## Configuring Environment Variables in your .env file
|
||||
|
||||
Setting `LANGFLOW_STORE_ENVIRONMENT_VARIABLES` to `true` in your `.env` file (default) adds all variables in `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT` to your user's Global Variables.
|
||||
|
||||
These variables are accessible like any other Global Variable.
|
||||
|
||||
<Admonition type="tip">
|
||||
To prevent this behavior, set `LANGFLOW_STORE_ENVIRONMENT_VARIABLES` to `false` in your `.env` file.
|
||||
</Admonition>
|
||||
|
||||
You can specify variables to get from the environment by listing them in `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`.
|
||||
|
||||
Specify variables as a comma-separated list (e.g., _`"VARIABLE1, VARIABLE2"`_) or a JSON-encoded string (e.g., _`'["VARIABLE1", "VARIABLE2"]'`_).
|
||||
|
||||
The default list of variables includes:
|
||||
|
||||
- ANTHROPIC_API_KEY
|
||||
- ASTRA_DB_API_ENDPOINT
|
||||
- ASTRA_DB_APPLICATION_TOKEN
|
||||
- AZURE_OPENAI_API_KEY
|
||||
- AZURE_OPENAI_API_DEPLOYMENT_NAME
|
||||
- AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME
|
||||
- AZURE_OPENAI_API_INSTANCE_NAME
|
||||
- AZURE_OPENAI_API_VERSION
|
||||
- COHERE_API_KEY
|
||||
- GOOGLE_API_KEY
|
||||
- GROQ_API_KEY
|
||||
- HUGGINGFACEHUB_API_TOKEN
|
||||
- OPENAI_API_KEY
|
||||
- PINECONE_API_KEY
|
||||
- SEARCHAPI_API_KEY
|
||||
- SERPAPI_API_KEY
|
||||
- UPSTASH_VECTOR_REST_URL
|
||||
- UPSTASH_VECTOR_REST_TOKEN
|
||||
- VECTARA_CUSTOMER_ID
|
||||
- VECTARA_CORPUS_ID
|
||||
- VECTARA_API_KEY
|
||||
|
||||
## Video
|
||||
|
||||
<div
|
||||
|
|
|
|||
161
docs/docs/components/inputs-and-outputs.mdx
Normal file
161
docs/docs/components/inputs-and-outputs.mdx
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
import Admonition from '@theme/Admonition';
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Inputs and Outputs
|
||||
|
||||
TL;DR: Inputs and Outputs are a category of components that are used to define where data comes in and out of your flow.
|
||||
They also dynamically change the Playground and can be renamed to facilitate building and maintaining your flows.
|
||||
|
||||
## Inputs
|
||||
|
||||
Inputs are components used to define where data enters your flow. They can receive data from the user, a database, or any other source that can be converted to Text or Record.
|
||||
|
||||
The difference between Chat Input and other Input components is the output format, the number of configurable fields, and the way they are displayed in the Playground.
|
||||
|
||||
Chat Input components can output `Text` or `Record`. When you want to pass the sender name or sender to the next component, use the `Record` output. To pass only the message, use the `Text` output, useful when saving the message to a database or memory system like Zep.
|
||||
|
||||
You can find out more about Chat Input and other Inputs [here](#chat-input).
|
||||
|
||||
### Chat Input
|
||||
|
||||
This component collects user input from the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Sender Type:** Specifies the sender type. Defaults to `User`. Options are `Machine` and `User`.
|
||||
- **Sender Name:** Specifies the name of the sender. Defaults to `User`.
|
||||
- **Message:** Specifies the message text. It is a multiline text input.
|
||||
- **Session ID:** Specifies the session ID of the chat history. If provided, the message will be saved in the Message History.
|
||||
|
||||
<Admonition type="note" title="Note">
|
||||
<p>
|
||||
If `As Record` is `true` and the `Message` is a `Record`, the data
|
||||
of the `Record` will be updated with the `Sender`, `Sender Name`, and
|
||||
`Session ID`.
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/chat-input-expanded.png",
|
||||
dark: "img/chat-input-expanded.png",
|
||||
}}
|
||||
style={{ width: "40%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
One significant capability of the Chat Input component is its ability to transform the Playground into a chat window. This feature is particularly valuable for scenarios requiring user input to initiate or influence the flow.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/interaction-panel-with-chat-input.png",
|
||||
dark: "img/interaction-panel-with-chat-input.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
### Text Input
|
||||
|
||||
The **Text Input** component adds an **Input** field on the Playground. This enables you to define parameters while running and testing your flow.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Value:** Specifies the text input value. This is where the user inputs text data that will be passed to the next component in the sequence. If no value is provided, it defaults to an empty string.
|
||||
- **Record Template:** Specifies how a `Record` should be converted into `Text`.
|
||||
|
||||
The **Record Template** field is used to specify how a `Record` should be converted into `Text`. This is particularly useful when you want to extract specific information from a `Record` and pass it as text to the next component in the sequence.
|
||||
|
||||
For example, if you have a `Record` with the following structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "John Doe",
|
||||
"age": 30,
|
||||
"email": "johndoe@email.com"
|
||||
}
|
||||
```
|
||||
|
||||
A template with `Name: {name}, Age: {age}` will convert the `Record` into a text string of `Name: John Doe, Age: 30`.
|
||||
|
||||
If you pass more than one `Record`, the text will be concatenated with a new line separator.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/text-input-expanded.png",
|
||||
dark: "img/text-input-expanded.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
## Outputs
|
||||
|
||||
Outputs are components that are used to define where data comes out of your flow. They can be used to send data to the user, to the Playground, or to define how the data will be displayed in the Playground.
|
||||
|
||||
The Chat Output works similarly to the Chat Input but does not have a field that allows for written input. It is used as an Output definition and can be used to send data to the user.
|
||||
|
||||
You can find out more about it and the other Outputs [here](#chat-output).
|
||||
|
||||
### Chat Output
|
||||
|
||||
This component sends a message to the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Sender Type:** Specifies the sender type. Default is `"Machine"`. Options are `"Machine"` and `"User"`.
|
||||
|
||||
- **Sender Name:** Specifies the sender's name. Default is `"AI"`.
|
||||
|
||||
- **Session ID:** Specifies the session ID of the chat history. If provided, messages are saved in the Message History.
|
||||
|
||||
- **Message:** Specifies the text of the message.
|
||||
|
||||
<Admonition type="note" title="Note">
|
||||
<p>
|
||||
If `As Record` is `true` and the `Message` is a `Record`, the data in the `Record` is updated with the `Sender`, `Sender Name`, and `Session ID`.
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
### Text Output
|
||||
|
||||
This component displays text data to the user. It is useful when you want to show text without sending it to the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Value:** Specifies the text data to be displayed. Defaults to an empty string.
|
||||
|
||||
|
||||
The `TextOutput` component provides a simple way to display text data. It allows textual data to be visible in the chat window during your interaction flow.
|
||||
|
||||
## Prompts
|
||||
|
||||
A prompt is the input provided to a language model, consisting of multiple components and can be parameterized using prompt templates. A prompt template offers a reproducible method for generating prompts, enabling easy customization through input variables.
|
||||
|
||||
### Prompt
|
||||
|
||||
This component creates a prompt template with dynamic variables. This is useful for structuring prompts and passing dynamic data to a language model.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Template:** The template for the prompt. This field allows you to create other fields dynamically by using curly brackets `{}`. For example, if you have a template like `Hello {name}, how are you?`, a new field called `name` will be created. Prompt variables can be created with any name inside curly brackets, e.g. `{variable_name}`.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/prompt-with-template.png",
|
||||
dark: "img/prompt-with-template.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
### PromptTemplate
|
||||
|
||||
The `PromptTemplate` component enables users to create prompts and define variables that control how the model is instructed. Users can input a set of variables which the template uses to generate the prompt when a conversation starts.
|
||||
|
||||
<Admonition type="info">
|
||||
After defining a variable in the prompt template, it acts as its own component
|
||||
input. See [Prompt Customization](../administration/prompt-customization) for more details.
|
||||
</Admonition>
|
||||
|
||||
- **template:** The template used to format an individual request.
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
import Admonition from '@theme/Admonition';
|
||||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
|
||||
# Inputs
|
||||
|
||||
## Chat Input
|
||||
|
||||
This component obtains user input from the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Sender Type:** Specifies the sender type. Defaults to `User`. Options are `Machine` and `User`.
|
||||
- **Sender Name:** Specifies the name of the sender. Defaults to `User`.
|
||||
- **Message:** Specifies the message text. It is a multiline text input.
|
||||
- **Session ID:** Specifies the session ID of the chat history. If provided, the message will be saved in the Message History.
|
||||
|
||||
<Admonition type="note" title="Note">
|
||||
<p>
|
||||
If `As Record` is `true` and the `Message` is a `Record`, the data
|
||||
of the `Record` will be updated with the `Sender`, `Sender Name`, and
|
||||
`Session ID`.
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/chat-input-expanded.png",
|
||||
dark: "img/chat-input-expanded.png",
|
||||
}}
|
||||
style={{ width: "40%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
One significant capability of the Chat Input component is its ability to transform the Playground into a chat window. This feature is particularly valuable for scenarios requiring user input to initiate or influence the flow.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/interaction-panel-with-chat-input.png",
|
||||
dark: "img/interaction-panel-with-chat-input.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
## Prompt
|
||||
|
||||
This component creates a prompt template with dynamic variables. This is useful for structuring prompts and passing dynamic data to a language model.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Template:** The template for the prompt. This field allows you to create other fields dynamically by using curly brackets `{}`. For example, if you have a template like `Hello {name}, how are you?`, a new field called `name` will be created. Prompt variables can be created with any name inside curly brackets, e.g. `{variable_name}`.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/prompt-with-template.png",
|
||||
dark: "img/prompt-with-template.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
---
|
||||
|
||||
## Text Input
|
||||
|
||||
The **Text Input** component adds an **Input** field on the Playground. This enables you to define parameters while running and testing your flow.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Value:** Specifies the text input value. This is where the user inputs text data that will be passed to the next component in the sequence. If no value is provided, it defaults to an empty string.
|
||||
- **Record Template:** Specifies how a `Record` should be converted into `Text`.
|
||||
|
||||
The **Record Template** field is used to specify how a `Record` should be converted into `Text`. This is particularly useful when you want to extract specific information from a `Record` and pass it as text to the next component in the sequence.
|
||||
|
||||
For example, if you have a `Record` with the following structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "John Doe",
|
||||
"age": 30,
|
||||
"email": "johndoe@email.com"
|
||||
}
|
||||
```
|
||||
|
||||
A template with `Name: {name}, Age: {age}` will convert the `Record` into a text string of `Name: John Doe, Age: 30`.
|
||||
|
||||
If you pass more than one `Record`, the text will be concatenated with a new line separator.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/text-input-expanded.png",
|
||||
dark: "img/text-input-expanded.png",
|
||||
}}
|
||||
style={{ width: "50%", margin: "20px auto" }}
|
||||
/>
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import Admonition from '@theme/Admonition';
|
||||
|
||||
# Outputs
|
||||
|
||||
## Chat Output
|
||||
|
||||
This component sends a message to the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Sender Type:** Specifies the sender type. Default is `"Machine"`. Options are `"Machine"` and `"User"`.
|
||||
|
||||
- **Sender Name:** Specifies the sender's name. Default is `"AI"`.
|
||||
|
||||
- **Session ID:** Specifies the session ID of the chat history. If provided, messages are saved in the Message History.
|
||||
|
||||
- **Message:** Specifies the text of the message.
|
||||
|
||||
<Admonition type="note" title="Note">
|
||||
<p>
|
||||
If `As Record` is `true` and the `Message` is a `Record`, the data in the `Record` is updated with the `Sender`, `Sender Name`, and `Session ID`.
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
## Text Output
|
||||
|
||||
This component displays text data to the user. It is useful when you want to show text without sending it to the chat.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- **Value:** Specifies the text data to be displayed. Defaults to an empty string.
|
||||
|
||||
|
||||
The `TextOutput` component provides a simple way to display text data. It allows textual data to be visible in the chat window during your interaction flow.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
|
||||
# Prompts
|
||||
|
||||
<Admonition type="caution" icon="🚧" title="Zone Under Construction">
|
||||
<p>
|
||||
Thank you for your patience as we refine our documentation. It may
|
||||
still have some areas under development. Please share your feedback or report any issues to help us improve!
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
A prompt is the input provided to a language model, consisting of multiple components and can be parameterized using prompt templates. A prompt template offers a reproducible method for generating prompts, enabling easy customization through input variables.
|
||||
|
||||
---
|
||||
|
||||
### PromptTemplate
|
||||
|
||||
The `PromptTemplate` component enables users to create prompts and define variables that control how the model is instructed. Users can input a set of variables which the template uses to generate the prompt when a conversation starts.
|
||||
|
||||
<Admonition type="info">
|
||||
After defining a variable in the prompt template, it acts as its own component
|
||||
input. See [Prompt Customization](../administration/prompt-customization) for more details.
|
||||
</Admonition>
|
||||
|
||||
- **template:** The template used to format an individual request.
|
||||
49
docs/docs/components/text-and-record.mdx
Normal file
49
docs/docs/components/text-and-record.mdx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Text and Record
|
||||
|
||||
In Langflow 1.0, we added two main input and output types: `Text` and `Record`.
|
||||
|
||||
`Text` is a simple string input and output type, while ``Record`` 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.
|
||||
|
||||
## Records To Text
|
||||
|
||||
This is a component that takes in Records and outputs a `Text`. It does this using a template string and concatenating the values of the `Record`, one per line.
|
||||
|
||||
If we have the following Records:
|
||||
|
||||
```json
|
||||
{
|
||||
"sender_name": "Alice",
|
||||
"message": "Hello!"
|
||||
}
|
||||
{
|
||||
"sender_name": "John",
|
||||
"message": "Hi!"
|
||||
}
|
||||
```
|
||||
|
||||
And the template string is: _`{sender_name}: {message}`_
|
||||
|
||||
The output is:
|
||||
|
||||
```
|
||||
Alice: Hello!
|
||||
John: Hi!
|
||||
```
|
||||
|
||||
## Create Record
|
||||
|
||||
This component allows you to create a `Record` 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 Records
|
||||
|
||||
This component takes in a LangChain `Document` and outputs a `Record`. It does this by extracting the `page_content` and the `metadata` from the `Document` and adding them to the `Record` 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! 🚀
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import Admonition from "@theme/Admonition";
|
||||
|
||||
# Vector Stores Documentation
|
||||
# Vector Stores
|
||||
|
||||
### Astra DB
|
||||
|
||||
|
|
|
|||
|
|
@ -1,118 +0,0 @@
|
|||
import ZoomableImage from "/src/theme/ZoomableImage.js";
|
||||
import Admonition from "@theme/Admonition";
|
||||
|
||||
# Global Variables
|
||||
|
||||
## TLDR;
|
||||
|
||||
- Global Variables are reusable variables that can be accessed from any Text field in your project.
|
||||
- To create a Global Variable, click on the 🌐 button in a Text field and then **+ Add New Variable**.
|
||||
- Define the **Name**, **Type**, and **Value** of the variable.
|
||||
- Click on **Save Variable** to create the variable.
|
||||
- All Credential Global Variables are encrypted and cannot be accessed by anyone but you.
|
||||
- Set _`LANGFLOW_STORE_ENVIRONMENT_VARIABLES`_ to _`true`_ in your `.env` file to add all variables in _`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`_ to your user's Global Variables.
|
||||
|
||||
Global Variables are a really useful feature of Langflow.
|
||||
They allow you to define reusable variables that can be accessed from any Text field in your project.
|
||||
|
||||
The first thing you need to do is find a **Text field** in a Component, so let's talk about what a Text field is.
|
||||
|
||||
## Text Fields
|
||||
|
||||
Text fields are the fields in a Component where you can write text but that does not allow you to open a Text Area.
|
||||
|
||||
The easiest way to find fields that are Text fields, though, is to look for fields that have a 🌐 button.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/ollama-gv.png",
|
||||
dark: "img/ollama-gv.png",
|
||||
}}
|
||||
style={{ width: "50%" }}
|
||||
/>
|
||||
|
||||
## Creating a Global Variable
|
||||
|
||||
To create a Global Variable, you need to click on the 🌐 button in a Text field and that will open a dropdown showing your currently available variables and at the end of it **+ Add New Variable**.
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/add-new-variable.png",
|
||||
dark: "img/add-new-variable.png",
|
||||
}}
|
||||
style={{ width: "60%" }}
|
||||
/>
|
||||
|
||||
Click on **+ Add New Variable** and a window will open where you can define your new Global Variable.
|
||||
|
||||
In it, you can define the **Name** of the variable, the optional **Type** of the variable, and the **Value** of the variable.
|
||||
|
||||
The **Name** is the name that you will use to refer to the variable in your Text fields.
|
||||
|
||||
The **Type** is optional for now but will be used in the future to allow for more advanced features.
|
||||
|
||||
The **Value** is the value that the variable will have.
|
||||
{/* say that all variables are encrypted */}
|
||||
|
||||
<Admonition type="warning">
|
||||
All Credential Global Variables are encrypted and cannot be accessed by anyone
|
||||
but you.
|
||||
</Admonition>
|
||||
|
||||
<ZoomableImage
|
||||
alt="Docusaurus themed image"
|
||||
sources={{
|
||||
light: "img/create-variable-window.png",
|
||||
dark: "img/create-variable-window.png",
|
||||
}}
|
||||
style={{ width: "60%" }}
|
||||
/>
|
||||
|
||||
After you have defined your variable, click on **Save Variable** and your variable will be created.
|
||||
|
||||
After that, once you click on the 🌐 button in a Text field, you will see your new variable in the dropdown.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
If you set _`LANGFLOW_STORE_ENVIRONMENT_VARIABLES`_ to _`true`_ (which is the default value) in your `.env` file, all variables in _`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`_ will be added to your user's Global Variables.
|
||||
|
||||
All of these variables can be used in your project as any other Global Variable.
|
||||
|
||||
<Admonition type="tip">
|
||||
You can set _`LANGFLOW_STORE_ENVIRONMENT_VARIABLES`_ to _`false`_ in your
|
||||
`.env` file to prevent this behavior.
|
||||
</Admonition>
|
||||
|
||||
You can also set _`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`_ to a list of variables that you want to get from the environment.
|
||||
|
||||
The default list at the moment is:
|
||||
|
||||
- ANTHROPIC_API_KEY
|
||||
- ASTRA_DB_API_ENDPOINT
|
||||
- ASTRA_DB_APPLICATION_TOKEN
|
||||
- AZURE_OPENAI_API_KEY
|
||||
- AZURE_OPENAI_API_DEPLOYMENT_NAME
|
||||
- AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME
|
||||
- AZURE_OPENAI_API_INSTANCE_NAME
|
||||
- AZURE_OPENAI_API_VERSION
|
||||
- COHERE_API_KEY
|
||||
- GOOGLE_API_KEY
|
||||
- GROQ_API_KEY
|
||||
- HUGGINGFACEHUB_API_TOKEN
|
||||
- OPENAI_API_KEY
|
||||
- PINECONE_API_KEY
|
||||
- SEARCHAPI_API_KEY
|
||||
- SERPAPI_API_KEY
|
||||
- UPSTASH_VECTOR_REST_URL
|
||||
- UPSTASH_VECTOR_REST_TOKEN
|
||||
- VECTARA_CUSTOMER_ID
|
||||
- VECTARA_CORPUS_ID
|
||||
- VECTARA_API_KEY
|
||||
|
||||
<Admonition type="tip">
|
||||
Set _`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`_ as a comma-separated list
|
||||
of variables (e.g. _`"VARIABLE1, VARIABLE2"`_) or as a JSON-encoded string
|
||||
(e.g. _`'["VARIABLE1", "VARIABLE2"]'`_).
|
||||
</Admonition>
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
# Inputs and Outputs
|
||||
|
||||
TL;DR: Inputs and Outputs are a category of components that are used to define where data comes in and out of your flow. They also
|
||||
dynamically change the Playground and can be renamed to make it easier to build and maintain your flows.
|
||||
|
||||
## Introduction
|
||||
|
||||
Langflow 1.0 introduces new categories of components called Inputs and Outputs. They are used to make it easier to understand and interact with your flows.
|
||||
|
||||
Let's start with what they have in common:
|
||||
|
||||
- Components in these categories connect to components that have Text or Record inputs or outputs. Some can connect to both but you have to pick what type of data you want to output or input.
|
||||
- They can be renamed to help you identify them more easily in the Playground and while using the API.
|
||||
- They dynamically change the Playground to make it easier to understand and interact with your flows.
|
||||
|
||||
Native Langflow Components were created to be powerful tools that work around Langflow's features. They are designed to be easy to use and understand, and to help you build your flows faster.
|
||||
|
||||
Let's dive into Inputs and Outputs.
|
||||
|
||||
## Inputs
|
||||
|
||||
Inputs are components that are used to define where data comes into your flow. They can be used to receive data from the user, from a database, or from any other source that can be converted to Text or Record.
|
||||
|
||||
The difference between Chat Input and other Input components is the format of the output, the number of configurable fields, and the way they are displayed in the Playground.
|
||||
|
||||
Chat Input components can output Text or Record. When you want to pass the sender name, or sender to the next component, you can use the Record output, and when you want to pass the message only you can use the Text output. This is useful when saving the message to a database or a memory system like Zep.
|
||||
|
||||
You can find out more about it and the other Inputs [here](../components/inputs).
|
||||
|
||||
## Outputs
|
||||
|
||||
Outputs are components that are used to define where data comes out of your flow. They can be used to send data to the user, to the Playground, or to define how the data will be displayed in the Playground.
|
||||
|
||||
The Chat Output works similarly to the Chat Input but does not have a field that allows for written input. It is used as an Output definition and can be used to send data to the user.
|
||||
|
||||
You can find out more about it and the other Outputs [here](../components/outputs).
|
||||
|
|
@ -41,7 +41,7 @@ We have a special channel in our Discord server dedicated to Langflow 1.0 migrat
|
|||
|
||||
Langflow 1.0 introduces adds the concept of Inputs and Outputs to flows, allowing a clear definition of the data flow between components. Discover how to use Inputs and Outputs to pass data between components and create more dynamic flows.
|
||||
|
||||
[Learn more about Inputs and Outputs of Components](../migration/inputs-and-outputs)
|
||||
[Learn more about Inputs and Outputs of Components](../components/inputs-and-outputs)
|
||||
|
||||
## To Compose or Not to Compose: the choice is yours
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ Langflow 1.0 introduces many new native categories, including Inputs, Outputs, H
|
|||
|
||||
With the introduction of Text and Record types connections between Components are more intuitive and easier to understand. This is the first step in a series of improvements to the way you interact with Langflow. Learn how to use Text, and Record and how they help you build better flows.
|
||||
|
||||
[Learn more about Text and Record](../migration/text-and-record)
|
||||
[Learn more about Text and Record](../components/text-and-record)
|
||||
|
||||
## CustomComponent for All Components
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ Things got a whole lot easier. You can now pass tweaks and inputs in the API by
|
|||
|
||||
Global Variables can be used in any Text Field across your projects. Learn how to define and utilize Global Variables to streamline your workflow.
|
||||
|
||||
[Learn more about Global Variables](../migration/global-variables)
|
||||
[Learn more about Global Variables](../administration/global-env.mdx)
|
||||
|
||||
## Experimental Components
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
# Text and Record
|
||||
|
||||
In Langflow 1.0 we added two main input and output types: Text and Record. Text is a simple string input and output type, while Record 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.
|
||||
|
||||
### Records To Text
|
||||
|
||||
This is a Component that takes in Records and outputs a Text. It does this using a template string and concatenating the values of the Record, one per line.
|
||||
|
||||
If we have the following Records:
|
||||
|
||||
```json
|
||||
{
|
||||
"sender_name": "Alice",
|
||||
"message": "Hello!"
|
||||
}
|
||||
{
|
||||
"sender_name": "John",
|
||||
"message": "Hi!"
|
||||
}
|
||||
```
|
||||
|
||||
And the template string is: _`{sender_name}: {message}`_
|
||||
|
||||
```
|
||||
Alice: Hello!
|
||||
John: Hi!
|
||||
```
|
||||
|
||||
### Create Record
|
||||
|
||||
This Component allows you to create a Record 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 Records
|
||||
|
||||
This Component takes in a [LangChain](https://langchain.com) Document and outputs a Record. It does this by extracting the _`page_content`_ and the _`metadata`_ from the Document and adding them to the Record 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! 🚀
|
||||
|
|
@ -41,7 +41,7 @@ By having a clear definition of Inputs and Outputs, we could build the experienc
|
|||
When building a project testing and debugging is crucial. The Playground is a tool that changes dynamically based on the Inputs and Outputs you defined in your project.
|
||||
|
||||
For example, let's say you are building a simple RAG application. Generally, you have an Input, some references that come from a Vector Store Search, a Prompt and the answer.
|
||||
Now, you could plug the output of your Prompt into a [Text Output](../components/outputs#Text-Output), rename that to "Prompt Result" and see the output of your Prompt in the Playground.
|
||||
Now, you could plug the output of your Prompt into a [Text Output](../components/inputs-and-outputs), rename that to "Prompt Result" and see the output of your Prompt in the Playground.
|
||||
|
||||
{/* Add image here of the described above */}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ module.exports = {
|
|||
label: "Core Components",
|
||||
collapsed: false,
|
||||
items: [
|
||||
"components/inputs",
|
||||
"components/outputs",
|
||||
"components/inputs-and-outputs",
|
||||
"components/text-and-record",
|
||||
"components/data",
|
||||
"components/models",
|
||||
"components/helpers",
|
||||
|
|
@ -91,15 +91,12 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Migration Guides",
|
||||
label: "Migration",
|
||||
collapsed: false,
|
||||
items: [
|
||||
"migration/possible-installation-issues",
|
||||
"migration/migrating-to-one-point-zero",
|
||||
"migration/inputs-and-outputs",
|
||||
"migration/text-and-record",
|
||||
"migration/compatibility",
|
||||
"migration/global-variables",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue