Replies: 2 comments 2 replies
-
Hey @VijinV! 👋 I'm here to help you with your technical queries and bugs. I'm a bot that can assist you in solving issues, answering questions, and becoming a contributor. Let's tackle this bug together! The error you're encountering is due to a type mismatch between the To resolve this issue, you need to ensure that the
Here's a quick check you can add to ensure the import { validate as isUuid } from 'uuid';
export async function searchEmbeddingsByDomain(query: string, domainId: string, k: number = 5) {
try {
if (!isUuid(domainId)) {
throw new Error("Invalid domainId format. It must be a valid UUID.");
}
console.log("Searching for query:", query, "in domain:", domainId);
const results = await vectorStore.similaritySearch(query, k, { domainId: { equals: domainId } });
if (!results || !Array.isArray(results)) {
console.warn("No results found or unexpected response format.");
return [];
}
const relevantResults = results.map(result => result.pageContent ?? result);
console.log("Relevant results:", relevantResults);
return relevantResults;
} catch (error) {
console.error("Error searching embeddings:", error);
return [];
}
} This code uses the npm install uuid By ensuring the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
Hi @VijinV as mentionned by the @dosu. the Issue is due to typecasting mismatch indicating that You might need to add explicit type casts. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
Searching for query: hi in domain: ed5c6c28-fce7-4850-b743-f1983b3dbb0c
(node:4092) [DEP0040] DeprecationWarning: The
punycode
module is deprecated. Please use a userland alternative instead.(Use
node --trace-deprecation ...
to show where the warning was created)Error searching embeddings: PrismaClientKnownRequestError:
Invalid
prisma.$queryRaw()
invocation:Raw query failed. Code:
42883
. Message:ERROR: operator does not exist: uuid = text HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
at In.handleRequestError (D:\WORK\Website-Chatbot\node_modules@prisma\client\runtime\library.js:122:6854)
at In.handleAndLogRequestError (D:\WORK\Website-Chatbot\node_modules@prisma\client\runtime\library.js:122:6188)
at In.request (D:\WORK\Website-Chatbot\node_modules@prisma\client\runtime\library.js:122:5896)
at async l (D:\WORK\Website-Chatbot\node_modules@prisma\client\runtime\library.js:127:11167)
at async PrismaVectorStore.similaritySearchVectorWithScore (D:\WORK\Website-Chatbot.next\server\chunks\ssr\node_modules_7a5bee..js:18529:26)
at async PrismaVectorStore.similaritySearch (D:\WORK\Website-Chatbot.next\server\chunks\ssr\node_modules_7a5bee..js:18501:25)
at async searchEmbeddingsByDomain (D:\WORK\Website-Chatbot.next\server\chunks\ssr[root of the server]__c5e9b0._.js:1479:25) {
code: 'P2010',
clientVersion: '5.13.0',
meta: {
code: '42883',
message: 'ERROR: operator does not exist: uuid = text\n' +
'HINT: No operator matches the given name and argument types. You might need to add explicit type casts.'
}
}
##The issue happens when trying to filter by domainId in the similaritySearch function.
can anyone help me to solve this issue
System Info
Prisma version: 5.13.0
OS: Windows
Beta Was this translation helpful? Give feedback.
All reactions