Skip to main content

LlmBackend

Trait LlmBackend 

Source
pub trait LlmBackend: Send + Sync {
    // Required methods
    fn model(&self) -> &str;
    fn complete(&self, request: &str) -> Result<String>;
}
Expand description

A backend that answers one JSON request with one JSON response. Object-safe so the engine can hold a Box<dyn LlmBackend>.

Required Methods§

Source

fn model(&self) -> &str

Model identifier, stamped as provenance on origin = llm grains.

Source

fn complete(&self, request: &str) -> Result<String>

Run one request. request is a JSON string; the returned text is expected to be JSON and is validated by the caller.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§