Skip to content
2 changes: 1 addition & 1 deletion src/agentscope/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""The version of agentscope."""

__version__ = "1.0.20"
__version__ = "1.0.21"
7 changes: 7 additions & 0 deletions src/agentscope/formatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
)
from ._a2a_formatter import A2AChatFormatter

from ._openai_response_formatter import (
OpenAIResponseChatFormatter,
OpenAIResponseMultiAgentFormatter,
)

__all__ = [
"FormatterBase",
"TruncatedFormatterBase",
Expand All @@ -45,4 +50,6 @@
"DeepSeekChatFormatter",
"DeepSeekMultiAgentFormatter",
"A2AChatFormatter",
"OpenAIResponseChatFormatter",
"OpenAIResponseMultiAgentFormatter",
]
4 changes: 2 additions & 2 deletions src/agentscope/formatter/_anthropic_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def _format(
elif typ == "tool_result":
output = block.get("output")
if output is None:
content_value = [{"type": "text", "text": None}]
content_value = [{"type": "text", "text": ""}]
elif isinstance(output, list):
content_value = [
_format_anthropic_image_block(item)
Expand Down Expand Up @@ -207,7 +207,7 @@ async def _format(

msg_anthropic = {
"role": role,
"content": content_blocks or None,
"content": content_blocks,
}

# When both content and tool_calls are None, skipped
Expand Down
35 changes: 21 additions & 14 deletions src/agentscope/formatter/_gemini_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,30 @@ async def _format(
for block in msg.get_content_blocks():
typ = block.get("type")
if typ == "text":
parts.append(
{
"text": block.get("text"),
},
)
text_part: dict[str, Any] = {
"text": block.get("text"),
}
text_sig = block.get("thought_signature")
if text_sig is not None:
text_part["thought_signature"] = base64.b64decode(
text_sig, # type: ignore[arg-type]
)
parts.append(text_part)

elif typ == "tool_use":
parts.append(
{
"function_call": {
"id": None,
"name": block["name"],
"args": block["input"],
},
"thought_signature": block.get("id", None),
fc_part: dict[str, Any] = {
"function_call": {
"id": None,
"name": block["name"],
"args": block["input"],
},
)
}
thought_sig = block.get("thought_signature")
if thought_sig is not None:
fc_part["thought_signature"] = base64.b64decode(
thought_sig, # type: ignore[arg-type]
)
parts.append(fc_part)

elif typ == "tool_result":
(
Expand Down
Loading
Loading