Skip to main content

ResponsesClient

Trait ResponsesClient 

Source
pub trait ResponsesClient: Send + Sync {
    // Required methods
    fn create_response<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ResponsesRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn retrieve_response<'life0, 'life1, 'async_trait>(
        &'life0 self,
        response_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn submit_tool_outputs<'life0, 'life1, 'async_trait>(
        &'life0 self,
        response_id: &'life1 str,
        tool_outputs: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Object-safe trait wrapping the OpenAI Responses API.

Implementations return the raw serde_json::Value from the upstream response so the HTTP-server layer can mirror Python’s response.model_dump() behaviour exactly without extra structural translation in the LLM crate.

Required Methods§

Source

fn create_response<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ResponsesRequest, ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Create a new response. Mirrors Python’s client.responses.create(...). Returns the raw JSON Value from the upstream API (the caller is responsible for shaping it into the public ResponseBodyDTO).

Source

fn retrieve_response<'life0, 'life1, 'async_trait>( &'life0 self, response_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Retrieve a stored / async response by id. Used to poll until completion. Mirrors GET /v1/responses/{id}.

Source

fn submit_tool_outputs<'life0, 'life1, 'async_trait>( &'life0 self, response_id: &'life1 str, tool_outputs: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Submit tool outputs back for the given response id. Mirrors POST /v1/responses/{id}/submit_tool_outputs. Returns the updated response.

tool_outputs is an array of {"tool_call_id": "...", "output": "..."} objects (matching the OpenAI wire shape).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§