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:
@@ -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}')
|
||||
|
||||
Reference in New Issue
Block a user