diff --git a/litellm/llms/sap/chat/handler.py b/litellm/llms/sap/chat/handler.py index 0866548ce7f..67504d99b89 100755 --- a/litellm/llms/sap/chat/handler.py +++ b/litellm/llms/sap/chat/handler.py @@ -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):