Skip to main content

Module llm

Module llm 

Source
Expand description

LLM client — hybrid provider with trait-based adapter.

LlmProvider trait with multiple implementations:

  • OllamaProvider — local Ollama server
  • OpenAiProvider — OpenAI compatible APIs

Structs§

Message
A message in the conversation.
OllamaProvider
Ollama LLM provider.
OpenAiProvider
OpenAI-compatible provider (works with OpenAI, OpenRouter, etc.)
ProposedToolCall
A tool call the model proposed in its response. Awareness ≠ permission: a proposed call is not executed here — the caller resolves it to a route and runs it through the consent/audit path.
ProviderConfig
Configuration for LLM provider selection.
Response
Complete LLM response.
ResponseChunk
LLM response chunk (for streaming).
ToolDef
A tool the model may call, in the provider-agnostic shape the kernel hands down the tools channel. parameters is a JSON Schema object describing the call arguments (the same input_schema a intent::ToolDescriptor carries). Producers route any untrusted description through intent::sanitization before it reaches a provider.
Usage
Token usage statistics.

Enums§

LlmError
Errors from the LLM layer.
Role
Message roles.

Traits§

LlmProvider
Trait for LLM providers.

Functions§

build_failover_chain
Build a failover chain from all configured providers.
create_provider
Create an LLM provider from configuration.
extract_json_from_response
Extract a JSON object from an LLM response string.
select_provider
Probe every configured provider, pick the first reachable one whose preferred_models intersects the live model list, and return it.