weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Unknown argument "nearText" on field #59

Closed alonbg closed 1 year ago

alonbg commented 1 year ago

v1.3.1

seems nearText is not properly validated although supported. either raw or api

const query =  '{Get{ Image(limit:3, bm25: {query:"sunglasses"}){url, _additional{score}}}}'

async function nearTextQueryRaw() {
    const res = await client
      .graphql
      .raw()
      .withQuery(query)
      .do();
    console.log(JSON.stringify(res));
    return res;
  }

async function nearTextQuery() {
  const res = await client.graphql
    .get()
    .withClassName('Article')
    .withFields('functional fictional')
    .withNearText({'concepts': ['sun',  'tree']})
    .withLimit(2)
    .do();

  console.log(JSON.stringify(res, null, 2));
  return res
}
ClientError: Unknown argument "nearText" on field "Article" of type "GetObjectsObj". Did you mean "nearVector" or "nearObject"?: {"response":{"errors":[{"locations":[{"column":14,"line":1}],"message":"Unknown argument \"nearText\" on field \"Article\" of type \"GetObjectsObj\". Did you mean \"nearVector\" or \"nearObject\"?","path":null}],"status":200,"headers":{}},"request":{"query":"{Get{Article(nearText:{concepts:[\"sun\",\"tree\"]},limit:2){functional fictional}}}"}}
    at makeRequest (/****/node_modules/weaviate-ts-client/node_modules/graphql-request/build/cjs/index.js:314:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  response: {
    errors: [
      {
        locations: [ { column: 14, line: 1 } ],
        message: 'Unknown argument "nearText" on field "Article" of type "GetObjectsObj". Did you mean "nearVector" or "nearObject"?',
        path: null
      }
    ]
     status: 200,
   ****
      }
    }
  },
  request: {
    query: '{Get{Article(nearText:{concepts:["sun","tree"]},limit:2){functional fictional}}}',
    variables: undefined
  }
}
alonbg commented 1 year ago

not an issue this error comes from the remote - as not all vectorizers support all gql search terms. I checked it on my local with text2vec-contextionary and it works fine.