X
Xata3mo ago
Morgan

Type mismatch: expected vector..

Hey guys, so I have a table with a vector column with dimensions of 1536. Its naturally used to store embeddings generated via openai. Im able to save embeddings to this column via the Xata client. However.. when using the .ask method of the sdk.. im getting the following error: vector search: column [embedding]: type mismatch: expected vector (An array of floats with fixed dimension) code for reference:
const resp = await xata.db.Summary.ask(question, {
rules: ["..."],
sessionId,
searchType: "vector",
vectorSearch: {
column: "embedding",
contentColumn: "summary",
filter: {
user_id: userId,
},
},
});
const resp = await xata.db.Summary.ask(question, {
rules: ["..."],
sessionId,
searchType: "vector",
vectorSearch: {
column: "embedding",
contentColumn: "summary",
filter: {
user_id: userId,
},
},
});
Snapshot of table: https://imgur.com/eN5dU9i Hopefully someone can help out!
Imgur
4 Replies
kostas
kostas3mo ago
Hi, the ask request format looks good, same as the table format. Only thing that comes to mind could be an out of date client schema. Are you running the ask request in the Queries -> TypeScript section in the UI or in a client application? If it's in an app, have you run "xata codegen" to get the client generated using an up to date schema file? Can you try running the ask call in the Queries UI (which uses the latest refreshed client) and see if it works there? Which xata CLI and client version are you running? Note for postgres-enabled (beta) databases you'll need the @next version of the xata client: see https://xata.io/docs/postgres In case the issue can be reproduced in the Queries UI, could you please enable "Allow support to view your workspace" in Workspace Settings and let me know of your Workspace ID so we can investigate further.
Morgan
Morgan3mo ago
Hey, thanks for replying.. Im using Typescript.. i did run xata codegen i noticed it was not generating the vector property containing the dimensions after doing so. Im using Prisma so as per the docs the xata client is @Xata/client@next .. Ive managed a way around this for the time being using a new table with a link to the summary table.. however doing this then caused an issue on vector creation.. which in turn ive worked around by using a langchain prisma client that handles the vector creation for me. This was all for the hackathon.. so once ive finished my submission I will do a fully reproducible writeup with steps. I suspect its caused because im using Prisma with a direct connection and not the traditional connection.
kostas
kostas3mo ago
Thank you for the details! I suspect the vector type created by Prisma may not be compatible with the Xata client's expected vector type then. An issue with a writeup in then opensource client-ts repo https://github.com/xataio/client-ts/issues will help us investigate further.
Morgan
Morgan3mo ago
Yep! ill sort that out asap!
Want results from more Discord servers?
Add your server