Sycophant.Pipeline (sycophant v0.4.2)

Copy Markdown

Orchestrates the full LLM request lifecycle.

The pipeline executes these steps in order:

  1. Model Resolution - Resolves the model spec to provider metadata via LLMDB
  2. Parameter Validation - Validates LLM parameters through Zoi schemas
  3. Credential Resolution - Finds credentials (per-request > app config > env vars)
  4. Wire Encoding - Converts the request into provider-specific JSON
  5. HTTP Transport - Sends the request via Tesla (sync or streaming)
  6. Wire Decoding - Parses the provider response back into Sycophant structs
  7. Tool Execution - Auto-executes tool calls if tools have functions set
  8. Cost Enrichment - Calculates token costs from LLMDB pricing data
  9. Response Validation - Validates structured output against schema if provided
  10. Context Attachment - Stores conversation state for continuation

Summary

Functions

Executes a full LLM request pipeline: resolves model, validates params, encodes, transports, and decodes.

Functions

call(messages, opts)

@spec call(
  [Sycophant.Message.t()],
  keyword()
) :: {:ok, Sycophant.Response.t()} | {:error, Splode.Error.t()}

Executes a full LLM request pipeline: resolves model, validates params, encodes, transports, and decodes.