cohere.command
Conduit processor for Cohere's command model.
Description
Conduit processor for Cohere's command model.
Configuration parameters
- YAML
- Table
version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "cohere.command"
settings:
# APIKey is the API key for Cohere api calls.
# Type: string
apiKey: ""
# Maximum number of retries for an individual record when backing off
# following an error.
# Type: float
backoffRetry.count: "0"
# The multiplying factor for each increment step.
# Type: float
backoffRetry.factor: "2"
# The maximum waiting time before retrying.
# Type: duration
backoffRetry.max: "5s"
# The minimum waiting time before retrying.
# Type: duration
backoffRetry.min: "100ms"
# Model is one of the name of a compatible command model version.
# Type: string
model: "command"
# Prompt is the preset prompt.
# Type: string
prompt: ""
# RequestBodyRef specifies the api request field.
# Type: string
request.body: ".Payload.After"
# ResponseBodyRef specifies in which field should the response body be
# saved.
# Type: string
response.body: ".Payload.After"
# Whether to decode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.decode.key.enabled: "true"
# Whether to decode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.decode.payload.enabled: "true"
# Whether to encode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.encode.key.enabled: "true"
# Whether to encode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.encode.payload.enabled: "true"
Name | Type | Default | Description |
---|---|---|---|
apiKey | string | null | APIKey is the API key for Cohere api calls. |
backoffRetry.count | float | 0 | Maximum number of retries for an individual record when backing off following an error. |
backoffRetry.factor | float | 2 | The multiplying factor for each increment step. |
backoffRetry.max | duration | 5s | The maximum waiting time before retrying. |
backoffRetry.min | duration | 100ms | The minimum waiting time before retrying. |
model | string | command | Model is one of the name of a compatible command model version. |
prompt | string | null | Prompt is the preset prompt. |
request.body | string | .Payload.After | RequestBodyRef specifies the api request field. |
response.body | string | .Payload.After | ResponseBodyRef specifies in which field should the response body be saved. |
sdk.schema.decode.key.enabled | bool | true | Whether to decode the record key using its corresponding schema from the schema registry. |
sdk.schema.decode.payload.enabled | bool | true | Whether to decode the record payload using its corresponding schema from the schema registry. |
sdk.schema.encode.key.enabled | bool | true | Whether to encode the record key using its corresponding schema from the schema registry. |
sdk.schema.encode.payload.enabled | bool | true | Whether to encode the record payload using its corresponding schema from the schema registry. |
Examples
Generate responses using Cohere's command model
This example demonstrates how to use the Cohere command processor to generate responses for a record's .Payload.After
field.
The processor sends the input text to the Cohere API and replaces it with the model's response.
Configuration parameters
- YAML
- Table
version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "cohere.command"
settings:
apiKey: "apikey"
backoffRetry.count: "0"
backoffRetry.factor: "2"
backoffRetry.max: "5s"
backoffRetry.min: "100ms"
model: "command"
prompt: "hello"
request.body: ".Payload.After"
response.body: ".Payload.After"
Name | Value |
---|---|
apiKey | apikey |
backoffRetry.count | 0 |
backoffRetry.factor | 2 |
backoffRetry.max | 5s |
backoffRetry.min | 100ms |
model | command |
prompt | hello |
request.body | .Payload.After |
response.body | .Payload.After |
Record difference
Before | After | ||||
1 | { | 1 | { | ||
2 | "position": "cG9zLTE=", | 2 | "position": "cG9zLTE=", | ||
3 | "operation": "update", | 3 | "operation": "update", | ||
4 | "metadata": null, | 4 | "metadata": null, | ||
5 | "key": null, | 5 | "key": null, | ||
6 | "payload": { | 6 | "payload": { | ||
7 | "before": null, | 7 | "before": null, | ||
8 | - | "after": "who are you?" | 8 | + | "after": "cohere command response content" |
9 | } | 9 | } | ||
10 | } | 10 | } |