Skip to content

Commit f69ee99

Browse files
committed
fix: reroute requests incoming from integrations for full compatibility in custom providers
1 parent cb49a71 commit f69ee99

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

core/providers/utils/utils.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,3 +1119,26 @@ func GetBudgetTokensFromReasoningEffort(
11191119

11201120
return budget, nil
11211121
}
1122+
<<<<<<< HEAD
1123+
=======
1124+
1125+
// ShouldAttemptIntegrationFallback checks if an integration fallback should be attempted.
1126+
// It returns:
1127+
// - modified context with fallback flag set (if fallback should proceed)
1128+
// - boolean indicating whether to proceed with fallback
1129+
func ShouldAttemptIntegrationFallback(ctx context.Context) (context.Context, bool) {
1130+
// Check if this is an integration request
1131+
if _, ok := ctx.Value(schemas.BifrostContextKeyIntegrationRequest).(bool); !ok {
1132+
return ctx, false
1133+
}
1134+
1135+
// Check if fallback has already been attempted
1136+
if attempted, _ := ctx.Value(schemas.BifrostContextKeyIntegrationFallbackAttempted).(bool); attempted {
1137+
return ctx, false
1138+
}
1139+
1140+
// Mark fallback as attempted and return modified context
1141+
ctx = context.WithValue(ctx, schemas.BifrostContextKeyIntegrationFallbackAttempted, true)
1142+
return ctx, true
1143+
}
1144+
>>>>>>> aed5a393 (fix: reroute requests incoming from integrations for full compatibility in custom providers)

0 commit comments

Comments
 (0)