pub struct OpenAIModelConfigBuilder<S: State = Empty> { /* private fields */ }Expand description
Use builder syntax to set the inputs and finish with build().
Implementations§
Source§impl<S: State> OpenAIModelConfigBuilder<S>
impl<S: State> OpenAIModelConfigBuilder<S>
Sourcepub fn build(self) -> OpenAIModelConfigwhere
S: IsComplete,
pub fn build(self) -> OpenAIModelConfigwhere
S: IsComplete,
Finish building and return the requested object
Sourcepub fn model_id(
self,
value: impl Into<String>,
) -> OpenAIModelConfigBuilder<SetModelId<S>>where
S::ModelId: IsUnset,
pub fn model_id(
self,
value: impl Into<String>,
) -> OpenAIModelConfigBuilder<SetModelId<S>>where
S::ModelId: IsUnset,
Sourcepub fn maybe_model_id(
self,
value: Option<impl Into<String>>,
) -> OpenAIModelConfigBuilder<SetModelId<S>>where
S::ModelId: IsUnset,
pub fn maybe_model_id(
self,
value: Option<impl Into<String>>,
) -> OpenAIModelConfigBuilder<SetModelId<S>>where
S::ModelId: IsUnset,
Sourcepub fn max_tokens(self, value: u64) -> OpenAIModelConfigBuilder<SetMaxTokens<S>>where
S::MaxTokens: IsUnset,
pub fn max_tokens(self, value: u64) -> OpenAIModelConfigBuilder<SetMaxTokens<S>>where
S::MaxTokens: IsUnset,
Sourcepub fn maybe_max_tokens(
self,
value: Option<u64>,
) -> OpenAIModelConfigBuilder<SetMaxTokens<S>>where
S::MaxTokens: IsUnset,
pub fn maybe_max_tokens(
self,
value: Option<u64>,
) -> OpenAIModelConfigBuilder<SetMaxTokens<S>>where
S::MaxTokens: IsUnset,
Sourcepub fn temperature(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
pub fn temperature(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
Sourcepub fn maybe_temperature(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
pub fn maybe_temperature(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetTemperature<S>>where
S::Temperature: IsUnset,
Sourcepub fn top_p(self, value: f64) -> OpenAIModelConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
pub fn top_p(self, value: f64) -> OpenAIModelConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
Sourcepub fn maybe_top_p(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
pub fn maybe_top_p(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetTopP<S>>where
S::TopP: IsUnset,
Sourcepub fn context_window_limit(
self,
value: u64,
) -> OpenAIModelConfigBuilder<SetContextWindowLimit<S>>where
S::ContextWindowLimit: IsUnset,
pub fn context_window_limit(
self,
value: u64,
) -> OpenAIModelConfigBuilder<SetContextWindowLimit<S>>where
S::ContextWindowLimit: IsUnset,
Sourcepub fn maybe_context_window_limit(
self,
value: Option<u64>,
) -> OpenAIModelConfigBuilder<SetContextWindowLimit<S>>where
S::ContextWindowLimit: IsUnset,
pub fn maybe_context_window_limit(
self,
value: Option<u64>,
) -> OpenAIModelConfigBuilder<SetContextWindowLimit<S>>where
S::ContextWindowLimit: IsUnset,
Sourcepub fn model_info(
self,
value: ModelInfo,
) -> OpenAIModelConfigBuilder<SetModelInfo<S>>where
S::ModelInfo: IsUnset,
pub fn model_info(
self,
value: ModelInfo,
) -> OpenAIModelConfigBuilder<SetModelInfo<S>>where
S::ModelInfo: IsUnset,
Sourcepub fn maybe_model_info(
self,
value: Option<ModelInfo>,
) -> OpenAIModelConfigBuilder<SetModelInfo<S>>where
S::ModelInfo: IsUnset,
pub fn maybe_model_info(
self,
value: Option<ModelInfo>,
) -> OpenAIModelConfigBuilder<SetModelInfo<S>>where
S::ModelInfo: IsUnset,
Sourcepub fn params(self, value: JsonValue) -> OpenAIModelConfigBuilder<SetParams<S>>where
S::Params: IsUnset,
pub fn params(self, value: JsonValue) -> OpenAIModelConfigBuilder<SetParams<S>>where
S::Params: IsUnset,
Optional (Some / Option setters).
Extra request fields, for parameters without a config field. Built-in Responses tools go
here, before the agent’s tools: {"tools": [{"type": "web_search"}]}. The provider
manages model, messages and stream (Chat Completions) and model, input, stream
and store (Responses); a warning is logged when params holds any of them, and the
provider’s values win. Chat Completions sends stream_options: {"include_usage": true}
unless params sets it, and omits any params key set to null, such as
"stream_options": null for compatible endpoints that reject the field; without
include_usage, the endpoint may not report usage. Must be a JSON object, such as a
json!({..}) literal.
Sourcepub fn maybe_params(
self,
value: Option<JsonValue>,
) -> OpenAIModelConfigBuilder<SetParams<S>>where
S::Params: IsUnset,
pub fn maybe_params(
self,
value: Option<JsonValue>,
) -> OpenAIModelConfigBuilder<SetParams<S>>where
S::Params: IsUnset,
Optional (Some / Option setters).
Extra request fields, for parameters without a config field. Built-in Responses tools go
here, before the agent’s tools: {"tools": [{"type": "web_search"}]}. The provider
manages model, messages and stream (Chat Completions) and model, input, stream
and store (Responses); a warning is logged when params holds any of them, and the
provider’s values win. Chat Completions sends stream_options: {"include_usage": true}
unless params sets it, and omits any params key set to null, such as
"stream_options": null for compatible endpoints that reject the field; without
include_usage, the endpoint may not report usage. Must be a JSON object, such as a
json!({..}) literal.
Sourcepub fn cache_config(
self,
value: CacheConfig,
) -> OpenAIModelConfigBuilder<SetCacheConfig<S>>where
S::CacheConfig: IsUnset,
pub fn cache_config(
self,
value: CacheConfig,
) -> OpenAIModelConfigBuilder<SetCacheConfig<S>>where
S::CacheConfig: IsUnset,
Optional (Some / Option setters).
Prompt caching. On the Responses API, models whose model info says they take cache points
(GPT-5.6 and later) cache durable conversation prefixes before temporary context;
messages_ttl: false turns that off. There, a "30m" or "12h" messages_ttl sets each
checkpoint’s ttl, and such a ttl sets prompt_cache_options.ttl. Older models and Chat
Completions cache implicitly. cache_key maps to prompt_cache_key and the retention
literals ("in_memory", "24h") to prompt_cache_retention. Caching fields in params win.
Checkpoints do not remove injected content that a stateful server-side conversation keeps.
Sourcepub fn maybe_cache_config(
self,
value: Option<CacheConfig>,
) -> OpenAIModelConfigBuilder<SetCacheConfig<S>>where
S::CacheConfig: IsUnset,
pub fn maybe_cache_config(
self,
value: Option<CacheConfig>,
) -> OpenAIModelConfigBuilder<SetCacheConfig<S>>where
S::CacheConfig: IsUnset,
Optional (Some / Option setters).
Prompt caching. On the Responses API, models whose model info says they take cache points
(GPT-5.6 and later) cache durable conversation prefixes before temporary context;
messages_ttl: false turns that off. There, a "30m" or "12h" messages_ttl sets each
checkpoint’s ttl, and such a ttl sets prompt_cache_options.ttl. Older models and Chat
Completions cache implicitly. cache_key maps to prompt_cache_key and the retention
literals ("in_memory", "24h") to prompt_cache_retention. Caching fields in params win.
Checkpoints do not remove injected content that a stateful server-side conversation keeps.
Sourcepub fn frequency_penalty(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetFrequencyPenalty<S>>where
S::FrequencyPenalty: IsUnset,
pub fn frequency_penalty(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetFrequencyPenalty<S>>where
S::FrequencyPenalty: IsUnset,
Sourcepub fn maybe_frequency_penalty(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetFrequencyPenalty<S>>where
S::FrequencyPenalty: IsUnset,
pub fn maybe_frequency_penalty(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetFrequencyPenalty<S>>where
S::FrequencyPenalty: IsUnset,
Sourcepub fn presence_penalty(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetPresencePenalty<S>>where
S::PresencePenalty: IsUnset,
pub fn presence_penalty(
self,
value: f64,
) -> OpenAIModelConfigBuilder<SetPresencePenalty<S>>where
S::PresencePenalty: IsUnset,
Sourcepub fn maybe_presence_penalty(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetPresencePenalty<S>>where
S::PresencePenalty: IsUnset,
pub fn maybe_presence_penalty(
self,
value: Option<f64>,
) -> OpenAIModelConfigBuilder<SetPresencePenalty<S>>where
S::PresencePenalty: IsUnset,
Sourcepub fn stateful(self, value: bool) -> OpenAIModelConfigBuilder<SetStateful<S>>where
S::Stateful: IsUnset,
pub fn stateful(self, value: bool) -> OpenAIModelConfigBuilder<SetStateful<S>>where
S::Stateful: IsUnset,
Optional (Some / Option setters).
Whether the server manages conversation state (Responses API only): requests set
store: true and chain turns through previous_response_id, and the agent keeps no local
history. Default false, which sends the whole history on every turn. Set at construction;
OpenAIModel::update_config ignores it with a warning.
Sourcepub fn maybe_stateful(
self,
value: Option<bool>,
) -> OpenAIModelConfigBuilder<SetStateful<S>>where
S::Stateful: IsUnset,
pub fn maybe_stateful(
self,
value: Option<bool>,
) -> OpenAIModelConfigBuilder<SetStateful<S>>where
S::Stateful: IsUnset,
Optional (Some / Option setters).
Whether the server manages conversation state (Responses API only): requests set
store: true and chain turns through previous_response_id, and the agent keeps no local
history. Default false, which sends the whole history on every turn. Set at construction;
OpenAIModel::update_config ignores it with a warning.
Auto Trait Implementations§
impl<S> Freeze for OpenAIModelConfigBuilder<S>
impl<S> RefUnwindSafe for OpenAIModelConfigBuilder<S>
impl<S> Send for OpenAIModelConfigBuilder<S>
impl<S> Sync for OpenAIModelConfigBuilder<S>
impl<S> Unpin for OpenAIModelConfigBuilder<S>
impl<S> UnsafeUnpin for OpenAIModelConfigBuilder<S>
impl<S> UnwindSafe for OpenAIModelConfigBuilder<S>
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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