Skip to main content

CreateResponseRequest

Struct CreateResponseRequest 

Source
#[non_exhaustive]
pub struct CreateResponseRequest {
Show 31 fields pub model: String, pub input: ResponseInput, pub instructions: Option<String>, pub personality: Option<String>, pub previous_response_id: Option<String>, pub conversation: Option<ResponseConversation>, pub context_management: Option<Vec<ResponseContextManagement>>, pub moderation: Option<ResponseModeration>, pub tools: Vec<Value>, pub tool_choice: Option<ResponseToolChoice>, pub prompt: Option<ResponsePrompt>, pub max_output_tokens: Option<u32>, pub store: Option<bool>, pub background: Option<bool>, pub max_tool_calls: Option<u32>, pub metadata: BTreeMap<String, String>, pub parallel_tool_calls: Option<bool>, pub temperature: Option<f64>, pub top_p: Option<f64>, pub top_logprobs: Option<u8>, pub reasoning: Option<ResponseReasoning>, pub truncation: Option<ResponseTruncation>, pub prompt_cache_key: Option<String>, pub prompt_cache_retention: Option<ResponsePromptCacheRetention>, pub safety_identifier: Option<String>, pub service_tier: Option<ResponseServiceTier>, pub include: Option<Vec<ResponseInclude>>, pub text: Option<ResponseTextConfig>, pub stream_options: Option<StreamOptions>, pub stream: Option<bool>, pub extra: BTreeMap<String, Value>,
}
Expand description

EN: Request body for POST /v1/responses. 中文:POST /v1/responses 的请求体。

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§model: String

EN: Model id used to generate the response. 中文:用于生成响应的模型 ID。

§input: ResponseInput

EN: Input text or message list. 中文:输入文本或消息列表。

§instructions: Option<String>

EN: Optional system or developer instructions for this response. 中文:此响应可选的系统或开发者指令。

§personality: Option<String>

EN: Optional model-owned style preset to apply to this response. 中文:应用于此响应的可选模型自有风格预设。

§previous_response_id: Option<String>

EN: Optional previous response id for multi-turn conversation state. 中文:用于多轮会话状态的可选上一条响应 ID。

§conversation: Option<ResponseConversation>

EN: Optional conversation this response should belong to. 中文:此响应应归属的可选 conversation。

§context_management: Option<Vec<ResponseContextManagement>>

EN: Optional context management entries for this response request. 中文:此响应请求的可选上下文管理条目。

§moderation: Option<ResponseModeration>

EN: Optional moderation configuration for this response request. 中文:此响应请求的可选 moderation 配置。

§tools: Vec<Value>

EN: Optional tools the model may call while generating the response. 中文:模型生成响应时可以调用的可选工具列表。

§tool_choice: Option<ResponseToolChoice>

EN: Optional mode controlling whether the model may call tools. 中文:控制模型是否可以调用工具的可选模式。

§prompt: Option<ResponsePrompt>

EN: Optional reusable prompt template reference and variables. 中文:可选的可复用 prompt 模板引用及变量。

§max_output_tokens: Option<u32>

EN: Optional upper bound for generated output tokens. 中文:生成输出 token 数量的可选上限。

§store: Option<bool>

EN: Whether to store the generated response for later retrieval. 中文:是否存储生成的响应以便稍后检索。

§background: Option<bool>

EN: Whether to run the model response in the background. 中文:是否在后台运行模型响应。

§max_tool_calls: Option<u32>

EN: Optional maximum number of built-in tool calls for the response. 中文:响应中内置工具调用总次数的可选上限。

§metadata: BTreeMap<String, String>

EN: Optional metadata attached to the generated response. 中文:附加到生成响应的可选元数据。

§parallel_tool_calls: Option<bool>

EN: Whether to allow tool calls to run in parallel. 中文:是否允许并行运行工具调用。

§temperature: Option<f64>

EN: Optional sampling temperature. 中文:可选的采样温度。

§top_p: Option<f64>

EN: Optional nucleus sampling value. 中文:可选的 nucleus sampling 值。

§top_logprobs: Option<u8>

EN: Optional maximum number of top token log probabilities to return. 中文:可选的每个 token 位置返回的最高概率 token log probability 数量。

§reasoning: Option<ResponseReasoning>

EN: Optional reasoning configuration for reasoning-capable models. 中文:支持推理模型的可选推理配置。

§truncation: Option<ResponseTruncation>

EN: Optional context truncation strategy for the response. 中文:响应可选的上下文截断策略。

§prompt_cache_key: Option<String>

EN: Optional prompt cache bucketing key for similar requests. 中文:用于相似请求提示缓存分桶的可选键。

§prompt_cache_retention: Option<ResponsePromptCacheRetention>

EN: Optional retention policy for prompt cache entries created by this request. 中文:此请求创建的提示缓存条目的可选保留策略。

§safety_identifier: Option<String>

EN: Optional stable safety identifier for abuse detection. 中文:用于滥用检测的可选稳定安全标识符。

§service_tier: Option<ResponseServiceTier>

EN: Optional processing tier for serving the response request. 中文:用于处理响应请求的可选服务层级。

§include: Option<Vec<ResponseInclude>>

EN: Optional additional output data to include in the model response. 中文:要包含在模型响应中的可选额外输出数据。

§text: Option<ResponseTextConfig>

EN: Optional text generation configuration. 中文:可选的文本生成配置。

§stream_options: Option<StreamOptions>

EN: Optional streaming configuration used when streaming a response. 中文:流式响应时使用的可选流配置。

§stream: Option<bool>

EN: Optional stream flag set by streaming convenience methods. 中文:由流式便捷方法设置的可选 stream 标志。

§extra: BTreeMap<String, Value>

EN: Forward-compatible optional fields not yet covered by handwritten types. 中文:手写类型尚未覆盖的前向兼容可选字段。

Implementations§

Source§

impl CreateResponseRequest

Source

pub fn builder() -> CreateResponseRequestBuilder

EN: Starts building a create-response request. 中文:开始构建创建响应请求。

Trait Implementations§

Source§

impl Clone for CreateResponseRequest

Source§

fn clone(&self) -> CreateResponseRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateResponseRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CreateResponseRequest

Source§

fn eq(&self, other: &CreateResponseRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CreateResponseRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CreateResponseRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more