Skip to main content

BedrockModelOptions

Struct BedrockModelOptions 

Source
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

Source

pub fn builder() -> BedrockModelOptionsBuilder

Create an instance of BedrockModelOptions using the builder syntax

Source§

impl BedrockModelOptions

Source

pub fn to_config(&self) -> BedrockModelConfig

The model configuration part of the options.

Trait Implementations§

Source§

impl Clone for BedrockModelOptions

Source§

fn clone(&self) -> Self

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 BedrockModelOptions

Source§

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

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

impl Default for BedrockModelOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<BedrockModelConfig> for BedrockModelOptions

Source§

fn from(config: BedrockModelConfig) -> Self

Converts to this type from the input type.
Source§

impl From<BedrockModelOptions> for BedrockModel

Source§

fn from(options: BedrockModelOptions) -> Self

Converts to this type from the input type.

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

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

§

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
§

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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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