Skip to content

Commit

Permalink
Needs processing of the reranking results because the native class is…
Browse files Browse the repository at this point in the history
… not JSON serializable #39
  • Loading branch information
MrCsabaToth committed Oct 19, 2024
1 parent 658fce5 commit 4e31f25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion functions/fn_impl/rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ def rerank(req: https_fn.Request) -> https_fn.Response:
)

response = client.rank(request=request)
rerankings = []
for item in response.records:
rerankings.append(dict(
id=item.id,
score=item.score,
))

return https_fn.Response(
json.dumps(dict(data=response)),
json.dumps(dict(data=rerankings)),
status=200,
content_type='application/json',
)

0 comments on commit 4e31f25

Please sign in to comment.