mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
fix(bedrock): carry the tool_call_id into the rewritten tool call text
This commit is contained in:
parent
e250e661e3
commit
610249c663
2 changed files with 5 additions and 2 deletions
|
|
@ -228,7 +228,9 @@ class AmazonConverseConfig(BaseConfig):
|
|||
function = tool_call.get("function") or {}
|
||||
name = function.get("name") or "unknown_tool"
|
||||
arguments = function.get("arguments") or ""
|
||||
return f"[tool call: {name}({arguments})]"
|
||||
call_id = tool_call.get("id")
|
||||
label = f"tool call {call_id}" if call_id else "tool call"
|
||||
return f"[{label}: {name}({arguments})]"
|
||||
|
||||
def _result_text(message: AllMessageValues) -> str:
|
||||
rendered = convert_content_list_to_str(message).strip()
|
||||
|
|
|
|||
|
|
@ -6467,7 +6467,8 @@ def test_neutralize_orphaned_tool_blocks_rewrites_when_no_tools():
|
|||
# '{"city": "Paris"}' is escaped, so assert on quote-free tokens that survive.
|
||||
assert "city" in serialized and "Paris" in serialized
|
||||
assert "Sunny, 25C" in serialized
|
||||
assert "call_abc" in serialized # tool_call_id correlation preserved
|
||||
assert "[tool call call_abc: get_weather(" in result[1]["content"]
|
||||
assert "[tool result for call_abc: Sunny, 25C]" in result[2]["content"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tools_value", [[], None])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue