Comment on page
Agents
LangStream Version: 0.5.0
Sends the messages to the AI Service to compute chat completions. The result is stored in the specified field.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
ai-service | In case of multiple AI services configured, specify the id of the AI service to use. | string | | |
completion-field | Field to use to store the completion results in the output topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field. | string | | |
composable | Whether this step can be composed with other steps. | boolean | | true |
frequency-penalty | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
log-field | Field to use to store the log of the completion results in the output topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field.
The log contains useful information for debugging the completion prompts. | string | | |
logit-bias | Parameter for the completion request. The parameters are passed to the AI Service as is. | object | | |
max-tokens | Parameter for the completion request. The parameters are passed to the AI Service as is. | integer | | |
messages | Messages to use for chat completions. You can use the Mustache syntax. | ✓ | | |
min-chunks-per-message | Minimum number of chunks to send to the stream-to-topic topic. The chunks are sent as soon as they are available.
The chunks are sent in the order they are received from the AI Service.
To improve the TTFB (Time-To-First-Byte), the chunk size starts from 1 and doubles until it reaches the max-chunks-per-message value. | integer | | 20 |
model | The model to use for chat completions. The model must be available in the AI Service. | string | ✓ | |
options | Additional options for the model configuration. The structure depends on the model and AI provider. | object | | |
presence-penalty | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
stop | Parameter for the completion request. The parameters are passed to the AI Service as is. | array of string | | |
stream | Enable streaming of the results. Use in conjunction with the stream-to-topic parameter. | boolean | | true |
stream-response-completion-field | Field to use to store the completion results in the stream-to-topic topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field. | string | | |
stream-to-topic | Enable streaming of the results. If enabled, the results are streamed to the specified topic in small chunks. The entire messages will be sent to the output topic instead. | string | | |
temperature | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
top-p | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
user | Parameter for the completion request. The parameters are passed to the AI Service as is. | string | | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
role | Role of the message. The role is used to identify the speaker in the chat. | string | ✓ | |
content | Content of the message. You can use the Mustache syntax. | string | ✓ | |
Sends the text to the AI Service to compute text completions. The result is stored in the specified field.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
ai-service | In case of multiple AI services configured, specify the id of the AI service to use. | string | | |
completion-field | Field to use to store the completion results in the output topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field. | string | | |
composable | Whether this step can be composed with other steps. | boolean | | true |
frequency-penalty | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
log-field | Field to use to store the log of the completion results in the output topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field.
The log contains useful information for debugging the completion prompts. | string | | |
logit-bias | Parameter for the completion request. The parameters are passed to the AI Service as is. | object | | |
logprobs | Logprobs parameter (only valid for OpenAI). | string | | |
logprobs-field | Log probabilities to a field. | string | | |
max-tokens | Parameter for the completion request. The parameters are passed to the AI Service as is. | integer | | |
min-chunks-per-message | Minimum number of chunks to send to the stream-to-topic topic. The chunks are sent as soon as they are available.
The chunks are sent in the order they are received from the AI Service.
To improve the TTFB (Time-To-First-Byte), the chunk size starts from 1 and doubles until it reaches the max-chunks-per-message value. | integer | | 20 |
model | The model to use for text completions. The model must be available in the AI Service. | string | ✓ | |
options | Additional options for the model configuration. The structure depends on the model and AI provider. | object | | |
presence-penalty | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
prompt | Prompt to use for text completions. You can use the Mustache syntax. | array of string | ✓ | |
stop | Parameter for the completion request. The parameters are passed to the AI Service as is. | array of string | | |
stream | Enable streaming of the results. Use in conjunction with the stream-to-topic parameter. | boolean | | true |
stream-response-completion-field | Field to use to store the completion results in the stream-to-topic topic. Use "value" to write the result without a structured schema. Use "value.<field>" to write the result in a specific field. | string | | |
stream-to-topic | Enable streaming of the results. If enabled, the results are streamed to the specified topic in small chunks. The entire messages will be sent to the output topic instead. | string | | |
temperature | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
top-p | Parameter for the completion request. The parameters are passed to the AI Service as is. | number | | |
user | Parameter for the completion request. The parameters are passed to the AI Service as is. | string | | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Reads data from Azure blobs. There are three supported ways to authenticate:
- SAS token
- Storage account name and key
- Storage account connection string
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
container | The name of the Azure econtainer to read from. | string | | langstream-azure-source |
endpoint | Endpoint to connect to. Usually it's https://<storage-account>.blob.core.windows.net. | string | ✓ | |
file-extensions | Comma separated list of file extensions to filter by. | string | | pdf,docx,html,htm,md,txt |
idle-time | Time in seconds to sleep after polling for new files. | integer | | 5 |
sas-token | Azure SAS token. If not provided, storage account name and key must be provided. | string | | |
storage-account-connection-string | Azure storage account connection string. If not provided, SAS token must be provided. | string | | |
storage-account-key | Azure storage account key. If not provided, SAS token must be provided. | string | | |
storage-account-name | Azure storage account name. If not provided, SAS token must be provided. | string | | |
Use Apache Camel components as Source
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
component-options | Additional parmaters to pass to the Camel component in the query string format.
The values are automatically encoded | object | | |
component-uri | The Camel URI of the component to use as Source. | string | ✓ | |
key-header | Header to use as key of the record | string | | |
max-buffered-records | Maximum number of records to buffer | integer | | 100 |
Transforms the data to a target compatible schema.
Some step operations like cast or compute involve conversions from a type to another. When this happens the rules are:
- timestamp, date and time related object conversions assume UTC time zone if it is not explicit.
- date and time related object conversions to/from STRING use the RFC3339 format.
- timestamp related object conversions to/from LONG and DOUBLE are done using the number of milliseconds since EPOCH (1970-01-01T00:00:00Z).
- date related object conversions to/from INTEGER, LONG, FLOAT and DOUBLE are done using the number of days since EPOCH (1970-01-01).
- time related object conversions to/from INTEGER, LONG and DOUBLE are done using the number of milliseconds since midnight (00:00:00).
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
composable | Whether this step can be composed with other steps. | boolean | | true |
part | When used with KeyValue data, defines if the transformation is done on the key or on the value. If empty, the transformation applies to both the key and the value. | string | | |
schema-type | The target schema type. | string | ✓ | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Computes new properties, values or field values based on an expression evaluated at runtime. If the field already exists, it will be overwritten.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
composable | Whether this step can be composed with other steps. | boolean | | true |
fields | An array of objects describing how to calculate the field values | ✓ | | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
expression | It is evaluated at runtime and the result of the evaluation is assigned to the field.
Refer to the language expression documentation for more information on the expression syntax. | string | ✓ | |
name | The name of the field to be computed. Prefix with key. or value. to compute the fields in the key or value parts of the message.
In addition, you can compute values on the following message headers [destinationTopic, messageKey, properties.].
Please note that properties is a map of key/value pairs that are referenced by the dot notation, for example properties.key0. | string | ✓ | |
optional | If true, it marks the field as optional in the schema of the transformed message. This is useful when null is a possible value of the compute expression. | boolean | | false |
type | The type of the computed field. This
will translate to the schema type of the new field in the transformed message.
The following types are currently supported :STRING, INT8, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN, DATE, TIME, TIMESTAMP, LOCAL_DATE_TIME, LOCAL_TIME, LOCAL_DATE, INSTANT.
The type field is not required for the message headers [destinationTopic, messageKey, properties.] and STRING will be used.
For the value and key, if it is not provided, then the type will be inferred from the result of the expression evaluation. | string | ✓ | |
Compute embeddings of the record. The embeddings are stored in the record under a specific field.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
ai-service | In case of multiple AI services configured, specify the id of the AI service to use. | string | | |
arguments | Additional arguments to pass to the AI Service. (HuggingFace only) | object | | |
batch-size | Batch size for submitting the embeddings requests. | integer | | 10 |
composable | Whether this step can be composed with other steps. | boolean | | true |
concurrency | Max number of concurrent requests to the AI Service. | integer | | 4 |
embeddings-field | Field where to store the embeddings. | string | ✓ | |
flush-interval | Flushing is disabled by default in order to avoid latency spikes.
You should enable this feature in the case of background processing. | integer | | 0 |
loop-over | Execute the agent over a list of documents | string | | |
model | Model to use for the embeddings. The model must be available in the configured AI Service. | string | | text-embedding-ada-002 |
model-url | URL of the model to use. (HuggingFace only). The default is computed from the model: "djl://ai.djl.huggingface.pytorch/{model}" | string | | |
options | Additional options to pass to the AI Service. (HuggingFace only) | object | | |
text | Text to create embeddings from. You can use Mustache syntax to compose multiple fields into a single text. Example:
text: "{{{ value.field1 }}} {{{ value.field2 }}}" | string | ✓ | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Dispatches messages to different destinations based on conditions.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
routes | Routes. | | |
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
destination | Destination of the message. | string | | |
action | Action on the message. Possible values are "dispatch" or "drop". | string | | dispatch |
when | Condition to activate the route. This is a standard EL expression. | string | | |
Convert raw text document to JSON. The result will be a JSON object with the text content in the specified field.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
copy-properties | Whether to copy the message properties/headers in the output message. | boolean | | true |
text-field | Field name to write the text content to. | string | | text |
Drops the record from further processing. Use in conjunction with when to selectively drop records.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
composable | Whether this step can be composed with other steps. | boolean | | true |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Drops the record fields.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
composable | Whether this step can be composed with other steps. | boolean | | true |
fields | Fields to drop from the input record. | array of string | ✓ | |
part | Part to drop. (value or key) | string | | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Apply to the Flare pattern to enhance the quality of text completion results.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
logprobs-field | The field that contains the logprobs of tokens returned by the ai-text-completion agent. | string | ✓ | |
loop-topic | Name of the topic to forward the message in case of requesting more documents. | string | ✓ | |
retrieve-documents-field | Name of the field to set in order to request the retrival of more documents. | string | ✓ | |
tokens-field | The field that contains the list of tokens returned by the ai-text-completion agent. | string | ✓ | |
Converts structured nested data into a new single-hierarchy-level structured data. The names of the new fields are built by concatenating the intermediate level field names.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
composable | Whether this step can be composed with other steps. | boolean | | true |
delimiter | The delimiter to use when concatenating the field names. | string | | _ |
part | When used with KeyValue data, defines if the transformation is done on the key or on the value. If empty, the transformation applies to both the key and the value. | string | | |
when | Execute the step only when the condition is met.
You can use the expression language to reference the message.
Example: when: "value.first == 'f1' && value.last.toUpperCase() == 'L1'" | string | | |
Agent for enriching data with an HTTP request.
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
allow-redirects | Whether or not to follow redirects. | boolean | | true |
body | Body to send with the request. You can use the Mustache syntax to inject value from the context. | string | | |
handle-cookies | Whether or not to handle cookies during the redirects. | boolean | | true |
headers | Headers to send with the request. You can use the Mustache syntax to inject value from the context. | object | | |
method | Http method to use for the request. | string | | GET |
output-field | The field that will hold the results, it can be the same as "field" to override it. | string | ✓ | |
query-string | Query string to append to the url. You can use the Mustache syntax to inject value from the context.
Note that the values will be automatically escaped. | object | | |
url | Url to send the request to. For adding query string parameters, use the `query-string` field. | string | ✓ | |
Simple agent to move data from the input to the output. Could be used for testing or sample applications.
Agent for invoking LangServe based applications
Text | Description | Type | Required | Default Value |
---|---|---|---|---|
allow-redirects | Whet |