pub struct LlmClient { /* private fields */ }Expand description
Client for making LLM inference calls.
Implementations§
Source§impl LlmClient
impl LlmClient
Sourcepub async fn infer_string(&self, prompt: &str) -> SageResult<String>
pub async fn infer_string(&self, prompt: &str) -> SageResult<String>
Call the LLM with a prompt and return the raw string response.
Sourcepub async fn infer<T>(&self, prompt: &str) -> SageResult<T>where
T: DeserializeOwned,
pub async fn infer<T>(&self, prompt: &str) -> SageResult<T>where
T: DeserializeOwned,
Call the LLM with a prompt and parse the response as the given type.
Sourcepub async fn infer_structured<T>(
&self,
prompt: &str,
schema: &str,
) -> SageResult<T>where
T: DeserializeOwned,
pub async fn infer_structured<T>(
&self,
prompt: &str,
schema: &str,
) -> SageResult<T>where
T: DeserializeOwned,
Call the LLM with schema-injected prompt engineering for structured output.
The schema is injected as a system message, and the runtime retries up to
SAGE_INFER_RETRIES times (default 3) on parse failure.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlmClient
impl !RefUnwindSafe for LlmClient
impl Send for LlmClient
impl Sync for LlmClient
impl Unpin for LlmClient
impl UnsafeUnpin for LlmClient
impl !UnwindSafe for LlmClient
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