edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Cannot use `ext::ai::search` from the query builder

Open scotttrinh opened this issue 1 year ago • 2 comments

Code

e.ext.ai.search(e.SomeIndexedType, new Float32Array([0.0]));
// or with params, which type checks but does not work at query-build-time
e.params({ searchTerm: e.array(e.float32) }, (params) => e.ext.ai.search(
  e.SomeIndexedType,
  params.searchTerm
));

Error or desired behavior

No function overload found for 'e.ext.ai.search()' with args: Element: default::Post (Many), Element: arraystd::float32 (One)

Digging in here, it seems that in our functionality that compares the argument type to the function type definition, we end up casting the std::float32 to std::number and then comparing against std::float32 (which is false), and we are not generating an implicit cast map entry between std::float32 and std::number so that comparison is also returning false.

Versions (please complete the following information):

  • EdgeDB version (e.g. 2.0): 5.3
  • EdgeDB CLI version (e.g. 2.0): 5.2.0
  • edgedb-js version (e.g. 0.20.10;): 1.5.7
  • @edgedb/generate version (e.g. 0.0.7;): 0.5.3

scotttrinh avatar May 22 '24 17:05 scotttrinh

Hi, small up here. I currently use client.query(), but the missing typesafety is a real pain 🥲

hrasoa avatar Mar 20 '25 21:03 hrasoa

Thanks for the ping! I think a better alternative for now is to use the queries generator with an .edgeql file for this particular query until we get this resolved. It's definitely on the ASAP bug fix list, though!

scotttrinh avatar Mar 21 '25 01:03 scotttrinh