@@ -378,18 +378,41 @@ type ImageURLStruct struct {
378
378
379
379
// BifrostResponse represents the complete result from any bifrost request.
380
380
type BifrostResponse struct {
381
- ID string `json:"id,omitempty"`
382
- Object string `json:"object,omitempty"` // text.completion, chat.completion, or embedding
383
- Choices []BifrostResponseChoice `json:"choices,omitempty"`
384
- Embedding [][]float32 `json:"data,omitempty"` // Maps to "data" field in provider responses (e.g., OpenAI embedding format)
385
- Speech * BifrostSpeech `json:"speech,omitempty"` // Maps to "speech" field in provider responses (e.g., OpenAI speech format)
386
- Transcribe * BifrostTranscribe `json:"transcribe,omitempty"` // Maps to "transcribe" field in provider responses (e.g., OpenAI transcription format)
387
- Model string `json:"model,omitempty"`
388
- Created int `json:"created,omitempty"` // The Unix timestamp (in seconds).
389
- ServiceTier * string `json:"service_tier,omitempty"`
390
- SystemFingerprint * string `json:"system_fingerprint,omitempty"`
391
- Usage * LLMUsage `json:"usage,omitempty"`
392
- ExtraFields BifrostResponseExtraFields `json:"extra_fields"`
381
+ ID string `json:"id,omitempty"`
382
+ Object string `json:"object,omitempty"` // text.completion, chat.completion, or embedding
383
+ Choices []BifrostResponseChoice `json:"choices,omitempty"`
384
+ Embedding [][]float32 `json:"data,omitempty"` // Maps to "data" field in provider responses (e.g., OpenAI embedding format)
385
+ Speech * BifrostSpeech `json:"speech,omitempty"` // Maps to "speech" field in provider responses (e.g., OpenAI speech format)
386
+ Transcribe * BifrostTranscribe `json:"transcribe,omitempty"` // Maps to "transcribe" field in provider responses (e.g., OpenAI transcription format)
387
+ Model string `json:"model,omitempty"`
388
+ Created int `json:"created,omitempty"` // The Unix timestamp (in seconds).
389
+ ServiceTier * string `json:"service_tier,omitempty"`
390
+ SystemFingerprint * string `json:"system_fingerprint,omitempty"`
391
+ Usage * LLMUsage `json:"usage,omitempty"`
392
+ PromptFilterResults * []PromptFilterResult `json:"prompt_filter_results,omitempty"` // Azure OpenAI Service
393
+ ExtraFields BifrostResponseExtraFields `json:"extra_fields"`
394
+ }
395
+
396
+ // FilterResult represents the result of a content filter.
397
+ type FilterResult struct {
398
+ Filtered bool `json:"filtered"`
399
+ Severity bool `json:"severity"`
400
+ }
401
+
402
+ // ContentFilterResult represents the result of a content filter.
403
+ type ContentFilterResult struct {
404
+ HateSpeech FilterResult `json:"hate_speech,omitempty"`
405
+ SelfHarm FilterResult `json:"self_harm,omitempty"`
406
+ Sexual FilterResult `json:"sexual,omitempty"`
407
+ Violence FilterResult `json:"violence,omitempty"`
408
+ Jailbreak FilterResult `json:"jailbreak,omitempty"`
409
+ Profanity FilterResult `json:"profanity,omitempty"`
410
+ }
411
+
412
+ // PromptFilterResult represents the result of a prompt filter.
413
+ type PromptFilterResult struct {
414
+ PromptIndex int `json:"prompt_index"`
415
+ ContentFilterResults * ContentFilterResult `json:"content_filter_results"`
393
416
}
394
417
395
418
// LLMUsage represents token usage information
@@ -401,6 +424,36 @@ type LLMUsage struct {
401
424
CompletionTokensDetails * CompletionTokensDetails `json:"completion_tokens_details,omitempty"`
402
425
}
403
426
427
+ func (u * LLMUsage ) Clone () * LLMUsage {
428
+ if u == nil {
429
+ return nil
430
+ }
431
+
432
+ ret := & LLMUsage {
433
+ PromptTokens : u .PromptTokens ,
434
+ CompletionTokens : u .CompletionTokens ,
435
+ TotalTokens : u .TotalTokens ,
436
+ }
437
+
438
+ if u .TokenDetails != nil {
439
+ ret .TokenDetails = & TokenDetails {
440
+ CachedTokens : u .TokenDetails .CachedTokens ,
441
+ AudioTokens : u .TokenDetails .AudioTokens ,
442
+ }
443
+ }
444
+
445
+ if u .CompletionTokensDetails != nil {
446
+ ret .CompletionTokensDetails = & CompletionTokensDetails {
447
+ ReasoningTokens : u .CompletionTokensDetails .ReasoningTokens ,
448
+ AudioTokens : u .CompletionTokensDetails .AudioTokens ,
449
+ AcceptedPredictionTokens : u .CompletionTokensDetails .AcceptedPredictionTokens ,
450
+ RejectedPredictionTokens : u .CompletionTokensDetails .RejectedPredictionTokens ,
451
+ }
452
+ }
453
+
454
+ return ret
455
+ }
456
+
404
457
type AudioLLMUsage struct {
405
458
InputTokens int `json:"input_tokens"`
406
459
InputTokensDetails * AudioTokenDetails `json:"input_tokens_details,omitempty"`
@@ -501,8 +554,9 @@ type Annotation struct {
501
554
// IMPORTANT: Only one of BifrostNonStreamResponseChoice or BifrostStreamResponseChoice
502
555
// should be non-nil at a time.
503
556
type BifrostResponseChoice struct {
504
- Index int `json:"index"`
505
- FinishReason * string `json:"finish_reason,omitempty"`
557
+ Index int `json:"index"`
558
+ FinishReason * string `json:"finish_reason,omitempty"`
559
+ ContentFilterResults * ContentFilterResult `json:"content_filter_results,omitempty"` // Azure OpenAI Service or DeepSeek
506
560
507
561
* BifrostNonStreamResponseChoice
508
562
* BifrostStreamResponseChoice
0 commit comments