LLMResponseTrait

Trait LLMResponseTrait 

Source
pub trait LLMResponseTrait<C: for<'de> Deserialize<'de> + Default + Send> {
    // Required methods
    fn new(content: C, tool_calls: Vec<ToolCall>, is_complete: bool) -> Self;
    fn is_complete(&self) -> bool;
    fn tool_calls(&self) -> Vec<ToolCall>;
    fn content(&self) -> C;
}
Expand description

Trait for LLM response types with tool calling support.

This trait defines the interface for LLM responses, supporting both content generation and tool calling capabilities.

Required Methods§

Source

fn new(content: C, tool_calls: Vec<ToolCall>, is_complete: bool) -> Self

Creates a new LLM response.

Source

fn is_complete(&self) -> bool

Returns whether the response is complete.

Source

fn tool_calls(&self) -> Vec<ToolCall>

Returns the tool calls requested by the LLM.

Source

fn content(&self) -> C

Returns the content of the response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C> LLMResponseTrait<C> for LLMResponse<C>
where C: for<'de> Deserialize<'de> + Default + Clone + Send,