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 = Profile> + Send
fn profile(&self) -> impl Future<Output = Profile> + 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
Auto Trait Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more