Skip to content

Your lightweight open-source personal agent.

fix(providers): normalize empty reasoning_content to None at provider level

andienguyen-ecoligode63c31d4342
diff --git a/nanobot/providers/custom_provider.py b/nanobot/providers/custom_provider.py
index f190ccf1f..4022d9ecc 100644
--- a/nanobot/providers/custom_provider.py
+++ b/nanobot/providers/custom_provider.py
@@ -40,7 +40,7 @@ class CustomProvider(LLMProvider):
return LLMResponse(
content=msg.content, tool_calls=tool_calls, finish_reason=choice.finish_reason or "stop",
usage={"prompt_tokens": u.prompt_tokens, "completion_tokens": u.completion_tokens, "total_tokens": u.total_tokens} if u else {},
- reasoning_content=getattr(msg, "reasoning_content", None),
+ reasoning_content=getattr(msg, "reasoning_content", None) or None,
)
def get_default_model(self) -> str:
diff --git a/nanobot/providers/litellm_provider.py b/nanobot/providers/litellm_provider.py
index 58c9ac242..784f02c04 100644
--- a/nanobot/providers/litellm_provider.py
+++ b/nanobot/providers/litellm_provider.py
@@ -257,7 +257,7 @@ class LiteLLMProvider(LLMProvider):
"total_tokens": response.usage.total_tokens,
}
- reasoning_content = getattr(message, "reasoning_content", None)
+ reasoning_content = getattr(message, "reasoning_content", None) or None
return LLMResponse(
content=message.content,