Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

[EMERGENCY] Fix Anthropic header issue (#6445)

Richards Tu8e49146a3523
diff --git a/api/core/model_runtime/model_providers/anthropic/llm/llm.py b/api/core/model_runtime/model_providers/anthropic/llm/llm.py
index 787c3baaaa9..107efe48678 100644
--- a/api/core/model_runtime/model_providers/anthropic/llm/llm.py
+++ b/api/core/model_runtime/model_providers/anthropic/llm/llm.py
@@ -114,9 +114,9 @@ class AnthropicLargeLanguageModel(LargeLanguageModel):
extra_model_kwargs['system'] = system
# Add the new header for claude-3-5-sonnet-20240620 model
- headers = {}
+ extra_headers = {}
if model == "claude-3-5-sonnet-20240620":
- headers["anthropic-beta"] = "max-tokens-3-5-sonnet-2024-07-15"
+ extra_headers["anthropic-beta"] = "max-tokens-3-5-sonnet-2024-07-15"
if tools:
extra_model_kwargs['tools'] = [
@@ -126,7 +126,7 @@ class AnthropicLargeLanguageModel(LargeLanguageModel):
model=model,
messages=prompt_message_dicts,
stream=stream,
- headers=headers,
+ extra_headers=extra_headers,
**model_parameters,
**extra_model_kwargs
)
@@ -136,7 +136,7 @@ class AnthropicLargeLanguageModel(LargeLanguageModel):
model=model,
messages=prompt_message_dicts,
stream=stream,
- headers=headers,
+ extra_headers=extra_headers,
**model_parameters,
**extra_model_kwargs
)