Skip to content

Run a conversation turn

POST
/v1/yac/completions
curl --request POST \
--url https://example.com/v1/yac/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "messages": [ {} ], "dataSchema": "example", "dataDomains": "example", "model": "example", "filters": [], "issueReporting": false }'

Run one conversation turn.

The agent routes the latest message to tools (a chart, a filter change, an answer, a clarifying question or a refusal) and returns one tool call per outcome. Token use comes back in the X-Usage-* headers.

X-OpenAI-Key
Any of:
string

The caller’s own OpenAI key. Bypasses the server’s quota, and lets model take effect.

X-Conversation-Id
Any of:
string

Groups the turns of one conversation into a LangFuse session.

Media typeapplication/json
YACCompletionRequest
object
messages
required
Messages

The conversation in OpenAI chat format, including the tool calls of earlier turns as the client applied them.

Array<object>
object
key
additional properties
any
dataSchema
required
Dataschema

The data package descriptor (Frictionless datapackage.json), as a JSON string.

string
dataDomains
required
Datadomains

Each column’s values or range, as a JSON string. The client may shorten high-cardinality columns.

string
model
Any of:
string
filters
Filters

The active filters as the client holds them: chat, host and chart brush, with the user’s edits (see udiagent.filters).

Array<object>
default:
object
key
additional properties
any
issueReporting
Issuereporting

The client can send issue reports, so the agent may offer one. Honored only when the server records them (LangFuse configured).

boolean

The turn’s outcomes, in the order to apply them. A quota refusal is a Rebuff here too, not an error status.

Media typeapplication/json
Response 200 Yac Completions
Array<object>
ToolCall

One outcome of a turn. A turn returns them in the order to apply them.

object
name
required
Name

RenderVisualization, FilterData, FreeTextExplain, ClarifyVariable, Rebuff or OfferIssueReport.

string
arguments
required
Arguments

The payload; its shape depends on name.

object
key
additional properties
any
meta
Any of:
object
key
additional properties
any
key
additional properties
any

Example generated

[
{
"name": "example",
"arguments": {},
"meta": {}
}
]
X-Usage-Prompt-Tokens
string

Prompt tokens across every LLM call in the turn.

X-Usage-Completion-Tokens
string

Completion tokens, reasoning included.

X-Usage-Total-Tokens
string

Prompt plus completion tokens.

X-Usage-Cached-Prompt-Tokens
string

Prompt tokens served from the provider’s cache.

X-Usage-Cache-Write-Tokens
string

Prompt tokens written to the provider’s cache.

X-Usage-Reasoning-Tokens
string

Reasoning tokens, a subset of completion tokens.

X-Usage-Model
string

The model the turn ran on.

Missing, invalid or expired token (detail). Or no_openai_key: the server has none and the request sent no X-OpenAI-Key. Or openai_key_rejected: OpenAI rejected the key.

Media typeapplication/json
ErrorResponse

An error body. Authentication failures carry FastAPI’s detail instead of error.

object
error
Any of:
string
code
Any of:
string
errors
Any of:
Array<string>
detail
Any of:
string

Example generated

{
"error": "example",
"code": "example",
"errors": [
"example"
],
"detail": [
{}
]
}

openai_key_refused: the server routes inference through Amazon Bedrock and refuses per-request X-OpenAI-Key headers.

Media typeapplication/json
ErrorResponse

An error body. Authentication failures carry FastAPI’s detail instead of error.

object
error
Any of:
string
code
Any of:
string
errors
Any of:
Array<string>
detail
Any of:
string

Example generated

{
"error": "example",
"code": "example",
"errors": [
"example"
],
"detail": [
{}
]
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}

llm_call_failed: the LLM API call failed (a model the key cannot use, a rate limit, a timeout).

Media typeapplication/json
ErrorResponse

An error body. Authentication failures carry FastAPI’s detail instead of error.

object
error
Any of:
string
code
Any of:
string
errors
Any of:
Array<string>
detail
Any of:
string

Example generated

{
"error": "example",
"code": "example",
"errors": [
"example"
],
"detail": [
{}
]
}

llm_backend_misconfigured: the server’s LLM backend is misconfigured. Or: The identity provider’s keys could not be fetched (JWT_JWKS_URL).

Media typeapplication/json
ErrorResponse

An error body. Authentication failures carry FastAPI’s detail instead of error.

object
error
Any of:
string
code
Any of:
string
errors
Any of:
Array<string>
detail
Any of:
string

Example generated

{
"error": "example",
"code": "example",
"errors": [
"example"
],
"detail": [
{}
]
}