Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit bbbb431

Browse files
bobheadxivovakulikov
authored andcommitted
cody-gateway/embeddings: record input_character_count (#58054)
Records the raw character count of embeddings input, similar to how we record raw character counts for the completions handler.
1 parent 615098f commit bbbb431

File tree

1 file changed

+6
-0
lines changed
  • cmd/cody-gateway/internal/httpapi/embeddings

1 file changed

+6
-0
lines changed

cmd/cody-gateway/internal/httpapi/embeddings/handler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ func NewHandler(
105105
"resolved_status_code": resolvedStatusCode,
106106
codygateway.EmbeddingsTokenUsageMetadataField: usedTokens,
107107
"batch_size": len(body.Input),
108+
"input_character_count": func() (characters int) {
109+
for _, input := range body.Input {
110+
characters += len(input)
111+
}
112+
return characters
113+
}(),
108114
},
109115
},
110116
)

0 commit comments

Comments
 (0)