pub struct ResponsesCompletionModel<H = Client> {
pub model: String,
pub tools: Vec<ResponsesToolDefinition>,
pub strict_tools: bool,
/* private fields */
}Fields§
§model: String§tools: Vec<ResponsesToolDefinition>§strict_tools: boolImplementations§
Source§impl<H> ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
impl<H> ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
pub fn new(client: Client<H>, model: impl Into<String>) -> Self
Sourcepub fn with_strict_tools(self) -> Self
pub fn with_strict_tools(self) -> Self
Enable strict mode for function tool schemas.
pub fn with_tool(self, tool: impl Into<ResponsesToolDefinition>) -> Self
pub fn with_tools<I, Tool>(self, tools: I) -> Self
Sourcepub async fn raw_completion(
&self,
completion_request: CompletionRequest,
) -> Result<CompletionResponse, CompletionError>
pub async fn raw_completion( &self, completion_request: CompletionRequest, ) -> Result<CompletionResponse, CompletionError>
Execute a ChatGPT completion and return the Responses API’s own wire response.
This is the escape hatch for fields rig does not normalize, and it issues the same single request the normalized path does.
One caveat is specific to this provider: /responses answers with an
SSE body even for a non-streaming request, so the value returned here is
reassembled from the terminal response.completed event. That event
sometimes carries an empty output, in which case the assistant content
exists only in the preceding events and
completion::CompletionModel::completion rebuilds it from them. When
you need the provider’s events in full fidelity rather than just its
terminal record, use ResponsesCompletionModel::raw_stream.
Source§impl<H> ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
impl<H> ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
Sourcepub async fn stream(
&self,
completion_request: CompletionRequest,
) -> Result<StreamingCompletionResponse, CompletionError>
pub async fn stream( &self, completion_request: CompletionRequest, ) -> Result<StreamingCompletionResponse, CompletionError>
Open a stream normalized to rig’s terminal record.
Delegates to ResponsesCompletionModel::raw_stream — one request
either way.
Sourcepub async fn raw_stream(
&self,
completion_request: CompletionRequest,
) -> Result<RawStreamingResult<StreamingCompletionResponse>, CompletionError>
pub async fn raw_stream( &self, completion_request: CompletionRequest, ) -> Result<RawStreamingResult<StreamingCompletionResponse>, CompletionError>
Open a stream whose terminal record stays the Responses API’s own type.
Trait Implementations§
Source§impl<H: Clone> Clone for ResponsesCompletionModel<H>
impl<H: Clone> Clone for ResponsesCompletionModel<H>
Source§fn clone(&self) -> ResponsesCompletionModel<H>
fn clone(&self) -> ResponsesCompletionModel<H>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<H> CompletionModel for ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
impl<H> CompletionModel for ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
Source§async fn completion(
&self,
completion_request: CompletionRequest,
) -> Result<CompletionResponse, CompletionError>
async fn completion( &self, completion_request: CompletionRequest, ) -> Result<CompletionResponse, CompletionError>
Source§async fn stream(
&self,
completion_request: CompletionRequest,
) -> Result<StreamingCompletionResponse, CompletionError>
async fn stream( &self, completion_request: CompletionRequest, ) -> Result<StreamingCompletionResponse, CompletionError>
Source§fn completion_request(
&self,
prompt: impl Into<Message>,
) -> CompletionRequestBuilder<Self>
fn completion_request( &self, prompt: impl Into<Message>, ) -> CompletionRequestBuilder<Self>
prompt.Source§fn capabilities(&self) -> ProviderCapabilities
fn capabilities(&self) -> ProviderCapabilities
Source§impl<H> ConstructCompletionModel<Client<ChatGPTExt, H>> for ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
impl<H> ConstructCompletionModel<Client<ChatGPTExt, H>> for ResponsesCompletionModel<H>where
Client<H>: HttpClientExt + Clone + Debug + 'static,
H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,
Auto Trait Implementations§
impl<H = Client> !RefUnwindSafe for ResponsesCompletionModel<H>
impl<H = Client> !UnwindSafe for ResponsesCompletionModel<H>
impl<H> Freeze for ResponsesCompletionModel<H>where
H: Freeze,
impl<H> Send for ResponsesCompletionModel<H>where
H: Send,
impl<H> Sync for ResponsesCompletionModel<H>where
H: Sync,
impl<H> Unpin for ResponsesCompletionModel<H>where
H: Unpin,
impl<H> UnsafeUnpin for ResponsesCompletionModel<H>where
H: UnsafeUnpin,
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> 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> 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> ⓘ
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> ⓘ
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 more