Closed onefanwu closed 4 months ago
My sql:
SELECT text_embedding('OLAP Database') AS embedding
You should import pkg that UDF used in the function.
@auxten Can you be more specific about packages I may have forgotten to import? I'm using similar code that works fine in duckdb and clickhouse, but it's not clear how UDFs that return Array(Float32) are defined in chdb.
I am uncertain about how to handle the input and output for the chdb UDF. @auxten Could you kindly provide an example where the UDF accepts a string as input and yields an Array of Float32 as output?
i think you just return embeddings_list
in your code.
here is a example
from chdb.udf import chdb_udf
from chdb.session import Session
@chdb_udf(return_type="Array(int)")
def atois(arg):
return [int(arg)]
with Session() as session:
ret = session.query("select atois('12')")
print(ret)
@nmreadelf Thank you. It worked for me.
I wrote this udf and I want to transform a batch of texts all into embedding vectors.
But I'm getting errors reported, and it seems that there is a problem with the handling on the return type.