pub struct Copilot { /* private fields */ }Expand description
GitHub Copilot language model client.
Uses the OpenAI-compatible chat completions API at api.githubcopilot.com.
Implementations§
Source§impl Copilot
impl Copilot
Sourcepub fn new(token: impl Into<String>) -> Copilot
pub fn new(token: impl Into<String>) -> Copilot
Create a new Copilot client with the given OAuth token.
Sourcepub fn builder(token: impl Into<String>) -> Builder
pub fn builder(token: impl Into<String>) -> Builder
Create a builder for configuring the Copilot client.
Sourcepub fn with_model(self, model: impl Into<String>) -> Copilot
pub fn with_model(self, model: impl Into<String>) -> Copilot
Override the default chat model.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Copilot
pub fn with_base_url(self, base_url: impl Into<String>) -> Copilot
Override the REST base URL.
Sourcepub fn with_oauth_token(self, token: impl Into<String>) -> Copilot
pub fn with_oauth_token(self, token: impl Into<String>) -> Copilot
Provide an OAuth token so the client can refresh session tokens on 401s.
Trait Implementations§
Source§impl From<Copilot> for CloudProvider
impl From<Copilot> for CloudProvider
Source§impl LanguageModel for Copilot
impl LanguageModel for Copilot
Source§type Error = CopilotError
type Error = CopilotError
The error type returned by this language model.
Source§fn respond(
&self,
request: LLMRequest,
) -> impl Stream<Item = Result<Event, <Copilot as LanguageModel>::Error>> + Send
fn respond( &self, request: LLMRequest, ) -> impl Stream<Item = Result<Event, <Copilot as LanguageModel>::Error>> + Send
Generates a streaming response to a conversation. Read more
Source§fn profile(
&self,
) -> impl Future<Output = Result<Profile, <Copilot as LanguageModel>::Error>> + Send
fn profile( &self, ) -> impl Future<Output = Result<Profile, <Copilot as LanguageModel>::Error>> + Send
Returns model profile and capabilities. Read more
Source§fn respond_with_tools(
&self,
request: LLMRequestWithTools<'_>,
) -> impl Stream<Item = Result<Event, Self::Error>> + Send
fn respond_with_tools( &self, request: LLMRequestWithTools<'_>, ) -> impl Stream<Item = Result<Event, Self::Error>> + Send
Generates a streaming response with a mutable tool registry. Read more
Source§fn generate<T>(
&self,
request: LLMRequest,
) -> impl Future<Output = Result<T, GenerateError<Self::Error>>> + Sendwhere
T: JsonSchema + DeserializeOwned + 'static,
fn generate<T>(
&self,
request: LLMRequest,
) -> impl Future<Output = Result<T, GenerateError<Self::Error>>> + Sendwhere
T: JsonSchema + DeserializeOwned + 'static,
Generates structured output conforming to JSON schema. Read more
Source§fn complete(
&self,
prefix: &str,
) -> impl Stream<Item = Result<Event, Self::Error>> + Send
fn complete( &self, prefix: &str, ) -> impl Stream<Item = Result<Event, Self::Error>> + Send
Completes given text prefix.
Source§fn summarize(
&self,
text: &str,
) -> impl Stream<Item = Result<Event, Self::Error>> + Send
fn summarize( &self, text: &str, ) -> impl Stream<Item = Result<Event, Self::Error>> + Send
Summarizes text. Read more
Source§fn categorize<T>(
&self,
text: &str,
) -> impl Future<Output = Result<T, GenerateError<Self::Error>>> + Sendwhere
T: JsonSchema + DeserializeOwned + 'static,
fn categorize<T>(
&self,
text: &str,
) -> impl Future<Output = Result<T, GenerateError<Self::Error>>> + Sendwhere
T: JsonSchema + DeserializeOwned + 'static,
Categorizes text. Read more
Source§fn retry_policy(&self) -> RetryPolicy
fn retry_policy(&self) -> RetryPolicy
How a request to this model that failed with a retryable failure is
sent again. Read more
Auto Trait Implementations§
impl Forget for Copilot
impl Freeze for Copilot
impl RefUnwindSafe for Copilot
impl Send for Copilot
impl Sync for Copilot
impl Unpin for Copilot
impl UnsafeUnpin for Copilot
impl UnwindSafe for Copilot
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