feat: add Responses API compatibility
This commit is contained in:
@@ -70,6 +70,15 @@ func taskMetrics(task store.GatewayTask, user *auth.User, body map[string]any, c
|
||||
if response.ResponseDurationMS > 0 {
|
||||
metrics["responseDurationMs"] = response.ResponseDurationMS
|
||||
}
|
||||
if response.UpstreamProtocol != "" {
|
||||
metrics["upstreamProtocol"] = response.UpstreamProtocol
|
||||
metrics["upstreamEndpoint"] = response.UpstreamEndpoint
|
||||
metrics["responseConverted"] = response.ResponseConverted
|
||||
metrics["publicResponseId"] = response.PublicResponseID
|
||||
metrics["upstreamResponseId"] = response.UpstreamResponseID
|
||||
metrics["parentResponseId"] = response.ParentResponseID
|
||||
metrics["responseChainDepth"] = response.ResponseChainDepth
|
||||
}
|
||||
switch task.Kind {
|
||||
case "chat.completions", "responses":
|
||||
metrics["stream"] = boolFromMap(body, "stream")
|
||||
@@ -119,6 +128,16 @@ func attemptMetrics(candidate store.RuntimeModelCandidate, attemptNo int, simula
|
||||
"loadAvoided": candidate.LoadAvoided,
|
||||
"simulated": simulated,
|
||||
}
|
||||
if candidate.ResponseProtocol != "" {
|
||||
metrics["upstreamProtocol"] = candidate.ResponseProtocol
|
||||
if candidate.ResponseProtocol == clients.ProtocolOpenAIResponses {
|
||||
metrics["upstreamEndpoint"] = "/responses"
|
||||
metrics["responseConverted"] = false
|
||||
} else if candidate.ResponseProtocol == clients.ProtocolOpenAIChatCompletions {
|
||||
metrics["upstreamEndpoint"] = "/chat/completions"
|
||||
metrics["responseConverted"] = true
|
||||
}
|
||||
}
|
||||
if candidate.LoadLimited {
|
||||
metrics["loadMetrics"] = map[string]any{
|
||||
"rpm": map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user