mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
fix python fmt issues
This commit is contained in:
parent
389e202246
commit
0c6463d312
1 changed files with 4 additions and 12 deletions
|
|
@ -367,22 +367,14 @@ def _estimate_absent_usage(
|
|||
)
|
||||
raw_choices: Final[object | None] = rust_response.get("choices")
|
||||
choices: Final[tuple[Mapping[str, object], ...]] = (
|
||||
tuple(_BRIDGE_CHOICES_ADAPTER.validate_python(raw_choices))
|
||||
if raw_choices is not None
|
||||
else ()
|
||||
)
|
||||
first_choice: Final[Mapping[str, object] | None] = (
|
||||
choices[0] if len(choices) > 0 else None
|
||||
tuple(_BRIDGE_CHOICES_ADAPTER.validate_python(raw_choices)) if raw_choices is not None else ()
|
||||
)
|
||||
first_choice: Final[Mapping[str, object] | None] = choices[0] if len(choices) > 0 else None
|
||||
raw_message: Final[object | None] = first_choice.get("message") if first_choice is not None else None
|
||||
message: Final[Mapping[str, object] | None] = (
|
||||
_BRIDGE_MESSAGE_ADAPTER.validate_python(raw_message)
|
||||
if isinstance(raw_message, Mapping)
|
||||
else None
|
||||
)
|
||||
content: Final[object | None] = (
|
||||
message.get("content") if message is not None else None
|
||||
_BRIDGE_MESSAGE_ADAPTER.validate_python(raw_message) if isinstance(raw_message, Mapping) else None
|
||||
)
|
||||
content: Final[object | None] = message.get("content") if message is not None else None
|
||||
completion_tokens: Final = (
|
||||
litellm.token_counter(text=content) # pyright: ignore[reportUnknownMemberType] # same upstream-untyped token_counter as above
|
||||
if isinstance(content, str) and content
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue