From 510c6cf962c222864c3e345f79fe8ebe91db4744 Mon Sep 17 00:00:00 2001 From: Yamac Ay Date: Wed, 30 Sep 2026 10:20:23 +0200 Subject: [PATCH] restore docstring for strip markdown functin --- litellm/llms/sap/chat/transformation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litellm/llms/sap/chat/transformation.py b/litellm/llms/sap/chat/transformation.py index 9d0fc5b57c0..661179e5312 100755 --- a/litellm/llms/sap/chat/transformation.py +++ b/litellm/llms/sap/chat/transformation.py @@ -421,6 +421,12 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig): return _normalize_choice_fn(choice) def _strip_markdown_json(self, response: ModelResponse) -> ModelResponse: + """Strip markdown code block wrapper from JSON content if present. + + SAP GenAI Hub with Anthropic models sometimes returns JSON wrapped in + markdown code blocks (```json ... ```) depending on prompt phrasing. + This method strips that wrapper to ensure consistent JSON output. + """ import re for choice in response.choices or []: