LLM
The llm processor sends each row of a text column to an OpenAI-compatible chat completions API and appends the completion as a Utf8 column. Use it for in-stream summarization, translation, rewriting, classification, or structured extraction. Any endpoint that speaks the OpenAI /chat/completions protocol works: OpenAI, Azure OpenAI (via headers), vLLM, or Ollama gateways.
It pairs naturally with SQL (prepare the prompt column first) and the embedding processor (embed what the model produced).
Configuration
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | yes | — | llm |
| api_base | string | yes | — | API base URL; the request path is {api_base}/chat/completions. |
| model | string | yes | — | Chat model name (e.g. gpt-4o-mini). |
| field | string | conditional | — | Input UTF-8 column to send. Rows must be non-null. Required unless prompt_template references at least one column via {{column_name}}. |
| target_field | string | no | response | Name of the appended completion column. |
| system_prompt | string | no | — | System message prepended to each request. |
| prompt_template | string | no | — | User-message template supporting {{value}} (resolved to field) and {{column_name}} placeholders for any column in the batch. Non-string columns are formatted as text; NULLs render as empty string. When omitted the row text is the user message. |
| temperature | number | no | — | Sampling temperature; omitted from the request when unset. |
| max_tokens | integer | no | — | Completion token cap; omitted from the request when unset. |
| concurrency | integer | no | 4 | Maximum in-flight requests; results are always filled back in row order. |
| api_key | string | no | — | Sent as Authorization: Bearer. Supports secret references. |
| timeout_ms | integer | no | 30000 | HTTP request timeout. |
| retry_count | integer | no | 3 | Retries for transient failures (429/5xx/transport). 0 disables retrying. |
| headers | map | no | — | Extra HTTP headers (e.g. Azure's api-key). |
| stream | boolean | no | false | Request SSE streaming and assemble the deltas into the row's final completion text. Useful behind providers or gateways that time out non-streaming long completions. The processor still emits one complete text per row. |
| tools | array | no | — | OpenAI tools definition passed through verbatim for function calling. |
| tool_calls_column | string | no | — | When set, appends this column with the response's tool calls as JSON text (empty string when there are none). Streamed tool-call deltas are merged by index. |
| response_format | object | no | — | OpenAI response_format specification passed through verbatim for structured output. |
Each row is one request (the chat protocol has no batch form). Without an
on_error policy (or with fail), the first deterministic row failure (4xx,
parse errors — or retries exhausted) short-circuits the batch — in-flight
requests are dropped rather than awaited — and the batch flows to
error_output as a whole. Under on_error: dlq/drop/error_column
the processor implements the row-error protocol: every row is attempted and
failing rows are marked with their reason (__arkflow_row_error) instead of
failing the batch — the kernel routes or annotates them per the policy.
Configuration-level failures (the field column missing or not UTF-8) fail
the batch under every policy. Transient failures retry per retry_count
(default 3; retry_count: 0 disables retrying); size concurrency and
upstream batches to stay within rate limits. Requests to loopback endpoints
always bypass the system proxy.
Transient HTTP failures (429, 5xx, connection errors) are retried with
capped exponential backoff (retry_count, default 3); 4xx rejections and
parse/validation failures fail immediately without retrying.
Example
- type: "llm"
api_base: "https://api.openai.com/v1"
model: "gpt-4o-mini"
api_key: "${env:OPENAI_API_KEY:-}"
field: "text"
system_prompt: "Translate the text to French. Reply with the translation only."
prompt_template: "{{value}}"
concurrency: 4
Complete Pipeline Example
logging:
level: info
streams:
- id: support-tagger
input:
type: memory
pipeline:
thread_num: 4
processors:
- type: json_to_arrow
- type: llm
api_base: "https://api.openai.com/v1"
model: "gpt-4o-mini"
api_key: "${env:OPENAI_API_KEY:-}"
field: "text"
system_prompt: "Classify the support ticket with a single word: billing, bug, or feature."
target_field: "category"
temperature: 0
output:
type: stdout