restore docstring for strip markdown functin

This commit is contained in:
Yamac Ay 2026-09-30 10:20:23 +02:00
parent cafa683894
commit 510c6cf962
No known key found for this signature in database
GPG key ID: D113B438819CA628

View file

@ -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 []: