langflow/docs/docs/components/helpers.mdx
2024-06-24 04:37:06 -07:00

132 lines
3.2 KiB
Text

import Admonition from "@theme/Admonition";
# Helpers
<Admonition type="warning" title="warning">
This page may contain outdated information. It will be updated as soon as possible.
</Admonition>
### Chat memory
This component retrieves stored chat messages based on a specific session ID.
#### Parameters
- **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
This component concatenates two text sources into a single text chunk using a specified delimiter.
#### Parameters
- **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
This component dynamically creates a record with a specified number of fields.
#### Parameters
- **Number of fields:** Number of fields to be added to the record.
- **Text key:** Key used as text.
---
### Custom component
Use this component as a template to create your custom component.
#### Parameters
- **Parameter:** Describe the purpose of this parameter.
<Admonition type="info" title="Info">
<p>
Customize the <code>build_config</code> and <code>build</code> methods
according to your requirements.
</p>
</Admonition>
Learn more about creating custom components at [Custom Component](http://docs.langflow.org/components/custom).
---
### Documents to Data
Convert LangChain documents into Data.
#### Parameters
- **Documents:** Documents to be converted into Data.
---
### ID generator
Generates a unique ID.
#### Parameters
- **Value:** Unique ID generated.
---
### Message history
Retrieves stored chat messages based on a specific session ID.
#### Parameters
- **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
Convert Data into plain text following a specified template.
#### Parameters
- **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
Split text into chunks of a specified length.
#### Parameters
- **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
Update a record with text-based key/value pairs, similar to updating a Python dictionary.
#### Parameters
- **Data:** The record to update.
- **New data:** The new data to update the record with.