Skip to content

Commit

Permalink
Fix a limit error for fetching embeddings for semanticSort.
Browse files Browse the repository at this point in the history
Same problem as in #691. Also relevant for #688.
  • Loading branch information
jkomoros committed Apr 14, 2024
1 parent 9a9b032 commit 567aee3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions functions/src/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import {
} from 'firebase-functions/v2/https';
import { Timestamp } from 'firebase-admin/firestore';

//The highest number of cards there might ever be.
const MAX_EMBEDDINGS = 100000;

const DOM = new JSDOM();

const QDRANT_ENABLED = openai_endpoint && QDRANT_API_KEY && QDRANT_CLUSTER_URL;
Expand Down Expand Up @@ -308,6 +311,7 @@ class EmbeddingStore {
}
]
},
limit: MAX_EMBEDDINGS,
with_vector: true
});
return Object.fromEntries(existingPoints.points.map(point => {
Expand Down Expand Up @@ -458,9 +462,6 @@ export const processCardEmbedding = async (event : FirestoreEvent<Change<Documen

const TOO_MANY_ERRORS = 5;

//The highest number of cards there might ever be.
const MAX_EMBEDDINGS = 100000;

export const reindexCardEmbeddings = async () : Promise<void> => {
if (!EMBEDDING_STORE) {
console.warn('Qdrant not enabled, skipping');
Expand Down

0 comments on commit 567aee3

Please sign in to comment.