pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
pub fn new() -> Self
pub fn with_config(cfg: Config) -> Self
pub fn from_env() -> Self
pub fn from_yaml_file_auto() -> Option<Self>
Sourcepub fn list_models(&self) -> Vec<String>
pub fn list_models(&self) -> Vec<String>
列出可用模型(形式:provider/model),仅本地配置/默认值
Sourcepub async fn list_models_auto(&self) -> Result<Vec<String>, LlmProxyError>
pub async fn list_models_auto(&self) -> Result<Vec<String>, LlmProxyError>
自动聚合模型列表(根据配置决定在线/离线,默认 CallOptions)
Sourcepub async fn list_models_auto_with(
&self,
opts: CallOptions,
) -> Result<Vec<String>, LlmProxyError>
pub async fn list_models_auto_with( &self, opts: CallOptions, ) -> Result<Vec<String>, LlmProxyError>
自动聚合模型列表(可自定义调用参数)
Sourcepub async fn chat(
&self,
req: ChatRequest,
) -> Result<ChatResponse, LlmProxyError>
pub async fn chat( &self, req: ChatRequest, ) -> Result<ChatResponse, LlmProxyError>
非流式对话
Sourcepub async fn chat_with(
&self,
req: ChatRequest,
opts: CallOptions,
) -> Result<ChatResponse, LlmProxyError>
pub async fn chat_with( &self, req: ChatRequest, opts: CallOptions, ) -> Result<ChatResponse, LlmProxyError>
非流式对话(可选调用参数)
Sourcepub async fn chat_stream(
&self,
req: ChatRequest,
) -> Result<BoxStream<'static, Result<String, LlmProxyError>>, LlmProxyError>
pub async fn chat_stream( &self, req: ChatRequest, ) -> Result<BoxStream<'static, Result<String, LlmProxyError>>, LlmProxyError>
流式对话
Sourcepub async fn chat_stream_with(
&self,
req: ChatRequest,
opts: CallOptions,
) -> Result<BoxStream<'static, Result<String, LlmProxyError>>, LlmProxyError>
pub async fn chat_stream_with( &self, req: ChatRequest, opts: CallOptions, ) -> Result<BoxStream<'static, Result<String, LlmProxyError>>, LlmProxyError>
流式对话(可选调用参数)
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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