Skip to main content

ChatGptCodexClient

Struct ChatGptCodexClient 

Source
pub struct ChatGptCodexClient { /* private fields */ }
Expand description

Concrete ChatGPT Codex API client.

Implementations§

Source§

impl ChatGptCodexClient

Source

pub fn from_env_or_dotenv(_workspace_root: &Path) -> Result<Self>

Create a client from CHATGPT_CODEX_ACCESS_TOKEN or ~/.thndrs/auth.json.

Source

pub fn new(base_url: &str, auth: ChatGptCodexAuth) -> Self

Create a client with explicit auth material.

Source

pub fn build_responses_headers(&self) -> Vec<(String, String)>

Build the headers for a streaming Responses request.

Source

pub fn build_responses_request_body( model: &str, messages: &[ProviderMessage], tools: Option<&Value>, ) -> Result<Value>

Build a Responses-like streaming request body.

Source

pub fn build_responses_request_body_with_reasoning( model: &str, messages: &[ProviderMessage], tools: Option<&Value>, effort: ReasoningEffort, summary: ReasoningSummary, continuation: &ProviderContinuation, ) -> Result<Value>

Build a Responses streaming request body for the ChatGPT Codex route.

Source

pub fn build_openai_responses_request_body( raw_model: &str, messages: &[ProviderMessage], tools: Option<&Value>, effort: ReasoningEffort, summary: ReasoningSummary, continuation: &ProviderContinuation, ) -> Value

Build a standard Responses request for an already-normalized model id.

Source

pub fn probe_authentication(&self) -> Result<()>

Verify the configured credential against the lightweight model catalog.

Source

pub fn send_streaming_request( &self, model: &str, messages: &[ProviderMessage], tools: Option<&Value>, effort: ReasoningEffort, summary: ReasoningSummary, continuation: &ProviderContinuation, ) -> Result<Response<Body>>

Send a streaming request to POST /responses.

Trait Implementations§

Source§

impl StreamingProvider for ChatGptCodexClient

Source§

type Metadata = ()

Source§

fn name(&self) -> &'static str

Source§

fn load_status(&self) -> String

Source§

fn request_status(&self, model: &str) -> String

Source§

fn from_env_or_dotenv(root: &Path) -> Result<Self>

Source§

fn load_metadata(&self) -> Result<Self::Metadata>

Source§

fn metadata_loaded_event( &self, _metadata: &Self::Metadata, ) -> Option<AgentEvent>

Source§

fn metadata_status( &self, model: &str, _metadata: &Self::Metadata, ) -> Option<String>

Source§

fn token_budget(&self, _model: &str, _metadata: Option<&Self::Metadata>) -> u32

Source§

fn serialized_request_body( &self, model: &str, messages: &[ProviderMessage], request: &StreamingRequest<'_>, ) -> Result<Vec<u8>>

Serialize exactly the request body that the adapter sends.
Source§

fn send_streaming_request( &self, model: &str, messages: &[ProviderMessage], request: &StreamingRequest<'_>, ) -> Result<Response<Body>>

Source§

fn stream_format(&self, model: &str) -> Result<StreamFormat>

Source§

fn request_error_message(error: &ProviderError) -> String

Source§

fn is_retryable_request_error(error: &ProviderError) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more