docs: added fetching from notion (#2670)

* Added new Docusaurus instance that fetches automatically from Notion

* Add Github workflow to fetch docs from Notion

* Added legacy peer deps to solve dependency problems

* Fix git ignore and added pages
This commit is contained in:
Lucas Oliveira 2024-07-12 17:59:52 -03:00 committed by GitHub
commit 3aa2513a86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
354 changed files with 20640 additions and 23291 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View file

@ -0,0 +1 @@
{"position":5, "label":"Components"}

View file

@ -0,0 +1,456 @@
---
title: Custom Components
sidebar_position: 8
slug: /components-custom-components
---
Langflow components can be created from within the platform, allowing users to extend the platform's functionality using Python code. They encapsulate are designed to be independent units, reusable across different workflows.
These components can be easily connected within a language model pipeline, adding freedom and flexibility to what can be included in between user and AI messages.
![](./238089171.png)
Since Langflow operates with Python behind the scenes, you can implement any Python function within a Custom Component. This means you can leverage the power of libraries such as Pandas, Scikit-learn, Numpy, and thousands of packages to create components that handle data processing in unlimited ways.
Custom Components are not just about extending functionality; they also streamline the development process. By creating reusable and configurable components, you can enhance the capabilities of Langflow, making it a powerful tool for developing complex workflows.
### Key Characteristics: {#d3a151089a9e4584bd420461cd1432c6}
1. **Modular and Reusable**: Designed as independent units, components encapsulate specific functionality, making them reusable across different projects and workflows.
2. **Integration with Python Libraries**: You can import libraries like Pandas, Scikit-learn, Numpy, etc., to build components that handle data processing, machine learning, numerical computations, and more.
3. **Flexible Inputs and Outputs**: While Langflow offers native input and output types, you can use any type as long as they are properly annotated in the output methods (e.g., `> list[int]`).
4. **Python-Powered**: Since Langflow operates with Python behind the scenes, any Python function can be implemented within a custom component.
5. **Enhanced Workflow**: Custom components serve as reusable building blocks, enabling you to create pre-processing visual blocks with ease and integrate them into your language model pipeline.
### Why Use Custom Components? {#827a2b5acec94426a4a2106a8332622d}
- **Customization**: Tailor the functionality to your specific needs by writing Python code that suits your workflow.
- **Flexibility**: Add any Python-based logic or processing step between user/AI messages, enhancing the flexibility of Langflow.
- **Efficiency**: Streamline your development process by creating reusable, configurable components that can be easily deployed.
### How to Write Them {#2088ade519514bb3923cdf7f2ac2089a}
---
Writing custom components in Langflow involves creating a Python class that defines the component's functionality, inputs, and outputs. The process involves a few key steps:
1. **Define the Class**: Start by defining a Python class that inherits from `Component`. This class will encapsulate the functionality of your custom component.
2. **Specify Inputs and Outputs**: Use Langflow's input and output classes to define the inputs and outputs of your component. They should be declared as class attributes.
3. **Implement Output Methods**: Implement methods for each output, which contains the logic of your component. These methods can access input values using `self.<input_name>` , return processed values and define what to be displayed in the component with the `self.status` attribute.
4. **Use Proper Annotations**: Ensure that output methods are properly annotated with their types. Langflow uses these annotations to validate and handle data correctly.
Here's a basic structure of a custom component:
```python
from langflow.custom import Component
from langflow.inputs import StrInput, IntInput
from langflow.template import Output
class MyCustomComponent(Component):
icon = "coffee" # check lucide.dev/icons or pass an emoji
inputs = [
StrInput(
name="input_text",
display_name="Input Text",
info="Text to be processed.",
),
IntInput(
name="input_number",
display_name="Input Number",
info="Number to be processed.",
),
]
outputs = [
Output(display_name="Processed Text", name="processed_text", method="process_text"),
]
def process_text(self) -> str:
input_text = self.input_text
input_number = self.input_number
# Implement your logic here
processed_text = f"{input_text} processed with number {input_number}"
self.status = processed_text
return processed_text
```
Paste that code into the Custom Component code snippet and click **Check & Save.**
![](./1028644105.png)
You should see something like the component below. Double click the name or description areas to edit them.
![](./241280398.png)
## Input Types {#3815589831f24ab792328ed233c8b00d}
---
Langflow provides several higher-level input types to simplify the creation of custom components. These input types standardize how inputs are defined, validated, and used. Heres a guide on how to use these inputs and their primary purposes:
### **HandleInput** {#fb06c48a326043ffa46badc1ab3ba467}
Represents an input that has a handle to a specific type (e.g., `BaseLanguageModel`, `BaseRetriever`, etc.).
- **Usage:** Useful for connecting to specific component types in a flow.
### **DataInput** {#0e1dcb768e38487180d720b0884a90f5}
Represents an input that receives a `Data` object.
- **Usage:** Ideal for components that process or manipulate data objects.
- **Input Types:** `["Data"]`
### **StrInput** {#4ec6e68ad9ab4cd194e8e607bc5b3411}
Represents a standard string input field.
- **Usage:** Used for any text input where the user needs to provide a string.
- **Input Types:** `["Text"]`
### **MessageInput** {#9292ac0105e14177af5eff2131b9c71b}
Represents an input field specifically for `Message` objects.
- **Usage:** Used in components that handle or process messages.
- **Input Types:** `["Message"]`
### **MessageTextInput** {#5511f5e32b944b4e973379a6bd5405e4}
Represents a text input for messages.
- **Usage:** Suitable for components that need to extract text from message objects.
- **Input Types:** `["Message"]`
### **MultilineInput** {#e6d8315b0fb44a2fb8c62c3f3184bbe9}
Represents a text field that supports multiple lines.
- **Usage:** Ideal for longer text inputs where the user might need to write extended text.
- **Input Types:** `["Text"]`
- **Attributes:** `multiline=True`
### **SecretStrInput** {#2283c13aa5f745b8b0009f7d40e59419}
Represents a password input field.
- **Usage:** Used for sensitive text inputs where the input should be hidden (e.g., passwords, API keys).
- **Attributes:** `password=True`
- **Input Types:** Does not accept input types, meaning it has no input handles for previous nodes/components to connect to it.
### **IntInput** {#612680db6578451daef695bd19827a56}
Represents an integer input field.
- **Usage:** Used for numeric inputs where the value should be an integer.
- **Input Types:** `["Integer"]`
### **FloatInput** {#a15e1fdae15b49fc9bfbf38f8bd7b203}
Represents a float input field.
- **Usage:** Used for numeric inputs where the value should be a floating-point number.
- **Input Types:** `["Float"]`
### **BoolInput** {#3083671e0e7f4390a03396485114be66}
Represents a boolean input field.
- **Usage:** Used for true/false or yes/no type inputs.
- **Input Types:** `["Boolean"]`
### **NestedDictInput** {#2866fc4018e743d8a45afde53f1e57be}
Represents an input field for nested dictionaries.
- **Usage:** Used for more complex data structures where the input needs to be a dictionary.
- **Input Types:** `["NestedDict"]`
### **DictInput** {#daa2c2398f694ec199b425e2ed4bcf93}
Represents an input field for dictionaries.
- **Usage:** Suitable for inputs that require a dictionary format.
- **Input Types:** `["Dict"]`
### **DropdownInput** {#14dcdef11bab4d3f8127eaf2e36a77b9}
Represents a dropdown input field.
- **Usage:** Used where the user needs to select from a predefined list of options.
- **Attributes:** `options` to define the list of selectable options.
- **Input Types:** `["Text"]`
### **FileInput** {#73e6377dc5f446f39517a558a1291410}
Represents a file input field.
- **Usage:** Used to upload files.
- **Attributes:** `file_types` to specify the types of files that can be uploaded.
- **Input Types:** `["File"]`
Here is an example of how these inputs can be defined in a custom component:
```python
from langflow.custom import Component
from langflow.inputs import StrInput, MultilineInput, SecretStrInput, IntInput, DropdownInput
from langflow.template import Output, Input
class MyCustomComponent(Component):
display_name = "My Custom Component"
description = "An example of a custom component with various input types."
inputs = [
StrInput(
name="username",
display_name="Username",
info="Enter your username."
),
SecretStrInput(
name="password",
display_name="Password",
info="Enter your password."
),
MultilineInput(
name="description",
display_name="Description",
info="Enter a detailed description.",
),
IntInput(
name="age",
display_name="Age",
info="Enter your age."
),
DropdownInput(
name="gender",
display_name="Gender",
options=["Male", "Female", "Other"],
info="Select your gender."
)
]
outputs = [
Output(display_name="Result", name="result", method="process_inputs"),
]
def process_inputs(self):
# Your processing logic here
return "Processed"
```
By defining inputs this way, Langflow can automatically handle the validation and display of these fields in the user interface, making it easier to create robust and user-friendly custom components.
All of the types detailed above derive from a general class that can also be accessed through the generic `Input` class.
### Generic Input {#278e2027493e45b68746af0a5b6c06f6}
---
Langflow offers native input types, but you can use any type as long as they are properly annotated in the output methods (e.g., `-> list[int]`).
The `Input` class is highly customizable, allowing you to specify a wide range of attributes for each input field. It has several attributes that can be customized:
- `field_type`: Specifies the type of field (e.g., `str`, `int`). Default is `str`.
- `required`: Boolean indicating if the field is required. Default is `False`.
- `placeholder`: Placeholder text for the input field. Default is an empty string.
- `is_list`: Boolean indicating if the field should accept a list of values. Default is `False`.
- `show`: Boolean indicating if the field should be shown. Default is `True`.
- `multiline`: Boolean indicating if the field should allow multi-line input. Default is `False`.
- `value`: Default value for the input field. Default is `None`.
- `file_types`: List of accepted file types (for file inputs). Default is an empty list.
- `file_path`: File path if the field is a file input. Default is `None`.
- `password`: Boolean indicating if the field is a password. Default is `False`.
- `options`: List of options for the field (for dropdowns). Default is `None`.
- `name`: Name of the input field. Default is `None`.
- `display_name`: Display name for the input field. Default is `None`.
- `advanced`: Boolean indicating if the field is an advanced parameter. Default is `False`.
- `input_types`: List of accepted input types. Default is `None`.
- `dynamic`: Boolean indicating if the field is dynamic. Default is `False`.
- `info`: Additional information or tooltip for the input field. Default is an empty string.
- `real_time_refresh`: Boolean indicating if the field should refresh in real-time. Default is `None`.
- `refresh_button`: Boolean indicating if the field should have a refresh button. Default is `None`.
- `refresh_button_text`: Text for the refresh button. Default is `None`.
- `range_spec`: Range specification for numeric fields. Default is `None`.
- `load_from_db`: Boolean indicating if the field should load from the database. Default is `False`.
- `title_case`: Boolean indicating if the display name should be in title case. Default is `True`.
Below is an example of how to define inputs for a component using the `Input` class:
```python
from langflow.template import Input, Output
from langflow.custom import Component
from langflow.field_typing import Text
class ExampleComponent(Component):
display_name = "Example Component"
description = "An example component demonstrating input fields."
inputs = [
Input(
name="input_text",
display_name="Input Text",
field_type="str",
required=True,
placeholder="Enter some text",
multiline=True,
info="This is a required text input.",
input_types=["Text"]
),
Input(
name="max_length",
display_name="Max Length",
field_type="int",
required=False,
placeholder="Maximum length",
info="Enter the maximum length of the text.",
range_spec={"min": 0, "max": 1000},
),
Input(
name="options",
display_name="Options",
field_type="str",
is_list=True,
options=["Option 1", "Option 2", "Option 3"],
info="Select one or more options."
),
]
outputs = [
Output(display_name="Result", name="result", method="process_input"),
]
def process_input(self) -> Text:
# Process the inputs and generate output
return Text(value=f"Processed: {self.input_text}, Max Length: {self.max_length}, Options: {self.options}")
# Define how to use the inputs and outputs
component = ExampleComponent()
```
In this example:
- The `input_text` input is a required multi-line text field.
- The `max_length` input is an optional integer field with a range specification.
- The `options` input is a list of strings with predefined options.
These attributes allow for a high degree of customization, making it easy to create input fields that suit the needs of your specific component.
### Multiple Outputs {#6f225be8a142450aa19ee8e46a3b3c8c}
---
In Langflow, custom components can have multiple outputs. Each output can be associated with a specific method in the component, allowing you to define distinct behaviors for each output path. This feature is particularly useful when you want to route data based on certain conditions or process it in multiple ways.
1. **Definition of Outputs**: Each output is defined in the `outputs` list of the component. Each output is associated with a display name, an internal name, and a method that gets called to generate the output.
2. **Output Methods**: The methods associated with outputs are responsible for generating the data for that particular output. These methods are called when the component is executed, and each method can independently produce its result.
Below is an example of a component with two outputs:
- `process_data`: Processes the input text (e.g., converts it to uppercase) and returns it.
- `get_processing_function`: Returns the `process_data` method itself to be reused in composition.
```python
from typing import Callable
from langflow.custom import Component
from langflow.inputs import StrInput
from langflow.template import Output
from langflow.field_typing import Text
class DualOutputComponent(Component):
display_name = "Dual Output"
description = "Processes input text and returns both the result and the processing function."
icon = "double-arrow"
inputs = [
StrInput(
name="input_text",
display_name="Input Text",
info="The text input to be processed.",
),
]
outputs = [
Output(display_name="Processed Data", name="processed_data", method="process_data"),
Output(display_name="Processing Function", name="processing_function", method="get_processing_function"),
]
def process_data(self) -> Text:
# Process the input text (e.g., convert to uppercase)
processed = self.input_text.upper()
self.status = processed
return processed
def get_processing_function(self) -> Callable[[], Text]:
# Return the processing function itself
return self.process_data
```
This example shows how to define multiple outputs in a custom component. The first output returns the processed data, while the second output returns the processing function itself.
The `processing_function` output can be used in scenarios where the function itself is needed for further processing or dynamic flow control. Notice how both outputs are properly annotated with their respective types, ensuring clarity and type safety.
## Special Operations {#b1ef2d18e2694b93927ae9403d24b96b}
---
Advanced methods and attributes offer additional control and functionality. Understanding how to leverage these can enhance your custom components' capabilities.
- `self.inputs`: Access all defined inputs. Useful when an output method needs to interact with multiple inputs.
- `self.outputs`: Access all defined outputs. This is particularly useful if an output function needs to trigger another output function.
- `self.status`: Use this to update the component's status or intermediate results. It helps track the component's internal state or store temporary data.
- `self.graph.flow_id`: Retrieve the flow ID, useful for maintaining context or debugging.
- `self.stop("output_name")`: Use this method within an output function to prevent data from being sent through other components. This method stops next component execution and is particularly useful for specific operations where a component should stop from running based on specific conditions.

View file

@ -0,0 +1,89 @@
---
title: Data
sidebar_position: 3
slug: /components-data
---
## API Request {#23da589293f74016a1f70d6d7c0fdc55}
---
This component sends HTTP requests to the specified URLs.
Use this component to interact with external APIs or services and retrieve data. Ensure that the URLs are valid and that you configure the method, headers, body, and timeout correctly.
**Parameters:**
- **URLs:** The URLs to target.
- **Method:** The HTTP method, such as GET or POST.
- **Headers:** The headers to include with the request.
- **Body:** The data to send with the request (for methods like POST, PATCH, PUT).
- **Timeout:** The maximum time to wait for a response.
## Directory {#4fe56acaaac847029ace173dc793f8f4}
---
This component recursively retrieves files from a specified directory.
Use this component to retrieve various file types, such as text or JSON files, from a directory. Make sure to provide the correct path and configure the other parameters as needed.
**Parameters:**
- **Path:** The directory path.
- **Types:** The types of files to retrieve. Leave this blank to retrieve all file types.
- **Depth:** The level of directory depth to search.
- **Max Concurrency:** The maximum number of simultaneous file loading operations.
- **Load Hidden:** Set to true to include hidden files.
- **Recursive:** Set to true to enable recursive search.
- **Silent Errors:** Set to true to suppress exceptions on errors.
- **Use Multithreading:** Set to true to use multithreading in file loading.
## File {#d5d4bb78ce0a473d8a3b6a296d3e8383}
---
This component loads a file.
Use this component to load files, such as text or JSON files. Ensure you specify the correct path and configure other parameters as necessary.
**Parameters:**
- **Path:** The file path.
- **Silent Errors:** Set to true to prevent exceptions on errors.
## URL {#1cc513827a0942d6885b3a9168eabc97}
---
This component retrieves content from specified URLs.
Ensure the URLs are valid and adjust other parameters as needed. **Parameters:**
- **URLs:** The URLs to retrieve content from.
## Create Data {#aac4cad0cd38426191c2e7516285877b}
---
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.

View file

@ -0,0 +1,164 @@
---
title: Embedding Models
sidebar_position: 6
slug: /components-embedding-models
---
## Amazon Bedrock Embeddings {#4ddcfde8c1664e358d3f16d718e944d8}
Used to load embedding models from [Amazon Bedrock](https://aws.amazon.com/bedrock/).
| **Parameter** | **Type** | **Description** | **Default** |
| -------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `credentials_profile_name` | `str` | Name of the AWS credentials profile in ~/.aws/credentials or ~/.aws/config, which has access keys or role information. | |
| `model_id` | `str` | ID of the model to call, e.g., `amazon.titan-embed-text-v1`. This is equivalent to the `modelId` property in the `list-foundation-models` API. | |
| `endpoint_url` | `str` | URL to set a specific service endpoint other than the default AWS endpoint. | |
| `region_name` | `str` | AWS region to use, e.g., `us-west-2`. Falls back to `AWS_DEFAULT_REGION` environment variable or region specified in ~/.aws/config if not provided. | |
## Astra vectorize {#c1e6d1373824424ea130e052ba0f46af}
Used to generate server-side embeddings using [DataStax Astra](https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html).
| **Parameter** | **Type** | **Description** | **Default** |
| ------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- | ----------- |
| `provider` | `str` | The embedding provider to use. | |
| `model_name` | `str` | The embedding model to use. | |
| `authentication` | `dict` | Authentication parameters. Use the Astra Portal to add the embedding provider integration to your Astra organization. | |
| `provider_api_key` | `str` | An alternative to the Astra Authentication that let you use directly the API key of the provider. | |
| `model_parameters` | `dict` | Additional model parameters. | |
## Cohere Embeddings {#0c5b7b8790da448fabd4c5ddba1fcbde}
Used to load embedding models from [Cohere](https://cohere.com/).
| **Parameter** | **Type** | **Description** | **Default** |
| ---------------- | -------- | ------------------------------------------------------------------------- | -------------------- |
| `cohere_api_key` | `str` | API key required to authenticate with the Cohere service. | |
| `model` | `str` | Language model used for embedding text documents and performing queries. | `embed-english-v2.0` |
| `truncate` | `bool` | Whether to truncate the input text to fit within the model's constraints. | `False` |
## Azure OpenAI Embeddings {#8ffb790d5a6c484dab3fe6c777638a44}
Generate embeddings using Azure OpenAI models.
| **Parameter** | **Type** | **Description** | **Default** |
| ----------------- | -------- | -------------------------------------------------------------------------------------------------- | ----------- |
| `Azure Endpoint` | `str` | Your Azure endpoint, including the resource. Example: `https://example-resource.azure.openai.com/` | |
| `Deployment Name` | `str` | The name of the deployment. | |
| `API Version` | `str` | The API version to use, options include various dates. | |
| `API Key` | `str` | The API key to access the Azure OpenAI service. | |
## Hugging Face API Embeddings {#8536e4ee907b48688e603ae9bf7822cb}
Generate embeddings using Hugging Face Inference API models.
| **Parameter** | **Type** | **Description** | **Default** |
| --------------- | -------- | ----------------------------------------------------- | ------------------------ |
| `API Key` | `str` | API key for accessing the Hugging Face Inference API. | |
| `API URL` | `str` | URL of the Hugging Face Inference API. | `http://localhost:8080` |
| `Model Name` | `str` | Name of the model to use for embeddings. | `BAAI/bge-large-en-v1.5` |
| `Cache Folder` | `str` | Folder path to cache Hugging Face models. | |
| `Encode Kwargs` | `dict` | Additional arguments for the encoding process. | |
| `Model Kwargs` | `dict` | Additional arguments for the model. | |
| `Multi Process` | `bool` | Whether to use multiple processes. | `False` |
## Hugging Face Embeddings {#b2b74732874743d3be6fdf8aae049e74}
Used to load embedding models from [HuggingFace](https://huggingface.co/).
| **Parameter** | **Type** | **Description** | **Default** |
| --------------- | -------- | ---------------------------------------------- | ----------------------------------------- |
| `Cache Folder` | `str` | Folder path to cache HuggingFace models. | |
| `Encode Kwargs` | `dict` | Additional arguments for the encoding process. | |
| `Model Kwargs` | `dict` | Additional arguments for the model. | |
| `Model Name` | `str` | Name of the HuggingFace model to use. | `sentence-transformers/all-mpnet-base-v2` |
| `Multi Process` | `bool` | Whether to use multiple processes. | `False` |
## OpenAI Embeddings {#af7630df05a245d1a632e1bf6db2a4c5}
Used to load embedding models from [OpenAI](https://openai.com/).
| **Parameter** | **Type** | **Description** | **Default** |
| -------------------------- | ---------------- | ------------------------------------------------ | ------------------------ |
| `OpenAI API Key` | `str` | The API key to use for accessing the OpenAI API. | |
| `Default Headers` | `Dict[str, str]` | Default headers for the HTTP requests. | |
| `Default Query` | `NestedDict` | Default query parameters for the HTTP requests. | |
| `Allowed Special` | `List[str]` | Special tokens allowed for processing. | `[]` |
| `Disallowed Special` | `List[str]` | Special tokens disallowed for processing. | `["all"]` |
| `Chunk Size` | `int` | Chunk size for processing. | `1000` |
| `Client` | `Any` | HTTP client for making requests. | |
| `Deployment` | `str` | Deployment name for the model. | `text-embedding-3-small` |
| `Embedding Context Length` | `int` | Length of embedding context. | `8191` |
| `Max Retries` | `int` | Maximum number of retries for failed requests. | `6` |
| `Model` | `str` | Name of the model to use. | `text-embedding-3-small` |
| `Model Kwargs` | `NestedDict` | Additional keyword arguments for the model. | |
| `OpenAI API Base` | `str` | Base URL of the OpenAI API. | |
| `OpenAI API Type` | `str` | Type of the OpenAI API. | |
| `OpenAI API Version` | `str` | Version of the OpenAI API. | |
| `OpenAI Organization` | `str` | Organization associated with the API key. | |
| `OpenAI Proxy` | `str` | Proxy server for the requests. | |
| `Request Timeout` | `float` | Timeout for the HTTP requests. | |
| `Show Progress Bar` | `bool` | Whether to show a progress bar for processing. | `False` |
| `Skip Empty` | `bool` | Whether to skip empty inputs. | `False` |
| `TikToken Enable` | `bool` | Whether to enable TikToken. | `True` |
| `TikToken Model Name` | `str` | Name of the TikToken model. | |
## Ollama Embeddings {#a26d2cb92e6d44669c2cfff71a5e9431}
Generate embeddings using Ollama models.
| **Parameter** | **Type** | **Description** | **Default** |
| ------------------- | -------- | ---------------------------------------------------------------------------------------- | ------------------------ |
| `Ollama Model` | `str` | Name of the Ollama model to use. | `llama2` |
| `Ollama Base URL` | `str` | Base URL of the Ollama API. | `http://localhost:11434` |
| `Model Temperature` | `float` | Temperature parameter for the model. Adjusts the randomness in the generated embeddings. | |
## VertexAI Embeddings {#707b38c23cb9413fbbaab1ae7b872311}
Wrapper around [Google Vertex AI](https://cloud.google.com/vertex-ai) [Embeddings API](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings).
| **Parameter** | **Type** | **Description** | **Default** |
| --------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------- |
| `credentials` | `Credentials` | The default custom credentials to use. | |
| `location` | `str` | The default location to use when making API calls. | `us-central1` |
| `max_output_tokens` | `int` | Token limit determines the maximum amount of text output from one prompt. | `128` |
| `model_name` | `str` | The name of the Vertex AI large language model. | `text-bison` |
| `project` | `str` | The default GCP project to use when making Vertex API calls. | |
| `request_parallelism` | `int` | The amount of parallelism allowed for requests issued to VertexAI models. | `5` |
| `temperature` | `float` | Tunes the degree of randomness in text generations. Should be a non-negative value. | `0` |
| `top_k` | `int` | How the model selects tokens for output, the next token is selected from the top `k` tokens. | `40` |
| `top_p` | `float` | Tokens are selected from the most probable to least until the sum of their probabilities exceeds the top `p` value. | `0.95` |
| `tuned_model_name` | `str` | The name of a tuned model. If provided, `model_name` is ignored. | |
| `verbose` | `bool` | This parameter controls the level of detail in the output. When set to `True`, it prints internal states of the chain to help debug. | `False` |
[Previous Vector Stores](/components-vector-stores)

View file

@ -0,0 +1,161 @@
---
title: Helpers
sidebar_position: 4
slug: /components-helpers
---
## Chat memory {#304dc4a3bea74efb9068093ff18a56ad}
This component retrieves stored chat messages based on a specific session ID.
### Parameters {#e0af57d97f844ce99789958161d19767}
- **Sender type:** Choose the sender type from options like "Machine", "User", or "Both".
- **Sender name:** (Optional) The name of the sender.
- **Number of messages:** Number of messages to retrieve.
- **Session ID:** The session ID of the chat history.
- **Order:** Choose the message order, either "Ascending" or "Descending".
- **Data template:** (Optional) Template to convert a record to text. If left empty, the system dynamically sets it to the record's text key.
---
### Combine text {#13443183e6054d0694d65f8df08833d5}
This component concatenates two text sources into a single text chunk using a specified delimiter.
### Parameters {#246676d119604fc5bf1be85fe93044aa}
- **First text:** The first text input to concatenate.
- **Second text:** The second text input to concatenate.
- **Delimiter:** A string used to separate the two text inputs. Defaults to a space.
---
### Create record {#506f43345854473b8199631bf68a3b4a}
This component dynamically creates a record with a specified number of fields.
### Parameters {#08735e90bd10406695771bad8a95976a}
- **Number of fields:** Number of fields to be added to the record.
- **Text key:** Key used as text.
---
### Custom component {#cda421d4bccb4e7db2e48615884ed753}
Use this component as a template to create your custom component.
### Parameters {#04f9eb5e6da4431593a5bee8831f2327}
- **Parameter:** Describe the purpose of this parameter.
INFO
Customize the `build_config` and `build` methods according to your requirements.
Learn more about creating custom components at [Custom Component](http://docs.langflow.org/components/custom).
---
### Documents to Data {#53a6a99a54f0435e9209169cf7730c55}
Convert LangChain documents into Data.
### Parameters {#0eb5fce528774c2db4a3677973e75cf8}
- **Documents:** Documents to be converted into Data.
---
### ID generator {#4a8fbfb95ebe44ee8718725546db5393}
Generates a unique ID.
### Parameters {#4629dd15594c47399c97d9511060e114}
- **Value:** Unique ID generated.
---
### Message history {#6a1a60688641490197c6443df573960e}
Retrieves stored chat messages based on a specific session ID.
### Parameters {#31c7fc2a3e8c4f7c89f923e700f4ea34}
- **Sender type:** Options for the sender type.
- **Sender name:** Sender name.
- **Number of messages:** Number of messages to retrieve.
- **Session ID:** Session ID of the chat history.
- **Order:** Order of the messages.
---
### Data to text {#f60ab5bbc0db4b27b427897eba97fe29}
Convert Data into plain text following a specified template.
### Parameters {#01b91376569149a49cfcfd9321323688}
- **Data:** The Data to convert to text.
- **Template:** The template used for formatting the Data. It can contain keys like `{text}`, `{data}`, or any other key in the record.
---
### Split text {#210be0ae518d411695d6caafdd7700eb}
Split text into chunks of a specified length.
### Parameters {#04197fcd05e64e10b189de1171a32682}
- **Texts:** Texts to split.
- **Separators:** Characters to split on. Defaults to a space.
- **Max chunk size:** The maximum length (in characters) of each chunk.
- **Chunk overlap:** The amount of character overlap between chunks.
- **Recursive:** Whether to split recursively.
---
### Update record {#d3b6116dfd8d4af080ad01bc8fd2b0b3}
Update a record with text-based key/value pairs, similar to updating a Python dictionary.
### Parameters {#c830224edc1d486aaaa5e2889f4f6689}
- **Data:** The record to update.
- **New data:** The new data to update the record with.

View file

@ -0,0 +1,135 @@
---
title: Inputs & Outputs
sidebar_position: 1
slug: /components-io
---
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 {#6b1421ec66994d5ebe9fcce000829328}
---
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 Data.
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 `Data`. When you want to pass the sender name or sender to the next component, use the `Data` 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](/components-io).
### Chat Input {#2a5f02262f364f8fb75bcfa246e7bb26}
---
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.
NOTE
If `As Data` is `true` and the `Message` is a `Data`, the data of the `Data` will be updated with the `Sender`, `Sender Name`, and `Session ID`.
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.
### Text Input {#260aef3726834896b496b56cdefb6d4a}
---
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.
- **Data Template:** Specifies how a `Data` should be converted into `Text`.
The **Data Template** field is used to specify how a `Data` should be converted into `Text`. This is particularly useful when you want to extract specific information from a `Data` and pass it as text to the next component in the sequence.
For example, if you have a `Data` with the following structure:
`{ "name": "John Doe", "age": 30, "email": "johndoe@email.com"}`
A template with `Name: {name}, Age: {age}` will convert the `Data` into a text string of `Name: John Doe, Age: 30`.
If you pass more than one `Data`, the text will be concatenated with a new line separator.
## Outputs {#f62c5ad37a6f45a39b463c9b35ce7842}
---
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-io).
### Chat Output {#1edd49b72781432ea29d70acbda4e7e7}
---
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.
NOTE
If `As Data` is `true` and the `Message` is a `Data`, the data in the `Data` is updated with the `Sender`, `Sender Name`, and `Session ID`.
### Text Output {#b607000bc0c5402db0433c1a7d734d01}
---
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.

View file

@ -0,0 +1,309 @@
---
title: Models
sidebar_position: 5
slug: /components-models
---
## Amazon Bedrock {#3b8ceacef3424234814f95895a25bf43}
This component facilitates the generation of text using the LLM (Large Language Model) model from Amazon Bedrock.
**Params**
- **Input Value:** Specifies the input text for text generation.
- **System Message (Optional):** A system message to pass to the model.
- **Model ID (Optional):** Specifies the model ID to be used for text generation. Defaults to `"anthropic.claude-instant-v1"`. Available options include:
- `"ai21.j2-grande-instruct"`
- `"ai21.j2-jumbo-instruct"`
- `"ai21.j2-mid"`
- `"ai21.j2-mid-v1"`
- `"ai21.j2-ultra"`
- `"ai21.j2-ultra-v1"`
- `"anthropic.claude-instant-v1"`
- `"anthropic.claude-v1"`
- `"anthropic.claude-v2"`
- `"cohere.command-text-v14"`
- **Credentials Profile Name (Optional):** Specifies the name of the credentials profile.
- **Region Name (Optional):** Specifies the region name.
- **Model Kwargs (Optional):** Additional keyword arguments for the model.
- **Endpoint URL (Optional):** Specifies the endpoint URL.
- **Streaming (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **Cache (Optional):** Specifies whether to cache the response.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
NOTE
Ensure that necessary credentials are provided to connect to the Amazon Bedrock API. If connection fails, a ValueError will be raised.
---
## Anthropic {#a6ae46f98c4c4d389d44b8408bf151a1}
This component allows the generation of text using Anthropic Chat&Completion large language models.
**Params**
- **Model Name:** Specifies the name of the Anthropic model to be used for text generation. Available options include (and not limited to):
- `"claude-2.1"`
- `"claude-2.0"`
- `"claude-instant-1.2"`
- `"claude-instant-1"`
- **Anthropic API Key:** Your Anthropic API key.
- **Max Tokens (Optional):** Specifies the maximum number of tokens to generate. Defaults to `256`.
- **Temperature (Optional):** Specifies the sampling temperature. Defaults to `0.7`.
- **API Endpoint (Optional):** Specifies the endpoint of the Anthropic API. Defaults to `"https://api.anthropic.com"`if not specified.
- **Input Value:** Specifies the input text for text generation.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
For detailed documentation and integration guides, please refer to the [Anthropic Component Documentation](https://python.langchain.com/docs/integrations/chat/anthropic).
---
## Azure OpenAI {#7e3bff29ce714479b07feeb4445680cd}
This component allows the generation of text using the LLM (Large Language Model) model from Azure OpenAI.
**Params**
- **Model Name:** Specifies the name of the Azure OpenAI model to be used for text generation. Available options include:
- `"gpt-35-turbo"`
- `"gpt-35-turbo-16k"`
- `"gpt-35-turbo-instruct"`
- `"gpt-4"`
- `"gpt-4-32k"`
- `"gpt-4-vision"`
- `"gpt-4o"`
- **Azure Endpoint:** Your Azure endpoint, including the resource. Example: `https://example-resource.azure.openai.com/`.
- **Deployment Name:** Specifies the name of the deployment.
- **API Version:** Specifies the version of the Azure OpenAI API to be used. Available options include:
- `"2023-03-15-preview"`
- `"2023-05-15"`
- `"2023-06-01-preview"`
- `"2023-07-01-preview"`
- `"2023-08-01-preview"`
- `"2023-09-01-preview"`
- `"2023-12-01-preview"`
- **API Key:** Your Azure OpenAI API key.
- **Temperature (Optional):** Specifies the sampling temperature. Defaults to `0.7`.
- **Max Tokens (Optional):** Specifies the maximum number of tokens to generate. Defaults to `1000`.
- **Input Value:** Specifies the input text for text generation.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
For detailed documentation and integration guides, please refer to the [Azure OpenAI Component Documentation](https://python.langchain.com/docs/integrations/llms/azure_openai).
---
## Cohere {#706396a33bf94894966c95571252d78b}
This component enables text generation using Cohere large language models.
**Params**
- **Cohere API Key:** Your Cohere API key.
- **Max Tokens (Optional):** Specifies the maximum number of tokens to generate. Defaults to `256`.
- **Temperature (Optional):** Specifies the sampling temperature. Defaults to `0.75`.
- **Input Value:** Specifies the input text for text generation.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
---
## Google Generative AI {#074d9623463449f99d41b44699800e8a}
This component enables text generation using Google Generative AI.
**Params**
- **Google API Key:** Your Google API key to use for the Google Generative AI.
- **Model:** The name of the model to use. Supported examples are `"gemini-pro"` and `"gemini-pro-vision"`.
- **Max Output Tokens (Optional):** The maximum number of tokens to generate.
- **Temperature:** Run inference with this temperature. Must be in the closed interval [0.0, 1.0].
- **Top K (Optional):** Decode using top-k sampling: consider the set of top_k most probable tokens. Must be positive.
- **Top P (Optional):** The maximum cumulative probability of tokens to consider when sampling.
- **N (Optional):** Number of chat completions to generate for each prompt. Note that the API may not return the full n completions if duplicates are generated.
- **Input Value:** The input to the model.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
---
## Hugging Face API {#c1267b9a6b36487cb2ee127ce9b64dbb}
This component facilitates text generation using LLM models from the Hugging Face Inference API.
**Params**
- **Endpoint URL:** The URL of the Hugging Face Inference API endpoint. Should be provided along with necessary authentication credentials.
- **Task:** Specifies the task for text generation. Options include `"text2text-generation"`, `"text-generation"`, and `"summarization"`.
- **API Token:** The API token required for authentication with the Hugging Face Hub.
- **Model Keyword Arguments (Optional):** Additional keyword arguments for the model. Should be provided as a Python dictionary.
- **Input Value:** The input text for text generation.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
---
## LiteLLM Model {#9fb59dad3b294a05966320d39f483a50}
Generates text using the `LiteLLM` collection of large language models.
**Parameters**
- **Model name:** The name of the model to use. For example, `gpt-3.5-turbo`. (Type: str)
- **API key:** The API key to use for accessing the provider's API. (Type: str, Optional)
- **Provider:** The provider of the API key. (Type: str, Choices: "OpenAI", "Azure", "Anthropic", "Replicate", "Cohere", "OpenRouter")
- **Temperature:** Controls the randomness of the text generation. (Type: float, Default: 0.7)
- **Model kwargs:** Additional keyword arguments for the model. (Type: Dict, Optional)
- **Top p:** Filter responses to keep the cumulative probability within the top p tokens. (Type: float, Optional)
- **Top k:** Filter responses to only include the top k tokens. (Type: int, Optional)
- **N:** Number of chat completions to generate for each prompt. (Type: int, Default: 1)
- **Max tokens:** The maximum number of tokens to generate for each chat completion. (Type: int, Default: 256)
- **Max retries:** Maximum number of retries for failed requests. (Type: int, Default: 6)
- **Verbose:** Whether to print verbose output. (Type: bool, Default: False)
- **Input:** The input prompt for text generation. (Type: str)
- **Stream:** Whether to stream the output. (Type: bool, Default: False)
- **System message:** System message to pass to the model. (Type: str, Optional)
---
## Ollama {#14e8e411d28d4711add53bfc3e52c6cd}
Generate text using Ollama Local LLMs.
**Parameters**
- **Base URL:** Endpoint of the Ollama API. Defaults to '[http://localhost:11434](http://localhost:11434/)' if not specified.
- **Model Name:** The model name to use. Refer to [Ollama Library](https://ollama.ai/library) for more models.
- **Temperature:** Controls the creativity of model responses. (Default: 0.8)
- **Cache:** Enable or disable caching. (Default: False)
- **Format:** Specify the format of the output (e.g., json). (Advanced)
- **Metadata:** Metadata to add to the run trace. (Advanced)
- **Mirostat:** Enable/disable Mirostat sampling for controlling perplexity. (Default: Disabled)
- **Mirostat Eta:** Learning rate for Mirostat algorithm. (Default: None) (Advanced)
- **Mirostat Tau:** Controls the balance between coherence and diversity of the output. (Default: None) (Advanced)
- **Context Window Size:** Size of the context window for generating tokens. (Default: None) (Advanced)
- **Number of GPUs:** Number of GPUs to use for computation. (Default: None) (Advanced)
- **Number of Threads:** Number of threads to use during computation. (Default: None) (Advanced)
- **Repeat Last N:** How far back the model looks to prevent repetition. (Default: None) (Advanced)
- **Repeat Penalty:** Penalty for repetitions in generated text. (Default: None) (Advanced)
- **TFS Z:** Tail free sampling value. (Default: None) (Advanced)
- **Timeout:** Timeout for the request stream. (Default: None) (Advanced)
- **Top K:** Limits token selection to top K. (Default: None) (Advanced)
- **Top P:** Works together with top-k. (Default: None) (Advanced)
- **Verbose:** Whether to print out response text.
- **Tags:** Tags to add to the run trace. (Advanced)
- **Stop Tokens:** List of tokens to signal the model to stop generating text. (Advanced)
- **System:** System to use for generating text. (Advanced)
- **Template:** Template to use for generating text. (Advanced)
- **Input:** The input text.
- **Stream:** Whether to stream the response.
- **System Message:** System message to pass to the model. (Advanced)
---
## OpenAI {#fe6cd793446748eda6eaad72e30f70b3}
This component facilitates text generation using OpenAI's models.
**Params**
- **Input Value:** The input text for text generation.
- **Max Tokens (Optional):** The maximum number of tokens to generate. Defaults to `256`.
- **Model Kwargs (Optional):** Additional keyword arguments for the model. Should be provided as a nested dictionary.
- **Model Name (Optional):** The name of the model to use. Defaults to `gpt-4-1106-preview`. Supported options include: `gpt-4-turbo-preview`, `gpt-4-0125-preview`, `gpt-4-1106-preview`, `gpt-4-vision-preview`, `gpt-3.5-turbo-0125`, `gpt-3.5-turbo-1106`.
- **OpenAI API Base (Optional):** The base URL of the OpenAI API. Defaults to `https://api.openai.com/v1`.
- **OpenAI API Key (Optional):** The API key for accessing the OpenAI API.
- **Temperature:** Controls the creativity of model responses. Defaults to `0.7`.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** System message to pass to the model.
---
## Qianfan {#6e4a6b2370ee4b9f8beb899e7cf9c8f6}
This component facilitates the generation of text using Baidu Qianfan chat models.
**Params**
- **Model Name:** Specifies the name of the Qianfan chat model to be used for text generation. Available options include:
- `"ERNIE-Bot"`
- `"ERNIE-Bot-turbo"`
- `"BLOOMZ-7B"`
- `"Llama-2-7b-chat"`
- `"Llama-2-13b-chat"`
- `"Llama-2-70b-chat"`
- `"Qianfan-BLOOMZ-7B-compressed"`
- `"Qianfan-Chinese-Llama-2-7B"`
- `"ChatGLM2-6B-32K"`
- `"AquilaChat-7B"`
- **Qianfan Ak:** Your Baidu Qianfan access key, obtainable from [here](https://cloud.baidu.com/product/wenxinworkshop).
- **Qianfan Sk:** Your Baidu Qianfan secret key, obtainable from [here](https://cloud.baidu.com/product/wenxinworkshop).
- **Top p (Optional):** Model parameter. Specifies the top-p value. Only supported in ERNIE-Bot and ERNIE-Bot-turbo models. Defaults to `0.8`.
- **Temperature (Optional):** Model parameter. Specifies the sampling temperature. Only supported in ERNIE-Bot and ERNIE-Bot-turbo models. Defaults to `0.95`.
- **Penalty Score (Optional):** Model parameter. Specifies the penalty score. Only supported in ERNIE-Bot and ERNIE-Bot-turbo models. Defaults to `1.0`.
- **Endpoint (Optional):** Endpoint of the Qianfan LLM, required if custom model is used.
- **Input Value:** Specifies the input text for text generation.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** A system message to pass to the model.
---
## Vertex AI {#86b7d539e17c436fb758c47ec3ffb084}
The `ChatVertexAI` is a component for generating text using Vertex AI Chat large language models API.
**Params**
- **Credentials:** The JSON file containing the credentials for accessing the Vertex AI Chat API.
- **Project:** The name of the project associated with the Vertex AI Chat API.
- **Examples (Optional):** List of examples to provide context for text generation.
- **Location:** The location of the Vertex AI Chat API service. Defaults to `us-central1`.
- **Max Output Tokens:** The maximum number of tokens to generate. Defaults to `128`.
- **Model Name:** The name of the model to use. Defaults to `chat-bison`.
- **Temperature:** Controls the creativity of model responses. Defaults to `0.0`.
- **Input Value:** The input text for text generation.
- **Top K:** Limits token selection to top K. Defaults to `40`.
- **Top P:** Works together with top-k. Defaults to `0.95`.
- **Verbose:** Whether to print out response text. Defaults to `False`.
- **Stream (Optional):** Specifies whether to stream the response from the model. Defaults to `False`.
- **System Message (Optional):** System message to pass to the model.

View file

@ -0,0 +1,30 @@
---
title: Prompts
sidebar_position: 2
slug: /components-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 {#c852d1761e6c46b19ce72e5f7c70958c}
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}`.
### PromptTemplate {#6e32412f062b42efbdf56857eafb3651}
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.
After defining a variable in the prompt template, it acts as its own component input.
- **template:** The template used to format an individual request.

View file

@ -0,0 +1,546 @@
---
title: Vector Stores
sidebar_position: 7
slug: /components-vector-stores
---
### Astra DB {#453bcf5664154e37a920f1b602bd39da}
The `Astra DB` initializes a vector store using Astra DB from Data. It creates Astra DB-based vector indexes to efficiently store and retrieve documents.
**Parameters:**
- **Input:** Documents or Data for input.
- **Embedding or Astra vectorize:** External or server-side model Astra DB uses.
- **Collection Name:** Name of the Astra DB collection.
- **Token:** Authentication token for Astra DB.
- **API Endpoint:** API endpoint for Astra DB.
- **Namespace:** Astra DB namespace.
- **Metric:** Metric used by Astra DB.
- **Batch Size:** Batch size for operations.
- **Bulk Insert Batch Concurrency:** Concurrency level for bulk inserts.
- **Bulk Insert Overwrite Concurrency:** Concurrency level for overwriting during bulk inserts.
- **Bulk Delete Concurrency:** Concurrency level for bulk deletions.
- **Setup Mode:** Setup mode for the vector store.
- **Pre Delete Collection:** Option to delete the collection before setup.
- **Metadata Indexing Include:** Fields to include in metadata indexing.
- **Metadata Indexing Exclude:** Fields to exclude from metadata indexing.
- **Collection Indexing Policy:** Indexing policy for the collection.
NOTE
Ensure you configure the necessary Astra DB token and API endpoint before starting.
---
### Astra DB Search {#26f25d1933a9459bad2d6725f87beb11}
`Astra DBSearch` searches an existing Astra DB vector store for documents similar to the input. It uses the `Astra DB`component's functionality for efficient retrieval.
**Parameters:**
- **Search Type:** Type of search, such as Similarity or MMR.
- **Input Value:** Value to search for.
- **Embedding or Astra vectorize:** External or server-side model Astra DB uses.
- **Collection Name:** Name of the Astra DB collection.
- **Token:** Authentication token for Astra DB.
- **API Endpoint:** API endpoint for Astra DB.
- **Namespace:** Astra DB namespace.
- **Metric:** Metric used by Astra DB.
- **Batch Size:** Batch size for operations.
- **Bulk Insert Batch Concurrency:** Concurrency level for bulk inserts.
- **Bulk Insert Overwrite Concurrency:** Concurrency level for overwriting during bulk inserts.
- **Bulk Delete Concurrency:** Concurrency level for bulk deletions.
- **Setup Mode:** Setup mode for the vector store.
- **Pre Delete Collection:** Option to delete the collection before setup.
- **Metadata Indexing Include:** Fields to include in metadata indexing.
- **Metadata Indexing Exclude:** Fields to exclude from metadata indexing.
- **Collection Indexing Policy:** Indexing policy for the collection.
---
### Chroma {#74730795605143cba53e1f4c4f2ef5d6}
`Chroma` sets up a vector store using Chroma for efficient vector storage and retrieval within language processing workflows.
**Parameters:**
- **Collection Name:** Name of the collection.
- **Persist Directory:** Directory to persist the Vector Store.
- **Server CORS Allow Origins (Optional):** CORS allow origins for the Chroma server.
- **Server Host (Optional):** Host for the Chroma server.
- **Server Port (Optional):** Port for the Chroma server.
- **Server gRPC Port (Optional):** gRPC port for the Chroma server.
- **Server SSL Enabled (Optional):** SSL configuration for the Chroma server.
- **Input:** Input data for creating the Vector Store.
- **Embedding:** Embeddings used for the Vector Store.
For detailed documentation and integration guides, please refer to the [Chroma Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/chroma).
---
### Chroma Search {#5718072a155441f3a443b944ad4d638f}
`ChromaSearch` searches a Chroma collection for documents similar to the input text. It leverages Chroma to ensure efficient document retrieval.
**Parameters:**
- **Input:** Input text for search.
- **Search Type:** Type of search, such as Similarity or MMR.
- **Collection Name:** Name of the Chroma collection.
- **Index Directory:** Directory where the Chroma index is stored.
- **Embedding:** Embedding model used for vectorization.
- **Server CORS Allow Origins (Optional):** CORS allow origins for the Chroma server.
- **Server Host (Optional):** Host for the Chroma server.
- **Server Port (Optional):** Port for the Chroma server.
- **Server gRPC Port (Optional):** gRPC port for the Chroma server.
- **Server SSL Enabled (Optional):** SSL configuration for the Chroma server.
---
### Couchbase {#6900a79347164f35af27ae27f0d64a6d}
`Couchbase` builds a Couchbase vector store from Data, streamlining the storage and retrieval of documents.
**Parameters:**
- **Embedding:** Model used by Couchbase.
- **Input:** Documents or Data.
- **Couchbase Cluster Connection String:** Cluster Connection string.
- **Couchbase Cluster Username:** Cluster Username.
- **Couchbase Cluster Password:** Cluster Password.
- **Bucket Name:** Bucket identifier in Couchbase.
- **Scope Name:** Scope identifier in Couchbase.
- **Collection Name:** Collection identifier in Couchbase.
- **Index Name:** Index identifier.
For detailed documentation and integration guides, please refer to the [Couchbase Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/couchbase).
---
### Couchbase Search {#c77bb09425a3426f9677d38d8237d9ba}
`CouchbaseSearch` leverages the Couchbase component to search for documents based on similarity metric.
**Parameters:**
- **Input:** Search query.
- **Embedding:** Model used in the Vector Store.
- **Couchbase Cluster Connection String:** Cluster Connection string.
- **Couchbase Cluster Username:** Cluster Username.
- **Couchbase Cluster Password:** Cluster Password.
- **Bucket Name:** Bucket identifier.
- **Scope Name:** Scope identifier.
- **Collection Name:** Collection identifier in Couchbase.
- **Index Name:** Index identifier.
---
### FAISS {#5b3f4e6592a847b69e07df2f674a03f0}
The `FAISS` component manages document ingestion into a FAISS Vector Store, optimizing document indexing and retrieval.
**Parameters:**
- **Embedding:** Model used for vectorizing inputs.
- **Input:** Documents to ingest.
- **Folder Path:** Save path for the FAISS index, relative to Langflow.
For more details, see the [FAISS Component Documentation](https://faiss.ai/index.html).
---
### FAISS Search {#81ff12d7205940a3b14e3ddf304630f8}
`FAISSSearch` searches a FAISS Vector Store for documents similar to a given input, using similarity metrics for efficient retrieval.
**Parameters:**
- **Embedding:** Model used in the FAISS Vector Store.
- **Folder Path:** Path to load the FAISS index from, relative to Langflow.
- **Input:** Search query.
- **Index Name:** Index identifier.
---
### MongoDB Atlas {#eba8892f7a204b97ad1c353e82948149}
`MongoDBAtlas` builds a MongoDB Atlas-based vector store from Data, streamlining the storage and retrieval of documents.
**Parameters:**
- **Embedding:** Model used by MongoDB Atlas.
- **Input:** Documents or Data.
- **Collection Name:** Collection identifier in MongoDB Atlas.
- **Database Name:** Database identifier.
- **Index Name:** Index identifier.
- **MongoDB Atlas Cluster URI:** Cluster URI.
- **Search Kwargs:** Additional search parameters.
NOTE
Ensure pymongo is installed for using MongoDB Atlas Vector Store.
---
### MongoDB Atlas Search {#686ba0e30a54438cbc7153b81ee4b1df}
`MongoDBAtlasSearch` leverages the MongoDBAtlas component to search for documents based on similarity metrics.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input:** Search query.
- **Embedding:** Model used in the Vector Store.
- **Collection Name:** Collection identifier.
- **Database Name:** Database identifier.
- **Index Name:** Index identifier.
- **MongoDB Atlas Cluster URI:** Cluster URI.
- **Search Kwargs:** Additional search parameters.
---
### PGVector {#7ceebdd84ab14f8e8589c13c58370e5b}
`PGVector` integrates a Vector Store within a PostgreSQL database, allowing efficient storage and retrieval of vectors.
**Parameters:**
- **Input:** Value for the Vector Store.
- **Embedding:** Model used.
- **PostgreSQL Server Connection String:** Server URL.
- **Table:** Table name in the PostgreSQL database.
For more details, see the [PGVector Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/pgvector).
NOTE
Ensure the PostgreSQL server is accessible and configured correctly.
---
### PGVector Search {#196bf22ea2844bdbba971b5082750943}
`PGVectorSearch` extends `PGVector` to search for documents based on similarity metrics.
**Parameters:**
- **Input:** Search query.
- **Embedding:** Model used.
- **PostgreSQL Server Connection String:** Server URL.
- **Table:** Table name.
- **Search Type:** Type of search, such as "Similarity" or "MMR".
---
### Pinecone {#67abbe3e27c34fb4bcb35926ce831727}
`Pinecone` constructs a Pinecone wrapper from Data, setting up Pinecone-based vector indexes for document storage and retrieval.
**Parameters:**
- **Input:** Documents or Data.
- **Embedding:** Model used.
- **Index Name:** Index identifier.
- **Namespace:** Namespace used.
- **Pinecone API Key:** API key.
- **Pinecone Environment:** Environment settings.
- **Search Kwargs:** Additional search parameters.
- **Pool Threads:** Number of threads.
NOTE
Ensure the Pinecone API key and environment are correctly configured.
---
### Pinecone Search {#977944558cad4cf2ba332ea4f06bf485}
`PineconeSearch` searches a Pinecone Vector Store for documents similar to the input, using advanced similarity metrics.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Embedding:** Model used.
- **Index Name:** Index identifier.
- **Namespace:** Namespace used.
- **Pinecone API Key:** API key.
- **Pinecone Environment:** Environment settings.
- **Search Kwargs:** Additional search parameters.
- **Pool Threads:** Number of threads.
---
### Qdrant {#88df77f3044e4ac6980950835a919fb0}
`Qdrant` allows efficient similarity searches and retrieval operations, using a list of texts to construct a Qdrant wrapper.
**Parameters:**
- **Input:** Documents or Data.
- **Embedding:** Model used.
- **API Key:** Qdrant API key.
- **Collection Name:** Collection identifier.
- **Advanced Settings:** Includes content payload key, distance function, gRPC port, host, HTTPS, location, metadata payload key, path, port, prefer gRPC, prefix, search kwargs, timeout, URL.
---
### Qdrant Search {#5ba5f8dca0f249d7ad00778f49901e6c}
`QdrantSearch` extends `Qdrant` to search for documents similar to the input based on advanced similarity metrics.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Embedding:** Model used.
- **API Key:** Qdrant API key.
- **Collection Name:** Collection identifier.
- **Advanced Settings:** Includes content payload key, distance function, gRPC port, host, HTTPS, location, metadata payload key, path, port, prefer gRPC, prefix, search kwargs, timeout, URL.
---
### Redis {#a0fb8a9d244a40eb8439d0f8c22a2562}
`Redis` manages a Vector Store in a Redis database, supporting efficient vector storage and retrieval.
**Parameters:**
- **Index Name:** Default index name.
- **Input:** Data for building the Redis Vector Store.
- **Embedding:** Model used.
- **Schema:** Optional schema file (.yaml) for document structure.
- **Redis Server Connection String:** Server URL.
- **Redis Index:** Optional index name.
For detailed documentation, refer to the [Redis Documentation](https://python.langchain.com/docs/integrations/vectorstores/redis).
NOTE
Ensure the Redis server URL and index name are configured correctly. Provide a schema if no documents are available.
---
### Redis Search {#80aea4da515f490e979c8576099ee880}
`RedisSearch` searches a Redis Vector Store for documents similar to the input.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Index Name:** Default index name.
- **Embedding:** Model used.
- **Schema:** Optional schema file (.yaml) for document structure.
- **Redis Server Connection String:** Server URL.
- **Redis Index:** Optional index name.
---
### Supabase {#e86fb3cc507e4b5494f0a421f94e853b}
`Supabase` initializes a Supabase Vector Store from texts and embeddings, setting up an environment for efficient document retrieval.
**Parameters:**
- **Input:** Documents or data.
- **Embedding:** Model used.
- **Query Name:** Optional query name.
- **Search Kwargs:** Advanced search parameters.
- **Supabase Service Key:** Service key.
- **Supabase URL:** Instance URL.
- **Table Name:** Optional table name.
NOTE
Ensure the Supabase service key, URL, and table name are properly configured.
---
### Supabase Search {#fd02d550b9b2457f91f2f4073656cb09}
`SupabaseSearch` searches a Supabase Vector Store for documents similar to the input.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Embedding:** Model used.
- **Query Name:** Optional query name.
- **Search Kwargs:** Advanced search parameters.
- **Supabase Service Key:** Service key.
- **Supabase URL:** Instance URL.
- **Table Name:** Optional table name.
---
### Vectara {#b4e05230b62a47c792a89c5511af97ac}
`Vectara` sets up a Vectara Vector Store from files or upserted data, optimizing document retrieval.
**Parameters:**
- **Vectara Customer ID:** Customer ID.
- **Vectara Corpus ID:** Corpus ID.
- **Vectara API Key:** API key.
- **Files Url:** Optional URLs for file initialization.
- **Input:** Optional data for corpus upsert.
For more information, consult the [Vectara Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/vectara).
NOTE
If inputs or files_url are provided, they will be processed accordingly.
---
### Vectara Search {#31a47221c23f4fbba4a7465cf1d89eb0}
`VectaraSearch` searches a Vectara Vector Store for documents based on the provided input.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Vectara Customer ID:** Customer ID.
- **Vectara Corpus ID:** Corpus ID.
- **Vectara API Key:** API key.
- **Files Url:** Optional URLs for file initialization.
---
### Weaviate {#57c7969574b1418dbb079ac5fc8cd857}
`Weaviate` facilitates a Weaviate Vector Store setup, optimizing text and document indexing and retrieval.
**Parameters:**
- **Weaviate URL:** Default instance URL.
- **Search By Text:** Indicates whether to search by text.
- **API Key:** Optional API key for authentication.
- **Index Name:** Optional index name.
- **Text Key:** Default text extraction key.
- **Input:** Document or record.
- **Embedding:** Model used.
- **Attributes:** Optional additional attributes.
For more details, see the [Weaviate Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/weaviate).
NOTE
Ensure Weaviate instance is running and accessible. Verify API key, index name, text key, and attributes are set correctly.
---
### Weaviate Search {#6d4e616dfd6143b28dc055bc1c40ecae}
`WeaviateSearch` searches a Weaviate Vector Store for documents similar to the input.
**Parameters:**
- **Search Type:** Type of search, such as "Similarity" or "MMR".
- **Input Value:** Search query.
- **Weaviate URL:** Default instance URL.
- **Search By Text:** Indicates whether to search by text.
- **API Key:** Optional API key for authentication.
- **Index Name:** Optional index name.
- **Text Key:** Default text extraction key.
- **Embedding:** Model used.
- **Attributes:** Optional additional attributes.

View file

@ -0,0 +1,87 @@
---
title: Intro to Components
sidebar_position: 0
slug: /components
---
## Component {#0323a728d8314767adb907b998036bb4}
A component is a single building block within a flow. It consists of inputs, outputs, and parameters that define their functionality. These elements provide a convenient and straightforward way to compose LLM-based applications. Learn more about components and how they work below.
During the flow creation process, you will notice handles (colored circles) attached to one or both sides of a component. These handles use distinct colors to indicate the types of inputs and outputs that can be interconnected. Hover over a handle to see connection details.
![](./565424296.png)
On the top right corner of the component, you'll find the a play button to run a component. Once it runs, a status icon appears and you can hover over that to visualize success or error messages. Start interacting with your AI by clicking the **Playground** at the bottom right of the workspace.
### Component Menu {#7e3f2f8ff5074b2fb3eee97c9cfaabe7}
Each component is unique, but they all have a menu bar at the top that looks something like this.
![](./938852908.png)
It consists of options such as:
- **Code** — displays the component's Python code. You can modify the code and save it.
- **Advanced** — See and adjust all parameters of a component.
- **Freeze** — After a component runs, lock its previous output state to prevent it from re-running.
Click **All** (the "..." button) to see all options.
### Output Preview {#ed7b3c34e0774b8a916b0e68821c9a7a}
Langflow includes an output visualizer for components that opens a pop-up screen. This allows you to easily inspect and monitor transmissions between components, providing instant feedback on your workflows.
![](./987204819.png)
### Advanced Settings {#b6430d4903df44f0ba4618a558c83d7b}
Langflow components can be edited by clicking the **Advanced Settings** button.
Hide parameters with the **Show** button to reduce complexity and keep the workspace clean and intuitive for experimentation.
You can also double-click a component's name and description to modify those. Component descriptions accept markdown syntax.
### Group Components {#c3f5ed818e3b40ceb6534dc358e1a5f2}
Multiple components can be grouped into a single component for reuse. This is useful when combining large flows into single components (like RAG with a vector database, for example) and saving space.
1. Hold **Shift** and drag to select components.
2. Select **Group**.
3. The components merge into a single component.
4. Double-click the name and description to change them.
5. Save your grouped component to in the sidebar for later use!
[group video here]
### Component Version {#887fd587589448dc8c27336d1c235b9b}
A component's state is stored in a database, while sidebar components are like starter templates. As soon as you drag a component from the sidebar to the workspace, the two components are no longer in parity.
The component will keep the version number it was initialized to the workspace with. Click the **Update Component** icon (exclamation mark) to bring the component up to the `latest` version. This will change the code of the component in place so you can validate that the component was updated by checking its Python code before and after updating it.
![](./263391508.png)