feat: Add reranking functionality to Jina client

- Added a new `rerank` function to the Jina client for reranking documents.
- Added a new `RerankParams` struct to define parameters for reranking.
- Added unit tests for the new `rerank` function.
- Updated the example script to demonstrate reranking.
- Improved error handling and added more comprehensive logging.
This commit is contained in:
Mahmoud Emad
2025-03-11 19:27:01 +02:00
parent 7965883744
commit 0e1836c5d0
5 changed files with 131 additions and 32 deletions

View File

@@ -11,3 +11,12 @@ embeddings := jina_client.create_embeddings(
) or { panic('Error while creating embeddings: ${err}') }
println('Created embeddings: ${embeddings}')
rerank_result := jina_client.rerank(
model: .reranker_v2_base_multilingual
query: 'skincare products'
documents: ['Product A', 'Product B', 'Product C']
top_n: 2
) or { panic('Error while reranking: ${err}') }
println('Rerank result: ${rerank_result}')