docs - Setting anthropic-beta Header in Requests

This commit is contained in:
Ishaan Jaff
2024-05-16 14:55:29 -07:00
parent e19e475c9f
commit aa0863dd76
@@ -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 users 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