step
pendra_completion
Generate text using Pendra.ai's UK-sovereign LLM inference API.
Overview
Pendra.ai provides OpenAI-compatible chat completions with data processing exclusively
in UK data centres, targeting regulated industries (financial services, healthcare,
public sector) that require data residency compliance. The wire format matches OpenAI
so you can port existing prompts directly. Use this step for text generation, structured
data extraction, analysis, and any chat-style workflow where UK data residency matters.
Setup:
1. Create a Pendra.ai account and obtain an API key from the console.
API keys have the form `pdr_sk_...`.
2. Store your API key securely (e.g., as an environment variable: PENDRA_API_KEY).
3. Pick a model from https://api.pendra.ai/api/v1/models.
API Key: Required. Get your API key from the Pendra.ai console.
in UK data centres, targeting regulated industries (financial services, healthcare,
public sector) that require data residency compliance. The wire format matches OpenAI
so you can port existing prompts directly. Use this step for text generation, structured
data extraction, analysis, and any chat-style workflow where UK data residency matters.
Setup:
1. Create a Pendra.ai account and obtain an API key from the console.
API keys have the form `pdr_sk_...`.
2. Store your API key securely (e.g., as an environment variable: PENDRA_API_KEY).
3. Pick a model from https://api.pendra.ai/api/v1/models.
API Key: Required. Get your API key from the Pendra.ai console.
Examples
Basic Pendra chat completion
Simple text generation using a Pendra chat model
type: pendra_completion
api_key: ${env:PENDRA_API_KEY}
model: pendra-chat
input_from: user_prompt
output_to: pendra_response
max_tokens: 500
Regulated assistant with system prompt
Specialized assistant for a regulated-industry use case with UK data residency
type: pendra_completion
api_key: ${env:PENDRA_API_KEY}
model: pendra-chat-large
system: You are a compliance-aware assistant for a UK financial services firm. Never repeat PII in the response.
input_from: customer_query
output_to: assistant_reply
temperature: 0.2
max_tokens: 800
Structured JSON extraction
Force the model to output valid JSON for downstream parsing
type: pendra_completion
api_key: ${env:PENDRA_API_KEY}
model: pendra-chat
system: Extract the person's name, email, and phone number from the text. Return as JSON with keys: name, email, phone.
input_from: message_text
output_to: contact_info
response_format:
type: json_object
temperature: 0.0
Lead scoring with template prompt
Use prompt template with variable interpolation and strict JSON schema output
type: pendra_completion
api_key: ${env:PENDRA_API_KEY}
model: pendra-chat-large
system: "You are a lead scoring assistant. Score leads from 1-10 and return only valid JSON."
prompt: |
Score this lead from 1-10 based on:
- Company size: ${company.employees}
- Industry: ${company.industry}
- Budget: ${company.budget}
response_format:
type: json_schema
json_schema:
name: lead_score
strict: true
schema:
type: object
properties:
score:
type: number
minimum: 1
maximum: 10
reasoning:
type: string
required: [score, reasoning]
additionalProperties: false
output_to: lead_analysis
temperature: 0.0
Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | Yes | Pendra.ai API key sent as a Bearer token. Keys have the form `pdr_sk_...` and are issued from the Pendra console. |
model | string | Yes | Chat model identifier. See https://api.pendra.ai/api/v1/models for the current catalogue. |
input_from | string | No | Dot path selecting the user message content. Non-string values (dicts, lists, etc.) are automatically JSON-serialized. When omitted, the entire event is serialized to JSON. |
input_key | string | No | Deprecated. Use `input_from` instead. |
prompt | string | No | Template string for the user message with ${path.to.key} interpolation. When provided, this takes precedence over 'input_from'. |
system | string | No | Static system prompt text used when 'system_key' does not resolve. |
system_key | string | No | Dot path in the event whose value overrides the static 'system' prompt when present. |
output_to | string | No | Event key where the primary model response (first choice content) is stored.
Default: "pendra" |
output_key | string | No | Deprecated. Use `output_to` instead. |
include_usage | boolean | No | When True, token usage statistics are saved under '<output_key>_usage'.
Default: true |
temperature | string | No | Sampling temperature (0.0-2.0 range supported by the API). Lower values produce more deterministic output. |
max_tokens | string | No | Maximum number of tokens the model may generate in the response. |
base_url | string | No | Base API URL for the Pendra.ai endpoint. Override when routing through a proxy or a self-hosted gateway.
Default: "https://api.pendra.ai/api/v1" |
raw_on_error | boolean | No | If True, store raw response body on JSON parse failure under '<output_key>_raw'.
Default: false |
swallow_on_error | boolean | No | If True, leave event unchanged on errors (no injection).
Default: false |
extra_headers | string | No | Dict of additional headers merged (does not remove Authorization unless overwritten). |
response_format | string | No | Response format configuration. Use {'type': 'json_object'} for basic JSON mode, or {'type': 'json_schema', 'json_schema': {...}} for structured output with schema validation. |
Base Configuration
These configuration options are available on all steps:
| Parameter | Type | Default | Description |
|---|---|---|---|
name | | null | Optional name for this step (for documentation and debugging) |
description | | null | Optional description of what this step does |
retries | integer | 0 | Number of retry attempts (0-10) |
backoff_seconds | number | 0 | Backoff (seconds) applied between retry attempts |
retry_propagate | boolean | false | If True, raise last exception after exhausting retries; otherwise swallow. |