pub struct CodexProvider { /* private fields */ }Expand description
Provider over the ChatGPT Codex backend.
Holds the credential set used for both catalog listing and model clients.
Token lifecycle (expiry refresh, rotation persistence) is handled inside
each Codex model client created by [get_model].
Implementations§
Source§impl CodexProvider
impl CodexProvider
Sourcepub fn new(credentials: CodexCredentials) -> Self
pub fn new(credentials: CodexCredentials) -> Self
Create a provider from OAuth credentials.
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 backend base URL.
Sourcepub fn on_refresh(
self,
callback: impl Fn(&CodexCredentials) + Send + Sync + 'static,
) -> Self
pub fn on_refresh( self, callback: impl Fn(&CodexCredentials) + Send + Sync + 'static, ) -> Self
Propagate a token-rotation persistence callback to model clients.
Sourcepub const fn credentials(&self) -> &CodexCredentials
pub const fn credentials(&self) -> &CodexCredentials
The credentials backing this provider.
Trait Implementations§
Source§impl Clone for CodexProvider
impl Clone for CodexProvider
Source§impl Debug for CodexProvider
impl Debug for CodexProvider
Source§impl LanguageModelProvider for CodexProvider
impl LanguageModelProvider for CodexProvider
Source§type Error = CodexError
type Error = CodexError
The error type returned by this provider.
Source§async fn list_models(&self) -> Result<Vec<ModelProfile>, Self::Error>
async fn list_models(&self) -> Result<Vec<ModelProfile>, Self::Error>
Lists all available models from this provider.
Auto Trait Implementations§
impl !RefUnwindSafe for CodexProvider
impl !UnwindSafe for CodexProvider
impl Freeze for CodexProvider
impl Send for CodexProvider
impl Sync for CodexProvider
impl Unpin for CodexProvider
impl UnsafeUnpin for CodexProvider
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