Fix pgvector embedding format in recommender query
profile.embedding was being passed as str(numpy_array) which produces scientific notation format. pgvector needs [n1,n2,...] format. Now explicitly formats as comma-separated float list. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,9 +53,13 @@ async def get_recommendations(
|
|||||||
LIMIT :limit
|
LIMIT :limit
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Format embedding as pgvector literal: [n1,n2,...]
|
||||||
|
emb = profile.embedding
|
||||||
|
emb_str = "[" + ",".join(str(float(x)) for x in emb) + "]"
|
||||||
|
|
||||||
result = await session.execute(
|
result = await session.execute(
|
||||||
query,
|
query,
|
||||||
{"profile_embedding": str(profile.embedding), "limit": limit},
|
{"profile_embedding": emb_str, "limit": limit},
|
||||||
)
|
)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user