An embed function supplied by the consumer on a vector index definition. Takes the text to embed and resolves to the embedding vector, which must have the dimensions declared by the index's EmbeddingModelDescriptor.
Usage example (consumer-owned Bedrock provider):
const provider: EmbeddingProvider = async text => { const res = await bedrock.send( new InvokeModelCommand({ modelId: TitanTextEmbedV2.name, body: JSON.stringify({ inputText: text }) }) ); return JSON.parse(new TextDecoder().decode(res.body)).embedding;}; Copy
const provider: EmbeddingProvider = async text => { const res = await bedrock.send( new InvokeModelCommand({ modelId: TitanTextEmbedV2.name, body: JSON.stringify({ inputText: text }) }) ); return JSON.parse(new TextDecoder().decode(res.body)).embedding;};
An embed function supplied by the consumer on a vector index definition. Takes the text to embed and resolves to the embedding vector, which must have the dimensions declared by the index's EmbeddingModelDescriptor.
Usage example (consumer-owned Bedrock provider):