From aa0863dd76452fa0a8ceb86f3d31ee8674520e2b Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 16 May 2024 14:55:29 -0700 Subject: [PATCH] docs - Setting `anthropic-beta` Header in Requests --- docs/my-website/docs/providers/anthropic.md | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/my-website/docs/providers/anthropic.md b/docs/my-website/docs/providers/anthropic.md index 5bb47d780d..bf8f72bea1 100644 --- a/docs/my-website/docs/providers/anthropic.md +++ b/docs/my-website/docs/providers/anthropic.md @@ -223,6 +223,34 @@ assert isinstance( ``` +### Setting `anthropic-beta` Header in Requests + +Pass the the `extra_headers` param to litellm, All headers will be forwarded to Anthropic API + +```python +response = completion( + model="anthropic/claude-3-opus-20240229", + messages=messages, + tools=tools, + extra_headers={"anthropic-beta": "tools-2024-05-16"}, +) +``` + +### Forcing Anthropic Tool Use + +If you want Claude to use a specific tool to answer the user’s question + +You can do this by specifying the tool in the `tool_choice` field like so: +```python +response = completion( + model="anthropic/claude-3-opus-20240229", + messages=messages, + tools=tools, + tool_choice={"type": "tool", "name": "get_weather"}, + extra_headers={"anthropic-beta": "tools-2024-05-16"}, +) +``` + ### Parallel Function Calling