pub struct ChatGptCodexClient { /* private fields */ }Expand description
Concrete ChatGPT Codex API client.
Implementations§
Source§impl ChatGptCodexClient
impl ChatGptCodexClient
Sourcepub fn from_env_or_dotenv(_workspace_root: &Path) -> Result<Self>
pub fn from_env_or_dotenv(_workspace_root: &Path) -> Result<Self>
Create a client from CHATGPT_CODEX_ACCESS_TOKEN or ~/.thndrs/auth.json.
Sourcepub fn new(base_url: &str, auth: ChatGptCodexAuth) -> Self
pub fn new(base_url: &str, auth: ChatGptCodexAuth) -> Self
Create a client with explicit auth material.
Sourcepub fn build_responses_headers(&self) -> Vec<(String, String)>
pub fn build_responses_headers(&self) -> Vec<(String, String)>
Build the headers for a streaming Responses request.
Sourcepub fn build_responses_request_body(
model: &str,
messages: &[ProviderMessage],
tools: Option<&Value>,
) -> Result<Value>
pub fn build_responses_request_body( model: &str, messages: &[ProviderMessage], tools: Option<&Value>, ) -> Result<Value>
Build a Responses-like streaming request body.
Sourcepub fn build_responses_request_body_with_reasoning(
model: &str,
messages: &[ProviderMessage],
tools: Option<&Value>,
effort: ReasoningEffort,
summary: ReasoningSummary,
continuation: &ProviderContinuation,
) -> Result<Value>
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.
Sourcepub fn build_openai_responses_request_body(
raw_model: &str,
messages: &[ProviderMessage],
tools: Option<&Value>,
effort: ReasoningEffort,
summary: ReasoningSummary,
continuation: &ProviderContinuation,
) -> Value
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.
Sourcepub fn probe_authentication(&self) -> Result<()>
pub fn probe_authentication(&self) -> Result<()>
Verify the configured credential against the lightweight model catalog.
Sourcepub fn send_streaming_request(
&self,
model: &str,
messages: &[ProviderMessage],
tools: Option<&Value>,
effort: ReasoningEffort,
summary: ReasoningSummary,
continuation: &ProviderContinuation,
) -> Result<Response<Body>>
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
impl StreamingProvider for ChatGptCodexClient
type Metadata = ()
fn name(&self) -> &'static str
fn load_status(&self) -> String
fn request_status(&self, model: &str) -> String
fn from_env_or_dotenv(root: &Path) -> Result<Self>
fn load_metadata(&self) -> Result<Self::Metadata>
fn metadata_loaded_event( &self, _metadata: &Self::Metadata, ) -> Option<AgentEvent>
fn metadata_status( &self, model: &str, _metadata: &Self::Metadata, ) -> Option<String>
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>>
fn serialized_request_body( &self, model: &str, messages: &[ProviderMessage], request: &StreamingRequest<'_>, ) -> Result<Vec<u8>>
Serialize exactly the request body that the adapter sends.
fn send_streaming_request( &self, model: &str, messages: &[ProviderMessage], request: &StreamingRequest<'_>, ) -> Result<Response<Body>>
fn stream_format(&self, model: &str) -> Result<StreamFormat>
fn request_error_message(error: &ProviderError) -> String
fn is_retryable_request_error(error: &ProviderError) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for ChatGptCodexClient
impl !UnwindSafe for ChatGptCodexClient
impl Freeze for ChatGptCodexClient
impl Send for ChatGptCodexClient
impl Sync for ChatGptCodexClient
impl Unpin for ChatGptCodexClient
impl UnsafeUnpin for ChatGptCodexClient
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
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 moreSource§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.