pub struct GitHubCopilotChatClient { /* private fields */ }Expand description
A GitHub Copilot chat client (POST {base_url}/chat/completions).
Implementations§
Source§impl GitHubCopilotChatClient
impl GitHubCopilotChatClient
Sourcepub fn new(github_token: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(github_token: impl Into<String>, model: impl Into<String>) -> Self
Create a client for the given GitHub OAuth token / PAT and default model, targeting the default Copilot API base URL.
github_token is not sent directly to the chat endpoint — it is
exchanged for a short-lived Copilot API token on first use (see the
crate-level docs).
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: the GitHub OAuth token / PAT is
read from GITHUB_TOKEN_ENV (GITHUB_COPILOT_TOKEN), falling back
to GITHUB_TOKEN_ENV_ALT (GH_COPILOT_TOKEN) if unset; an
Error::Configuration is returned if neither is set. The optional
BASE_URL_ENV (GITHUB_COPILOT_BASE_URL) overrides the default
base URL when 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 (e.g. for an enterprise deployment or a proxy in front of the Copilot API).
Trait Implementations§
Source§impl ChatClient for GitHubCopilotChatClient
impl ChatClient for GitHubCopilotChatClient
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 GitHubCopilotChatClient
impl Clone for GitHubCopilotChatClient
Source§fn clone(&self) -> GitHubCopilotChatClient
fn clone(&self) -> GitHubCopilotChatClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more