Skip to content

Commit

Permalink
Be more defensive on handling chroma search results
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed Apr 23, 2023
1 parent 5294dd3 commit c38c623
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions langchain/src/vectorstores/chroma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ export class Chroma extends VectorStore {
const result = await collection.query(query, k);

const { ids, distances, documents, metadatas } = result;
if (!ids || !distances || !documents || !metadatas) {
return [];
}
// get the result data from the first and only query vector
const [firstIds] = ids;
const [firstDistances] = distances;
Expand Down

0 comments on commit c38c623

Please sign in to comment.