pub struct OpenResponsesProtocolChatDriver { /* private fields */ }Implementations§
Source§impl OpenResponsesProtocolChatDriver
impl OpenResponsesProtocolChatDriver
Sourcepub fn with_base_url(
api_key: impl Into<String>,
api_url: impl Into<String>,
) -> Self
pub fn with_base_url( api_key: impl Into<String>, api_url: impl Into<String>, ) -> Self
Create a new driver with a custom API URL
Sourcepub fn with_provider_type(self, provider_type: DriverId) -> Self
pub fn with_provider_type(self, provider_type: DriverId) -> Self
Set the model provider used for provider-specific request features.
Sourcepub fn with_request_extension(
self,
extension: Arc<dyn OpenResponsesRequestExtension>,
) -> Self
pub fn with_request_extension( self, extension: Arc<dyn OpenResponsesRequestExtension>, ) -> Self
Attach a provider-specific request-body decorator. The decorator runs on
every chat request just before it is sent (see
OpenResponsesRequestExtension).
Sourcepub fn with_auth_provider(self, provider: Arc<dyn AuthHeaderProvider>) -> Self
pub fn with_auth_provider(self, provider: Arc<dyn AuthHeaderProvider>) -> Self
Set a pluggable AuthHeaderProvider that overrides the default
host-keyed api-key / bearer auth. The provider is awaited once per HTTP
attempt (including retries), so refreshable OAuth providers (ChatGPT/Codex,
Entra ID, workload identity, …) can mint or refresh tokens per request
without the driver knowing the scheme. The resolved auth header takes
precedence over any header set by an
OpenResponsesRequestExtension::decorate_headers.
Sourcepub fn with_retry_config(self, config: LlmRetryConfig) -> Self
pub fn with_retry_config(self, config: LlmRetryConfig) -> Self
Configure retry behavior for rate limit errors
Sourcepub fn provider_type(&self) -> &DriverId
pub fn provider_type(&self) -> &DriverId
Get the provider type used for model profile lookup.
Sourcepub async fn compact(&self, request: CompactRequest) -> Result<CompactResponse>
pub async fn compact(&self, request: CompactRequest) -> Result<CompactResponse>
Compact a conversation to reduce context size
This method calls the /v1/responses/compact endpoint to compress the conversation history. User messages are kept verbatim, while assistant messages, tool calls, and tool results are replaced by an encrypted compaction item.
§Arguments
request- The compact request containing the model and input items
§Returns
Returns a CompactResponse containing the compacted output items.
The output can be used directly as input for the next /v1/responses call.
§Example
use everruns_core::{OpenResponsesProtocolChatDriver, CompactRequest, CompactInputItem, CompactContent};
let driver = OpenResponsesProtocolChatDriver::new("your-api-key");
let request = CompactRequest {
model: "gpt-4o".to_string(),
input: vec![
CompactInputItem::Message {
role: "user".to_string(),
content: CompactContent::Text("Hello!".to_string()),
},
],
previous_response_id: None,
instructions: None,
};
let response = driver.compact(request).await?;
// Use response.output as input for the next /v1/responses callSourcepub fn supports_compact(&self) -> bool
pub fn supports_compact(&self) -> bool
Check if this driver supports the compact endpoint
Returns true for OpenAI’s Responses API. Custom endpoints may or may not support compaction.
Trait Implementations§
Source§impl ChatDriver for OpenResponsesProtocolChatDriver
impl ChatDriver for OpenResponsesProtocolChatDriver
Source§fn supports_parallel_tool_calls(&self, _model: &str) -> bool
fn supports_parallel_tool_calls(&self, _model: &str) -> bool
The Responses API accepts the top-level parallel_tool_calls boolean.
Source§fn chat_completion_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<LlmMessage>,
config: &'life1 LlmCallConfig,
) -> Pin<Box<dyn Future<Output = Result<LlmResponseStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat_completion_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<LlmMessage>,
config: &'life1 LlmCallConfig,
) -> Pin<Box<dyn Future<Output = Result<LlmResponseStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn supports_compact(&self) -> bool
fn supports_compact(&self) -> bool
Source§fn compact<'life0, 'async_trait>(
&'life0 self,
request: CompactRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<CompactResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn compact<'life0, 'async_trait>(
&'life0 self,
request: CompactRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<CompactResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn chat_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<LlmMessage>,
config: &'life1 LlmCallConfig,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<LlmMessage>,
config: &'life1 LlmCallConfig,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Clone for OpenResponsesProtocolChatDriver
impl Clone for OpenResponsesProtocolChatDriver
Source§fn clone(&self) -> OpenResponsesProtocolChatDriver
fn clone(&self) -> OpenResponsesProtocolChatDriver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for OpenResponsesProtocolChatDriver
impl !UnwindSafe for OpenResponsesProtocolChatDriver
impl Freeze for OpenResponsesProtocolChatDriver
impl Send for OpenResponsesProtocolChatDriver
impl Sync for OpenResponsesProtocolChatDriver
impl Unpin for OpenResponsesProtocolChatDriver
impl UnsafeUnpin for OpenResponsesProtocolChatDriver
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
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request