Quantcast
Channel: Weaviate Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 3588

WeaviateQueryError when using JS/TS client to query named vectors - class has multiple vectors, but no target vectors were provided

$
0
0

Hi @Kyle_Xiong, welcome to the community!

It looks to me like you are using the .generate.nearText function incorrectly. This is its type signature:

* @param {string | string[]} query - The query to search for.
  * @param {GenerateOptions<T>} generate - The available options for performing the generation.
  * @param {NearTextOptions<T>} [opts] - The available options for performing the near-text search.
  * @return {GenerateReturn<T>} - The results of the search including the generated data.
  */
nearText(
  query: string | string[],
  generate: GenerateOptions<T>,
  opts?: NearTextOptions<T>
): GenerateReturn<T>;

showing that it accepts at least two and at most three arguments. The second argument is a required object in which you supply your generative options with the third argument as an optional object in which you supply any of the parameters you would also in the query namespace methods.

So for your example, if you try the following then it will work:

const response = await collection.generate.nearText(query, {
  groupedTask: `<task_prompt>`,
}, {
  limit: 5,
  targetVector: "keywords"
})

Usually such an error with the API usage would be caught by the TS compiler. Do you perhaps have it disabled or are you working in JS?

Also, I do not understand why your provided query worked with older Weaviate versions but suddenly failer on a newer one. It could be that there was some implicit behaviour on the server that was being activated by the query you were sending that allowed it to succeed!

I hope this helps, if not then let me know!


Viewing all articles
Browse latest Browse all 3588

Trending Articles