Skip to content

Conversation

sheginabo
Copy link
Contributor

Description

This PR enhances the VoyageAIRerank functionality by exposing token usage information in the rerank results. Now, each returned Document in the rerank output includes a total_tokens field in its metadata, reflecting the number of tokens consumed during the reranking operation.

Details

The rerank result's Document.metadata now contains both relevance_score and total_tokens.
This allows downstream consumers to access token usage information for monitoring, analytics, or cost estimation purposes.
Unit tests have been updated to verify the presence and correctness of the total_tokens field in the rerank results.

@fzowl fzowl merged commit 37295e1 into voyage-ai:main May 3, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants