embed

open suspend override fun embed(text: String, model: LLModel): List<Double>(source)

Embeds the given text using the AWS Bedrock InvokeModel API.

Supports Amazon Titan Embed (v1 and v2) and Cohere embedding model families.

Return

A list of floating-point values representing the embedding vector.

Parameters

text

The text to embed.

model

The model to use for embedding. Must have the LLMCapability.Embed capability.

Throws

if the model does not have the Embed capability.

if the model family does not support embeddings.


open suspend override fun embed(inputs: List<String>, model: LLModel): List<List<Double>>(source)

Batch embedding is not currently supported by the Bedrock client.

Throws