-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Litellm anthropic contex management param support #16528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Litellm anthropic contex management param support #16528
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| "response_format", | ||
| "user", | ||
| "web_search_options", | ||
| "context_management", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not an openai param
ishaan-jaff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nits on this
| headers[ | ||
| "anthropic-beta" | ||
| ] = ANTHROPIC_BETA_HEADER_VALUES.CONTEXT_MANAGEMENT_2025_06_27.value | ||
| if optional_params.get("context_management") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a helper method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
ishaan-jaff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Title
Add Anthropic
context_managementsupport for chat completions and/v1/messagesRelevant issues
Pre-Submission checklist
tests/litellm/directory, Adding at least 1 test is a hard requirementmake test-unit(ranpytest litellm/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py litellm/tests/test_litellm/responses/test_responses_utils.py)Type
🆕 New Feature
📖 Documentation
✅ Test
Changes
context_managementfor Anthropic chat completions: parameter is now accepted, forwarded unchanged, and auto-adds the requiredcontext-management-2025-06-27beta header.context_managementfor Anthropic/v1/messages; LiteLLM adds the beta flag while letting the native payload passthrough.