mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-06 02:23:35 +00:00
docs - Setting anthropic-beta Header in Requests
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user