pub struct OpenAiResponsesAdapter { /* private fields */ }Expand description
Live OpenAI Responses API adapter.
It implements ProviderAdapter and delegates all runtime policy, journaling,
event publication, approval, and tool execution back to agent-sdk-core.
Implementations§
Source§impl OpenAiResponsesAdapter
impl OpenAiResponsesAdapter
Sourcepub fn from_env(model: impl Into<String>) -> Result<Self, AgentError>
pub fn from_env(model: impl Into<String>) -> Result<Self, AgentError>
Creates a live adapter using OPENAI_API_KEY.
Sourcepub fn new(
config: OpenAiLiveResponsesConfig,
api_key: ProviderApiKey,
) -> Result<Self, AgentError>
pub fn new( config: OpenAiLiveResponsesConfig, api_key: ProviderApiKey, ) -> Result<Self, AgentError>
Creates a live adapter with a host-resolved API key.
Sourcepub fn with_transport(
config: OpenAiLiveResponsesConfig,
api_key: ProviderApiKey,
http: Arc<dyn JsonHttpTransport>,
) -> Result<Self, AgentError>
pub fn with_transport( config: OpenAiLiveResponsesConfig, api_key: ProviderApiKey, http: Arc<dyn JsonHttpTransport>, ) -> Result<Self, AgentError>
Creates an adapter with an injected JSON transport for deterministic tests or host-managed HTTP stacks.
Sourcepub fn with_argument_sink(self, sink: Arc<dyn OpenAiToolArgumentSink>) -> Self
pub fn with_argument_sink(self, sink: Arc<dyn OpenAiToolArgumentSink>) -> Self
Adds an optional host-owned sink for raw tool-call arguments.
Trait Implementations§
Source§impl Clone for OpenAiResponsesAdapter
impl Clone for OpenAiResponsesAdapter
Source§fn clone(&self) -> OpenAiResponsesAdapter
fn clone(&self) -> OpenAiResponsesAdapter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ProviderAdapter for OpenAiResponsesAdapter
impl ProviderAdapter for OpenAiResponsesAdapter
Source§fn capabilities(&self) -> ProviderCapabilities
fn capabilities(&self) -> ProviderCapabilities
Returns adapter capability metadata for policy and package resolution.
This is data-only and does not perform I/O, call host ports, append journals, publish
events, or start processes.
Source§fn project_request(
&self,
projection: &ContextProjection,
policy: &ProviderProjectionPolicy,
) -> Result<ProviderRequest, AgentError>
fn project_request( &self, projection: &ContextProjection, policy: &ProviderProjectionPolicy, ) -> Result<ProviderRequest, AgentError>
Projects admitted context into the provider’s request shape.
This projects admitted context into a provider request and must not fetch hidden raw
content.
Source§fn complete(
&self,
request: &ProviderRequest,
) -> Result<ProviderResponse, AgentError>
fn complete( &self, request: &ProviderRequest, ) -> Result<ProviderResponse, AgentError>
Calls the provider for one non-streaming completion request.
Implementations may call the model provider; caller-owned runtime code must handle
policy, journaling, and event publication around it.
Source§fn stream(
&self,
request: &ProviderRequest,
) -> Result<Vec<ProviderStreamChunk>, AgentError>
fn stream( &self, request: &ProviderRequest, ) -> Result<Vec<ProviderStreamChunk>, AgentError>
Calls the provider for a streaming response.
Implementations may call the model provider; caller-owned runtime code must handle
policy, journaling, and event publication around it.
Source§fn extract_usage(&self, response: &ProviderResponse) -> ProviderUsage
fn extract_usage(&self, response: &ProviderResponse) -> ProviderUsage
Extracts provider usage accounting from a response.
This derives usage accounting from a provider response and performs no provider call.
Auto Trait Implementations§
impl Freeze for OpenAiResponsesAdapter
impl !RefUnwindSafe for OpenAiResponsesAdapter
impl Send for OpenAiResponsesAdapter
impl Sync for OpenAiResponsesAdapter
impl Unpin for OpenAiResponsesAdapter
impl UnsafeUnpin for OpenAiResponsesAdapter
impl !UnwindSafe for OpenAiResponsesAdapter
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