Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.19.post1"
__version__ = "1.0.20"
2 changes: 1 addition & 1 deletion src/agentscope/formatter/_deepseek_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def _format(

msg_deepseek = {
"role": msg.role,
"content": content_msg or None,
"content": content_msg or (None if tool_calls else ""),
}

if reasoning_msg:
Expand Down
3 changes: 3 additions & 0 deletions src/agentscope/formatter/_formatter_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def convert_tool_result_to_string(
second element is the corresponding block.
"""

if output is None:
return "", []

if isinstance(output, str):
return output, []

Expand Down
3 changes: 1 addition & 2 deletions src/agentscope/formatter/_truncated_formatter_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""The truncated formatter base class, which allows to truncate the input
messages."""
from abc import ABC
from copy import deepcopy
from typing import (
Any,
Tuple,
Expand Down Expand Up @@ -66,7 +65,7 @@ async def format(
# Check if the input messages are valid
self.assert_list_of_msgs(msgs)

msgs = deepcopy(msgs)
msgs = list(msgs)

while True:
formatted_msgs = await self._format(msgs)
Expand Down
11 changes: 7 additions & 4 deletions src/agentscope/model/_anthropic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,13 @@ async def _parse_anthropic_stream_completion_response(
# (e.g., DashScope), the input tokens are contained in
# events where event.type == "message_delta", so we add
# this step to extract the value.
final_input_tokens = getattr(
event.usage,
"input_tokens",
0,
final_input_tokens = (
getattr(
event.usage,
"input_tokens",
0,
)
or 0
)
if final_input_tokens > usage.input_tokens:
usage.input_tokens = final_input_tokens
Expand Down
Loading