Skip to content

Commit

Permalink
Add OpenAI metrics collections
Browse files Browse the repository at this point in the history
  • Loading branch information
jinsongo committed May 8, 2024
1 parent e7a795e commit b8b59d2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public void export(

switch (metric.getDataCase()) {
case SUM:
if (metric.getName().compareTo("llm.watsonx.completions.tokens") == 0) {
if (metric.getName().compareTo("llm.watsonx.completions.tokens") == 0 ||
metric.getName().compareTo("llm.openai.chat_completions.tokens") == 0) {

List<NumberDataPoint> sumDataPoints = metric.getSum().getDataPointsList();
for (NumberDataPoint dataPoint : sumDataPoints) {
Expand Down Expand Up @@ -157,7 +158,8 @@ public void export(
}
break;
case HISTOGRAM:
if (metric.getName().compareTo("llm.watsonx.completions.duration") == 0) {
if (metric.getName().compareTo("llm.watsonx.completions.duration") == 0 ||
metric.getName().compareTo("llm.openai.chat_completions.duration") == 0) {

List<HistogramDataPoint> histDataPoints = metric.getHistogram().getDataPointsList();
for (HistogramDataPoint dataPoint : histDataPoints) {
Expand Down

0 comments on commit b8b59d2

Please sign in to comment.