feat: Anthropic allow users to set anthropic-beta in headers

This commit is contained in:
Ishaan Jaff 2024-05-16 14:40:31 -07:00
parent 176630bce9
commit 32815b06cb

View file

@ -93,6 +93,7 @@ class AnthropicConfig:
"max_tokens",
"tools",
"tool_choice",
"extra_headers",
]
def map_openai_params(self, non_default_params: dict, optional_params: dict):
@ -504,7 +505,9 @@ class AnthropicChatCompletion(BaseLLM):
## Handle Tool Calling
if "tools" in optional_params:
_is_function_call = True
headers["anthropic-beta"] = "tools-2024-04-04"
if "anthropic-beta" not in headers:
# default to v1 of "anthropic-beta"
headers["anthropic-beta"] = "tools-2024-04-04"
anthropic_tools = []
for tool in optional_params["tools"]: