fix(openai_compat): support prompt_cache_key for Azure OpenAI endpoints
Azure OpenAI (*.openai.azure.com) also supports prompt_cache_key, so extend the allowlist to match Azure endpoints alongside api.openai.com. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
39a451d312
commit
962bc851e3
2 changed files with 6 additions and 3 deletions
|
|
@ -480,8 +480,9 @@ func asFloat(v any) (float64, bool) {
|
|||
|
||||
// supportsPromptCacheKey reports whether the given API base is known to
|
||||
// support the prompt_cache_key request field. Currently only OpenAI's own
|
||||
// API supports this. All other OpenAI-compatible providers (Mistral,
|
||||
// Gemini, DeepSeek, Groq, etc.) reject unknown fields with 422 errors.
|
||||
// API and Azure OpenAI support this. All other OpenAI-compatible providers
|
||||
// (Mistral, Gemini, DeepSeek, Groq, etc.) reject unknown fields with 422 errors.
|
||||
func supportsPromptCacheKey(apiBase string) bool {
|
||||
return strings.Contains(apiBase, "api.openai.com")
|
||||
return strings.Contains(apiBase, "api.openai.com") ||
|
||||
strings.Contains(apiBase, "openai.azure.com")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,6 +785,8 @@ func TestSupportsPromptCacheKey(t *testing.T) {
|
|||
}{
|
||||
{"https://api.openai.com/v1", true},
|
||||
{"https://api.openai.com/v1/", true},
|
||||
{"https://myresource.openai.azure.com/openai/deployments/gpt-4", true},
|
||||
{"https://eastus.openai.azure.com/v1", true},
|
||||
{"https://api.mistral.ai/v1", false},
|
||||
{"https://generativelanguage.googleapis.com/v1beta", false},
|
||||
{"https://api.deepseek.com/v1", false},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue