pub struct FoundryLocalChatClient { /* private fields */ }Expand description
A Microsoft Foundry Local chat client (POST {base_url}/chat/completions).
Implementations§
Source§impl FoundryLocalChatClient
impl FoundryLocalChatClient
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Create a client for the given default model, targeting
http://localhost:5273/v1.
Sourcepub fn from_env(model: impl Into<String>) -> Result<Self>
pub fn from_env(model: impl Into<String>) -> Result<Self>
Build a client from the environment. Foundry Local has no required
credential env var (a stock instance is unauthenticated), so this
never fails on missing configuration; it only reads the optional
FOUNDRY_LOCAL_ENDPOINT_ENV (FOUNDRY_LOCAL_ENDPOINT) to override
the default base URL and FOUNDRY_LOCAL_API_KEY_ENV
(FOUNDRY_LOCAL_API_KEY) to set a bearer token, if present.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the base URL (for a non-default port, or a remote Foundry
Local host). Must be the OpenAI-compatible root (i.e. include the
/v1 suffix), matching FoundryLocalChatClient::new’s default.
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Set a bearer token sent as Authorization: Bearer <key>. Not needed
for a stock local Foundry Local instance; useful when one sits behind
an authenticating proxy.
Trait Implementations§
Source§impl ChatClient for FoundryLocalChatClient
impl ChatClient for FoundryLocalChatClient
Source§fn get_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_streaming_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_streaming_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Clone for FoundryLocalChatClient
impl Clone for FoundryLocalChatClient
Source§fn clone(&self) -> FoundryLocalChatClient
fn clone(&self) -> FoundryLocalChatClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more