pub enum Client {
Openai(Box<Model<Responses>>, String),
Anthropic(Box<Model<Messages>>, String),
Codex(Codex),
}Expand description
A backend’s client for one review. The API-key backends keep the key they send: a provider error may echo it, and every error leaves through the shared rule for server text.
Variants§
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
backend: Backend,
model: &ModelId,
state: &Path,
repo: &Path,
) -> Result<Self, Failure>
pub fn new( backend: Backend, model: &ModelId, state: &Path, repo: &Path, ) -> Result<Self, Failure>
state and repo locate Codex credentials; the API-key backends ignore them.
Sourcepub fn parameters(
backend: Backend,
reasoning: Option<&str>,
session: &SessionId,
) -> Result<Value, String>
pub fn parameters( backend: Backend, reasoning: Option<&str>, session: &SessionId, ) -> Result<Value, String>
The provider parameters of every request of one review. The Responses backends key
their prompt cache on the review’s session id; Anthropic caches by prefix alone.
Sourcepub fn output_format(backend: Backend, parameters: &mut Value, schema: Value)
pub fn output_format(backend: Backend, parameters: &mut Value, schema: Value)
Structured output constrains the final answer only; tool calls keep their contract. Merge Anthropic’s format with the reasoning effort already in output_config.
Sourcepub async fn turn(
&self,
request: &CompletionRequest,
context: Turn<'_>,
attempts: &mut Vec<Attempt>,
) -> Result<CompletionResponse, Failure>
pub async fn turn( &self, request: &CompletionRequest, context: Turn<'_>, attempts: &mut Vec<Attempt>, ) -> Result<CompletionResponse, Failure>
One turn, retried while an attempt fails with a rate limit or a transient error
before producing any output or usage: at any turn, since every request replays the
whole conversation. A retry waits as long as the provider’s Retry-After asks, or a
short backoff, within the review’s deadline.
Sourcepub async fn turn_observed(
&self,
request: &CompletionRequest,
context: Turn<'_>,
attempts: &mut Vec<Attempt>,
observe: &mut impl FnMut(Delivery),
) -> Result<CompletionResponse, Failure>
pub async fn turn_observed( &self, request: &CompletionRequest, context: Turn<'_>, attempts: &mut Vec<Attempt>, observe: &mut impl FnMut(Delivery), ) -> Result<CompletionResponse, Failure>
Optional display delivery leaves the provider/retry/budget contract unchanged.