-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueryMany type error #38
Comments
Hello there, this is not an error maybe a misunderstading. Suppose you have something like this: const res = await index.queryMany<{
animal: string;
tags: string[];
diet: string;
}>([
{
vector: initialData[0].vector,
topK: 2,
filter: "tags[0] = 'mammal' AND diet = 'herbivore'",
includeMetadata: true,
},
{
vector: initialData[1].vector,
topK: 1,
filter: "tags[0] = 'mammal' AND diet = 'carnivore'",
includeMetadata: true,
},
]); When you say topK=2 and topK=1, you will get this: [
[
{
id: `id1`,
score: 1,
metadata: { animal: "elephant", tags: ["mammal"], diet: "herbivore" },
},
{
id: `id2`,
score: 1,
metadata: { animal: "elephant", tags: ["mammal"], diet: "herbivore" },
},
],
[
{
id: `id2-1`,
score: 1,
metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" },
},
],
] Your inner array has to match topK thats why we return list of lists. |
Sorry about initial phrasing, i meant if a list of queries with only one query is given to queryMany, response is same as if i send that query with query function.
Response: |
In this case, what you want to do is use |
If single query list is given to queryMany like
index.queryMany([{vector: [1, 0, 0], topK: 6}])
, return value is one dimensional list just as normal query function. Return type of queryMany is defined as two dimensional list.The text was updated successfully, but these errors were encountered: