github-actions[bot] commented on code in PR #69046:
URL: https://github.com/apache/doris/pull/69046#discussion_r4312345780


##########
be/src/exprs/function/ai/ai_adapter.h:
##########
@@ -320,6 +371,10 @@ class AIAdapter {
 // The following adapters inherit from VoyageAIAdapter to directly reuse its 
embedding logic.
 class VoyageAIAdapter : public AIAdapter {
 public:
+    AIUsage parse_usage(const std::string& response_body) const override {
+        return parse_usage_fields(response_body, "usage", nullptr, nullptr, 
"total_tokens");

Review Comment:
   [P2] Preserve prompt-token usage for the Jina adapter
   
   `JinaAdapter` inherits this override, but [Jina's embedding response 
schema](https://api.jina.ai/docs) reports `usage.prompt_tokens` as well as 
`total_tokens`. Passing `nullptr` here discards that reported prompt count. 
With profiling enabled, a successful JINA `EMBED` response containing `usage: 
{prompt_tokens: 7, total_tokens: 7}` therefore produces 
`AIFunctionPromptTokens=0` and `AIFunctionPromptUsageCount=0` in both fragment 
details and the query summary, incorrectly marking supplied usage as unknown. 
Give Jina its own usage parser (or accept the optional prompt field here), and 
cover a JINA response containing both fields while keeping truly absent fields 
unknown.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to