diff --git a/package.json b/package.json index 24a9df0..5db045a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@upstash/rag-chat", - "version": "0.0.32-alpha", + "version": "0.0.33-alpha", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/src/database.ts b/src/database.ts index a9bc415..218287a 100644 --- a/src/database.ts +++ b/src/database.ts @@ -88,17 +88,12 @@ export class Database { ); if (allValuesUndefined) { - throw new TypeError(` - Query to the vector store returned ${result.length} vectors but none had "${metadataKey}" field in their metadata. - Text of your vectors should be in the "${metadataKey}" field in the metadata for the RAG Chat. - `); + throw new TypeError("There is no answer for this question in the provided context."); } const facts = result .filter((x) => x.score >= similarityThreshold) - .map( - (embedding) => `- ${embedding.metadata?.[metadataKey] ?? ""}` - ); + .map((embedding) => `- ${embedding.metadata?.[metadataKey] ?? ""}`); return formatFacts(facts); }