wenjin272 commented on code in PR #861:
URL: https://github.com/apache/flink-agents/pull/861#discussion_r3527462853


##########
api/src/main/java/org/apache/flink/agents/api/chat/model/BaseChatModelSetup.java:
##########
@@ -116,7 +116,22 @@ public void open() throws Exception {
      * @param completionTokens the number of completion tokens
      */
     public void recordTokenMetrics(String modelName, long promptTokens, long 
completionTokens) {
-        FlinkAgentsMetricGroup metricGroup = getMetricGroup();
+        recordTokenMetrics(getMetricGroup(), modelName, promptTokens, 
completionTokens);
+    }
+
+    /**
+     * Record token usage metrics for the given model on the provided metric 
group.
+     *
+     * @param metricGroup the metric group captured when the request was 
initiated
+     * @param modelName the name of the model used
+     * @param promptTokens the number of prompt tokens
+     * @param completionTokens the number of completion tokens
+     */
+    public void recordTokenMetrics(
+            @Nullable FlinkAgentsMetricGroup metricGroup,

Review Comment:
   In practice, we now require that the `metricGroup` of the current action be 
passed in when reporting metrics. Therefore, I believe `metricGroup` should not 
be nullable.



##########
api/src/main/java/org/apache/flink/agents/api/chat/model/BaseChatModelSetup.java:
##########
@@ -116,7 +116,22 @@ public void open() throws Exception {
      * @param completionTokens the number of completion tokens
      */
     public void recordTokenMetrics(String modelName, long promptTokens, long 
completionTokens) {

Review Comment:
   It appears that only tests call this method, so I think it can be removed 
directly.



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