Skip to main content

Crate polyc_llm

Crate polyc_llm 

Source
Expand description

Provider-agnostic LLM trait and wire types for polychrome.

This crate defines the LlmProvider trait that every concrete provider backend implements, and the language-shaped Rust types that flow through it.

LlmProvider is the seam that lets the planner swap LLM backends without touching its own code: one impl crate per provider, dispatched behind a dyn LlmProvider trait object.

§Modules

The trait itself lives in this crate root; the wire types live in the modules above and are re-exported here for convenience.

Re-exports§

pub use chunk::Chunk;
pub use chunk::StopReason;
pub use chunk::Usage;
pub use erased::BoxError;
pub use erased::DynProvider;
pub use erased::ErasedProvider;
pub use erased::into_dyn;
pub use error::LlmError;
pub use error::LlmErrorKind;
pub use error::kind_from_http_status;
pub use request::CompletionRequest;
pub use request::Content;
pub use request::ImageRef;
pub use request::JsonSchema;
pub use request::Message;
pub use request::Role;
pub use request::ToolCall;
pub use request::ToolChoice;
pub use request::ToolResult;
pub use request::ToolSpec;
pub use request::humanize_tool_name;

Modules§

chunk
Streaming response types: Chunk, Usage, and StopReason.
erased
Type erasure for LlmProvider so the control plane can hold a single Arc<dyn LlmProvider> regardless of which backend is configured.
error
LlmError marker trait and reference DummyError implementation.
request
Request-side LLM types: CompletionRequest, Message, Content, ToolSpec, ToolChoice, and JsonSchema.
sse
Shared Server-Sent Events framing helpers for streaming providers.
turn
Turn helpers: a StubProvider for wiring/tests and collect_turn, which folds a provider’s Chunk stream into a single TurnOutput.

Traits§

LlmProvider
The seam between the planner and any concrete LLM backend.