Hi,
I’m working with vector searches in Redis. I’ve been able to use the Redis library and Janus to create document vectors (using sentence_transformers) in Redis as JSON objects. And I’m able to create a Redis index.
When it comes to searching, Redis requires that the query vector be provided as a binary blob. In Python it looks like this:
res = r.ft("doc_idx").search(q, query_params={"vec": model.encode(sentence).astype(np.float32).tobytes()})
Note tobytes()
which returns a Python bytes
object.
Is there an equivalent in SWI Prolog? Alternatively, if I have a ref to a Python blob (via Janus, obtained by py_call
with py_object(true)
option), I’m not clear on how I can serialize that out to Redis, in Prolog. If I don’t use py_object(true)
, then I get a list of integers (the bytes) back from Janus. Can that be blobbified somehow?
Thanks.