joeyutong commented on code in PR #870:
URL: https://github.com/apache/flink-agents/pull/870#discussion_r3592370239


##########
api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelSetup.java:
##########
@@ -104,9 +104,18 @@ public float[] embed(String text) {
     }
 
     public float[] embed(String text, Map<String, Object> parameters) {
+        return embedWithUsage(text, parameters).getEmbeddings();

Review Comment:
   Could we preserve the existing `embed(...)` dispatch here and call 
`getConnection().embed(...)` directly? With the current delegation, a subclass 
of a usage-aware provider connection that overrides the existing `embed(...)` 
method is bypassed, because providers such as OpenAI, Tongyi, and Bedrock 
override `embedWithUsage(...)` and perform the request there. The Python setup 
has the same pattern. Since plain `embed(...)` does not consume usage, mapping 
the two setup APIs directly to the corresponding connection APIs would preserve 
the existing extension point.



-- 
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]

Reply via email to