pub struct ResponseRequest {
model: String,
instructions: Option<String>,
input: Vec<InputItem>,
tools: Option<Vec<Tool>>,
include: Option<Vec<String>>,
max_output_tokens: Option<u64>,
previous_response_id: Option<String>,
temperature: Option<f32>,
top_p: Option<f32>,
user: Option<String>,
}
Expand description
OpenAI API JSON 定義。 Response API リクエスト。
Fields§
§model: String
Model ID used to generate the response, like gpt-4o or o1. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
instructions: Option<String>
Inserts a system (or developer) message as the first item in the model’s context. When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
input: Vec<InputItem>
Text, image, or file inputs to the model, used to generate a response. (string or Array)
tools: Option<Vec<Tool>>
An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.
The two categories of tools you can provide the model are:
- Built-in tools
- Tools that are provided by OpenAI that extend the model’s capabilities, like web search or file search. Learn more about built-in tools.
- Function calls (custom tools)
- Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
include: Option<Vec<String>>
Specify additional output data to include in the model response. Currently supported values are:
- file_search_call.results:
- Include the search results of the file search tool call.
- message.input_image.image_url:
- Include image urls from the input message.
- computer_call_output.output.image_url: *Include image urls from the computer call output.
max_output_tokens: Option<u64>
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
previous_response_id: Option<String>
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
temperature: Option<f32>
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. (Defaults to 1)
top_p: Option<f32>
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. (Defaults to 1)
user: Option<String>
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Trait Implementations§
Source§impl Clone for ResponseRequest
impl Clone for ResponseRequest
Source§fn clone(&self) -> ResponseRequest
fn clone(&self) -> ResponseRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ResponseRequest
impl Debug for ResponseRequest
Source§impl Default for ResponseRequest
impl Default for ResponseRequest
Source§fn default() -> ResponseRequest
fn default() -> ResponseRequest
Auto Trait Implementations§
impl Freeze for ResponseRequest
impl RefUnwindSafe for ResponseRequest
impl Send for ResponseRequest
impl Sync for ResponseRequest
impl Unpin for ResponseRequest
impl UnwindSafe for ResponseRequest
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<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.