pub struct BedrockEmbedder { /* private fields */ }Expand description
Embeddings through Amazon Bedrock’s InvokeModel.
§Why this exists beside the OpenAI-compatible one
Bedrock is the deployment that cannot reach the other driver: a plane chosen
for Bedrock was usually chosen because its data may not leave a particular
account, and telling it to call api.openai.com for the query text is the
one thing it cannot do. Without this, semantic retrieval was unavailable to
exactly the regulated deployments this crate is built for — the AWS SDK
already being paid for by the bedrock feature.
Implementations§
Source§impl BedrockEmbedder
impl BedrockEmbedder
Sourcepub async fn from_env(
region: impl Into<String>,
model: impl Into<String>,
dialect: EmbeddingDialect,
) -> Result<Self, StoreError>
pub async fn from_env( region: impl Into<String>, model: impl Into<String>, dialect: EmbeddingDialect, ) -> Result<Self, StoreError>
Load the standard AWS credential chain for this region.
The same chain Bedrock::from_env
documents, Bedrock API keys included — they cover InvokeModel.
§Errors
If the region is blank.
Sourcepub fn from_client(
client: Client,
model: impl Into<String>,
dialect: EmbeddingDialect,
) -> Result<Self, StoreError>
pub fn from_client( client: Client, model: impl Into<String>, dialect: EmbeddingDialect, ) -> Result<Self, StoreError>
Build from an already configured AWS client.
The region is read from the client, not accepted beside it. It is
half of Embedder::revision, which decides whether a stored vector
belongs to the index being queried — so a region taken as a separate
argument is a second copy of a fact the client already holds, free to
disagree with the service the vectors actually came from. Two indexes
built in different regions would then share one revision and be treated
as comparable.
§Errors
If the client carries no region, or a blank one.
Sourcepub const fn dimensions(self, dimensions: u32) -> Self
pub const fn dimensions(self, dimensions: u32) -> Self
Ask Titan for a shortened vector.
Titan v2 accepts 256, 512 or 1024. Cohere does not take the parameter at all, so setting it there is refused rather than ignored — a ceiling that silently does nothing is the shape this crate refuses everywhere else.
Trait Implementations§
Source§impl Clone for BedrockEmbedder
impl Clone for BedrockEmbedder
Source§impl Debug for BedrockEmbedder
impl Debug for BedrockEmbedder
Source§impl Embedder for BedrockEmbedder
impl Embedder for BedrockEmbedder
Source§fn revision(&self) -> String
fn revision(&self) -> String
Region, model and width.
The region is in it because a Bedrock model id names a model, not a deployment: the same id in two regions is two services, and a vector from one has no standing in an index built from the other. It is also the fact a compliance reader most wants on the record.
Auto Trait Implementations§
impl !RefUnwindSafe for BedrockEmbedder
impl !UnwindSafe for BedrockEmbedder
impl Freeze for BedrockEmbedder
impl Send for BedrockEmbedder
impl Sync for BedrockEmbedder
impl Unpin for BedrockEmbedder
impl UnsafeUnpin for BedrockEmbedder
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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