pub struct CliClient { /* private fields */ }Expand description
LLM client that delegates to a CLI subprocess.
The CLI handles its own auth — no API keys needed.
Tool calls are emulated: tool schemas go into the prompt as text,
the CLI returns plain text, and we parse it back into ToolCalls.
Implementations§
Source§impl CliClient
impl CliClient
pub fn new(backend: CliBackend) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Trait Implementations§
Source§impl LlmClient for CliClient
impl LlmClient for CliClient
Source§fn structured_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
schema: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<(Option<Value>, Vec<ToolCall>, String), SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn structured_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
schema: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<(Option<Value>, Vec<ToolCall>, String), SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Structured call: send messages with schema injected into system prompt.
Returns (parsed_output, native_tool_calls, raw_text).
Source§fn tools_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolDef],
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCall>, SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn tools_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolDef],
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCall>, SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Native function calling: send messages + tool defs, get tool calls.
This is STATELESS — no side effects on shared state.
Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<String, SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<String, SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Plain text completion (no schema, no tools).
Source§fn tools_call_stateful<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolDef],
_previous_response_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<ToolCall>, Option<String>), SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn tools_call_stateful<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolDef],
_previous_response_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(Vec<ToolCall>, Option<String>), SgrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stateful function calling with explicit response_id for chaining.
Returns (tool_calls, new_response_id).
When previous_response_id is Some, only delta messages are needed.
Auto Trait Implementations§
impl Freeze for CliClient
impl RefUnwindSafe for CliClient
impl Send for CliClient
impl Sync for CliClient
impl Unpin for CliClient
impl UnsafeUnpin for CliClient
impl UnwindSafe for CliClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more