pub struct BedrockModelOptions {Show 22 fields
pub model_id: Option<String>,
pub max_tokens: Option<u64>,
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub context_window_limit: Option<u64>,
pub model_info: Option<ModelInfo>,
pub stop_sequences: Option<Vec<String>>,
pub cache_config: Option<BedrockCacheConfig>,
pub additional_request_fields: Option<JsonValue>,
pub additional_response_field_paths: Option<Vec<String>>,
pub additional_args: Option<JsonValue>,
pub stream: Option<bool>,
pub include_tool_result_status: Option<IncludeToolResultStatus>,
pub guardrail_config: Option<BedrockGuardrailConfig>,
pub use_native_token_count: Option<bool>,
pub strict_tools: Option<bool>,
pub region: Option<String>,
pub endpoint_url: Option<String>,
pub credentials_provider: Option<SharedCredentialsProvider>,
pub sdk_config: Option<SdkConfig>,
pub request_timeout: Option<Duration>,
pub api_key: Option<String>,
}Expand description
Options for creating a BedrockModel (BedrockModelOptions): the BedrockModelConfig
fields plus how the AWS client is built.
The client is built on first use from the AWS default chain (environment, shared config and
credential files, SSO, IMDS), layered with these options. Without a region from the options,
sdk_config or the environment, the region is us-west-2. An AWS_BEARER_TOKEN_BEDROCK
environment variable selects API key authentication, as in the AWS SDKs.
BedrockModel::builder starts this builder; its build() returns the model and
build_options() the options.
use std::time::Duration;
use strands::models::bedrock::BedrockModel;
let model = BedrockModel::builder()
.model_id("us.amazon.nova-lite-v1:0")
.max_tokens(512)
.region("us-east-1")
.request_timeout(Duration::from_secs(300))
.build();
assert_eq!(model.config().model_id.as_deref(), Some("us.amazon.nova-lite-v1:0"));Fields§
§model_id: Option<String>§max_tokens: Option<u64>§temperature: Option<f64>§top_p: Option<f64>§context_window_limit: Option<u64>§model_info: Option<ModelInfo>§stop_sequences: Option<Vec<String>>§cache_config: Option<BedrockCacheConfig>§additional_request_fields: Option<JsonValue>§additional_response_field_paths: Option<Vec<String>>§additional_args: Option<JsonValue>§stream: Option<bool>§include_tool_result_status: Option<IncludeToolResultStatus>§guardrail_config: Option<BedrockGuardrailConfig>§use_native_token_count: Option<bool>§strict_tools: Option<bool>§region: Option<String>AWS region of the Bedrock endpoint; wins over sdk_config and the environment.
endpoint_url: Option<String>Endpoint URL override, such as a VPC endpoint.
credentials_provider: Option<SharedCredentialsProvider>Credentials provider, replacing the default chain. This AWS SDK type is part of the public API as an escape hatch.
sdk_config: Option<SdkConfig>Shared AWS configuration to build the client from instead of loading the default chain: HTTP client, retry, timeout and stall settings, credentials and region. This AWS SDK type is part of the public API as an escape hatch.
request_timeout: Option<Duration>Time each attempt may take until the response arrives, and the stream inactivity before a
request is aborted. It replaces an operation attempt timeout set in sdk_config and keeps its
other timeouts. Default DEFAULT_REQUEST_TIMEOUT.
api_key: Option<String>Amazon Bedrock API key: requests use bearer token authentication instead of SigV4.
Implementations§
Source§impl BedrockModelOptions
impl BedrockModelOptions
Sourcepub fn builder() -> BedrockModelOptionsBuilder
pub fn builder() -> BedrockModelOptionsBuilder
Create an instance of BedrockModelOptions using the builder syntax
Source§impl BedrockModelOptions
impl BedrockModelOptions
Sourcepub fn to_config(&self) -> BedrockModelConfig
pub fn to_config(&self) -> BedrockModelConfig
The model configuration part of the options.
Trait Implementations§
Source§impl Clone for BedrockModelOptions
impl Clone for BedrockModelOptions
Source§impl Debug for BedrockModelOptions
impl Debug for BedrockModelOptions
Source§impl Default for BedrockModelOptions
impl Default for BedrockModelOptions
Source§impl From<BedrockModelConfig> for BedrockModelOptions
impl From<BedrockModelConfig> for BedrockModelOptions
Source§fn from(config: BedrockModelConfig) -> Self
fn from(config: BedrockModelConfig) -> Self
Source§impl From<BedrockModelOptions> for BedrockModel
impl From<BedrockModelOptions> for BedrockModel
Source§fn from(options: BedrockModelOptions) -> Self
fn from(options: BedrockModelOptions) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for BedrockModelOptions
impl !UnwindSafe for BedrockModelOptions
impl Freeze for BedrockModelOptions
impl Send for BedrockModelOptions
impl Sync for BedrockModelOptions
impl Unpin for BedrockModelOptions
impl UnsafeUnpin for BedrockModelOptions
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,
§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