Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(providers): sanitize azure responses input messages
Xubin Rended0967c1804
diff --git a/nanobot/providers/azure_openai_provider.py b/nanobot/providers/azure_openai_provider.pyindex f2f63a5ba..bf6ccae8b 100644--- a/nanobot/providers/azure_openai_provider.py+++ b/nanobot/providers/azure_openai_provider.py@@ -87,7 +87,7 @@ class AzureOpenAIProvider(LLMProvider):) -> dict[str, Any]:"""Build the Responses API request body from Chat-Completions-style args."""deployment = model or self.default_model- instructions, input_items = convert_messages(messages)+ instructions, input_items = convert_messages(self._sanitize_empty_content(messages))body: dict[str, Any] = {"model": deployment,diff --git a/tests/providers/test_azure_openai_provider.py b/tests/providers/test_azure_openai_provider.pyindex 4a18f3bf9..89cea64f0 100644--- a/tests/providers/test_azure_openai_provider.py+++ b/tests/providers/test_azure_openai_provider.py@@ -150,6 +150,19 @@ def test_build_body_image_conversion():assert image_block["image_url"] == "https://example.com/img.png"+def test_build_body_sanitizes_single_dict_content_block():+ """Single content dicts should be preserved via shared message sanitization."""+ provider = AzureOpenAIProvider(api_key="k", api_base="https://r.com", default_model="gpt-4o")+ messages = [{+ "role": "user",+ "content": {"type": "text", "text": "Hi from dict content"},+ }]++ body = provider._build_body(messages, None, None, 4096, 0.7, None, None)++ assert body["input"][0]["content"] == [{"type": "input_text", "text": "Hi from dict content"}]++# ---------------------------------------------------------------------------# chat() — non-streaming# ---------------------------------------------------------------------------