first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package vertex
import (
"github.com/maximhq/bifrost/core/schemas"
)
func (resp *VertexCountTokensResponse) ToBifrostCountTokensResponse(model string) *schemas.BifrostCountTokensResponse {
if resp == nil {
return nil
}
inputDetails := &schemas.ResponsesResponseInputTokens{}
inputTokens := int(resp.TotalTokens) // Vertex response typically represents prompt tokens for countTokens
total := int(resp.TotalTokens)
if resp.CachedContentTokenCount > 0 {
inputDetails.CachedReadTokens = int(resp.CachedContentTokenCount)
}
return &schemas.BifrostCountTokensResponse{
Model: model,
Object: "response.input_tokens",
InputTokens: inputTokens,
InputTokensDetails: inputDetails,
TotalTokens: &total,
}
}