mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-27 06:13:07 +00:00
fixup(sap): outdated docs
This commit is contained in:
parent
808bad989d
commit
247aa59f16
1 changed files with 2 additions and 6 deletions
|
|
@ -33,9 +33,7 @@ def _now_ts() -> int:
|
|||
|
||||
|
||||
def normalize_reasoning_content(raw: dict[str, object]) -> dict[str, object]:
|
||||
# SAP AI Core returns reasoning tokens as a list: message.reasoning_content = [{"content": ..., "signature": ...}]
|
||||
# ModelResponse.reasoning_content is typed Optional[str], so map the list to
|
||||
# thinking_blocks and collapse the text into a single joined string.
|
||||
"""Transform reasoning_content from SAP Orchestration format [{"content": ..., "signature": ...}] to Optional[str] and a thinking_blocks list."""
|
||||
choices: Final[list[object]] = list(raw.get("choices") or [])
|
||||
normalized_choices: Final[dict[str, object]] = [
|
||||
normalize_choice(choice) for choice in choices if isinstance(choice, dict)
|
||||
|
|
@ -45,9 +43,7 @@ def normalize_reasoning_content(raw: dict[str, object]) -> dict[str, object]:
|
|||
|
||||
|
||||
def normalize_choice(choice: dict[str, object]) -> dict[str, object]:
|
||||
# Normalize a single choice dict (message or delta shape) in isolation.
|
||||
# Exposed as a static method so tests and callers can exercise one choice
|
||||
# without constructing a full response envelope.
|
||||
"""Normalize a single choice dict (message or delta shape) in isolation."""
|
||||
for key in ("message", "delta"):
|
||||
carrier = choice.get(key)
|
||||
if not isinstance(carrier, dict):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue