Reputation: 1
- Engine: faiss
- Precision: Binary
- Dimensions: 1024
- Distance Type: hamming
- M: 16
- ef_construction: 16
- ef_search: 512
What I want to do is use the vector store instance to add vectors to it and use similarity search to get the relevant documents.
While trying to add the vectors, I didn't get any errors, but when checking it in dashboard, no vector is added. Also, while similarity search, an error is thrown, which I've put above (the query embedding is mysteriously 8192 dimensions whereas bedrock's titan model can only create embedding with 1024 dimensions max.)
To debug, I tried to create embeddings with just using BedrockEmbeddings, and I verified that the created embedding was 1024 dimensions to be precise.
const embeddings = new BedrockEmbeddings({
region: process.env.AWS_REGION,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
},
model: 'amazon.titan-embed-text-v2:0'
});
const vectorStore = new OpenSearchVectorStore(embeddings, {
client,
indexName: 'bedrock-knowledge-base-default-index',
vectorFieldName: 'bedrock-knowledge-base-default-vector',
service: 'aoss',
vectorSearchOptions: {
engine: 'hnsw'
}
});
const doc = await vectorStore.similaritySearch('what do you know about poc?', 1);
error ResponseError: search_phase_execution_exception: [query_shard_exception] Reason: failed to create query: Query vector has invalid dimension: 8192. Dimension should be: 1024
at onBody (/home/usr/Projects/backend/conversation/node_modules/@opensearch-project/opensearch/lib/Transport.js:426:23)
at IncomingMessage.onEnd (/home/usr/Projects/backend/conversation/node_modules/@opensearch-project/opensearch/lib/Transport.js:341:11)
at IncomingMessage.emit (node:events:531:35)
at IncomingMessage.emit (node:domain:488:12)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Dependencies:
@langchain/openai: >=0.1.0 <0.4.0 js-yaml: ^4.1.0 openapi-types: ^12.1.3 yaml: ^2.2.1
@langchain/textsplitters: >=0.0.0 <0.2.0 jsonpointer: ^5.0.1 p-retry: 4 zod-to-json-schema: ^3.22.3
js-tiktoken: ^1.0.12 langsmith: ^0.2.8 uuid: ^10.0.0 zod: ^3.22.4
Upvotes: 0
Views: 29