Fix AnthropicModel.count_tokens with native tools#5704
Open
kazmer97 wants to merge 1 commit into
Open
Conversation
3 tasks
81b76a7 to
885ab96
Compare
Contributor
|
Thanks for your interest in this issue! However, there are already open PRs addressing issue #5702: #5703. To avoid duplicate efforts, this PR has been closed. If you'd like to contribute, you can review the existing PRs or share your thoughts on issue #5702. If you believe the existing PRs are inactive, please comment on the issue and a maintainer can reassess. |
2 tasks
Collaborator
|
sorry about this @kazmer97 , sometimes issues/PRs get buried under spam, feel free to ping us directly on slack when this happens so we can act more quickly let me do a review of the PR and get back to you, I may push updates if they're needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
count_tokensrequests by clearingnative_toolson the count-only request parameters.CodeExecutionToolandWebFetchToolduring preflight token counting.Validation
uv run pytest tests/models/test_anthropic.py::test_anthropic_count_tokens_with_mock tests/models/test_anthropic.py::test_anthropic_count_tokens_with_no_messages tests/models/test_anthropic.py::test_anthropic_count_tokens_omits_native_tools tests/models/test_anthropic.py::test_anthropic_code_execution_tool_version_auto tests/models/test_anthropic.py::test_anthropic_code_execution_tool_version_settinguv run ruff check pydantic_ai_slim/pydantic_ai/models/anthropic.py tests/models/test_anthropic.pyuv run ruff format --check pydantic_ai_slim/pydantic_ai/models/anthropic.py tests/models/test_anthropic.pyPYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright pydantic_ai_slim/pydantic_ai/models/anthropic.pyChecklist