Skip to content

Commit

Permalink
OPIK-495 Don't return model and provider in payload instead of empty …
Browse files Browse the repository at this point in the history
…sting if missing (#764)
  • Loading branch information
BorisTkachenko authored Nov 29, 2024
1 parent ead9eee commit f1ffe14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,12 @@ private Publisher<Span> mapToDto(Result result) {
.filter(str -> !str.isBlank())
.map(JsonUtils::getJsonNodeFromString)
.orElse(null))
.model(row.get("model", String.class))
.provider(row.get("provider", String.class))
.model(StringUtils.isBlank(row.get("model", String.class))
? null
: row.get("model", String.class))
.provider(StringUtils.isBlank(row.get("provider", String.class))
? null
: row.get("provider", String.class))
.totalEstimatedCost(
row.get("total_estimated_cost", BigDecimal.class).compareTo(BigDecimal.ZERO) == 0
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3321,10 +3321,10 @@ Stream<Arguments> createAndGetCost() {
Arguments.of(Map.of("completion_tokens", Math.abs(podamFactory.manufacturePojo(Integer.class)),
"prompt_tokens", Math.abs(podamFactory.manufacturePojo(Integer.class))), "gpt-3.5-turbo-1106", metadata),
Arguments.of(Map.of("completion_tokens", Math.abs(podamFactory.manufacturePojo(Integer.class)),
"prompt_tokens", Math.abs(podamFactory.manufacturePojo(Integer.class))), "", metadata),
"prompt_tokens", Math.abs(podamFactory.manufacturePojo(Integer.class))), null, metadata),
Arguments.of(null, "gpt-3.5-turbo-1106", null),
Arguments.of(null, "unknown-model", null),
Arguments.of(null, "", null));
Arguments.of(null, null, null));
}

@Test
Expand Down

0 comments on commit f1ffe14

Please sign in to comment.