mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
style(count_tokens): drop the new docstrings
This commit is contained in:
parent
f012c60033
commit
875a0e6404
4 changed files with 0 additions and 13 deletions
|
|
@ -349,8 +349,6 @@ def _beta_header_values(side: str | Sequence[str] | None) -> tuple[str, ...]:
|
||||||
|
|
||||||
|
|
||||||
def context_management_betas(context_management: JsonValue) -> frozenset[str]:
|
def context_management_betas(context_management: JsonValue) -> frozenset[str]:
|
||||||
"""The anthropic-beta values a ``context_management`` body needs: the compact beta for a
|
|
||||||
``compact_20260112`` edit and the context-management beta for every other edit."""
|
|
||||||
edits: Final = context_management.get("edits") if isinstance(context_management, dict) else None
|
edits: Final = context_management.get("edits") if isinstance(context_management, dict) else None
|
||||||
if not isinstance(edits, list):
|
if not isinstance(edits, list):
|
||||||
return frozenset()
|
return frozenset()
|
||||||
|
|
|
||||||
|
|
@ -350,13 +350,6 @@ def claude_count_options(
|
||||||
context_management: CountContextManagement | None,
|
context_management: CountContextManagement | None,
|
||||||
deployment: Mapping[str, object] | None,
|
deployment: Mapping[str, object] | None,
|
||||||
) -> ClaudeCountOptions | ChatCountTranslationError:
|
) -> ClaudeCountOptions | ChatCountTranslationError:
|
||||||
"""The thinking, tool_choice, output_config and context_management a Claude count sends, with the
|
|
||||||
anthropic-beta values they need, after the deployment's own /v1/messages transform rewrites them.
|
|
||||||
|
|
||||||
The transform runs without messages and with a max_tokens above any thinking budget, so it never
|
|
||||||
caps a budget the caller's real max_tokens would allow. An error it raises is the error inference
|
|
||||||
answers for the same body.
|
|
||||||
"""
|
|
||||||
sent: Final = {
|
sent: Final = {
|
||||||
**{name: value for name, value in request_options.items() if value is not None},
|
**{name: value for name, value in request_options.items() if value is not None},
|
||||||
**({} if context_management is None else {"context_management": context_management.spec}),
|
**({} if context_management is None else {"context_management": context_management.spec}),
|
||||||
|
|
|
||||||
|
|
@ -942,8 +942,6 @@ async def test_counter_sends_the_options_and_context_edits_messages_inference_se
|
||||||
request_options: dict[str, JsonValue],
|
request_options: dict[str, JsonValue],
|
||||||
context_management: dict[str, JsonValue] | None,
|
context_management: dict[str, JsonValue] | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""A /v1/messages count that drops thinking, tool_choice, output_config or context_management
|
|
||||||
counts a different prompt than inference bills, so it carries them the way inference sends them."""
|
|
||||||
inference: Final = await _messages_inference_request(
|
inference: Final = await _messages_inference_request(
|
||||||
counter_type,
|
counter_type,
|
||||||
count_endpoint.removesuffix("/count_tokens"),
|
count_endpoint.removesuffix("/count_tokens"),
|
||||||
|
|
|
||||||
|
|
@ -389,8 +389,6 @@ async def _messages_inference_and_count(deployment_model: str, model_to_use: str
|
||||||
async def test_runtime_count_sends_the_options_and_context_edits_invoke_inference_sends(
|
async def test_runtime_count_sends_the_options_and_context_edits_invoke_inference_sends(
|
||||||
deployment_model: str, model_to_use: str
|
deployment_model: str, model_to_use: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Bedrock invoke inference drops edits InvokeModel rejects and sends its betas in the body, so a count
|
|
||||||
that skips either counts a prompt inference never sends, or gets the 400 inference avoids."""
|
|
||||||
inference, bedrock = await _messages_inference_and_count(deployment_model, model_to_use)
|
inference, bedrock = await _messages_inference_and_count(deployment_model, model_to_use)
|
||||||
|
|
||||||
assert bedrock.posted_hosts() == (RUNTIME_HOST,)
|
assert bedrock.posted_hosts() == (RUNTIME_HOST,)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue