I'm updating an existing piece of code to use Amazon Bedrock, and want to simply create embeddings from a set of documents and then store them in a Faiss vector store. I plan to maybe move this to OpenSearch once I get the basic code working.
The documents are created from a text file and the embeddings object is created using:
let embeddings = new BedrockEmbeddings({
region: process.env.BEDROCK_REGION,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
},
model: "amazon.titan-embed-text-v1"
});
Both docs and embeddings look fine - as I'd expect given that the code is already working with other LLMs.
However, when I try to create the vector store with
vectorStore = await FaissStore.fromDocuments(docs, embeddings);
I get the error below, which seems to suggest that the model identifier (amazon.titan-embed-text-v1) is wrong. Am I using a deprecated model or something?
{
error: ResourceNotFoundException: Could not resolve the foundation model from the provided model identifier.
at de_ResourceNotFoundExceptionRes (/var/www/src/conlucra/chat/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/protocols/Aws_restJson1.js:260:23)
at de_InvokeModelCommandError (/var/www/src/conlucra/chat/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/protocols/Aws_restJson1.js:92:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /var/www/src/conlucra/chat/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /var/www/src/conlucra/chat/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:30:20
at async /var/www/src/conlucra/chat/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
at async /var/www/src/conlucra/chat/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
at async /var/www/src/conlucra/chat/node_modules/langchain/dist/embeddings/bedrock.cjs:51:29
at async RetryOperation._fn (/var/www/src/conlucra/chat/node_modules/p-retry/index.js:50:12) {
'$fault': 'client',
'$metadata': {
httpStatusCode: 404,
requestId: 'cf74894d-8a14-4b54-bb20-ad06ba56cf79',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
}
}
}