tool-bench: Gemini 3 thought_signature(extra_content) 왕복 처리
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0dbdc5f50
commit
ea2f9dccc4
1 file changed
+6
-2
@@ -160,7 +160,8 @@ def _chat_openai_compat(base, key, model, messages, timeout):
|
||||
elif m["role"] == "assistant" and m.get("tool_calls"):
|
||||
msgs.append({"role": "assistant", "content": m.get("content") or None, "tool_calls": [
|
||||
{"id": tc.get("id") or "", "type": "function",
|
||||
"function": {"name": tc["function"]["name"], "arguments": json.dumps(tc["function"].get("arguments") or {}, ensure_ascii=False)}}
|
||||
"function": {"name": tc["function"]["name"], "arguments": json.dumps(tc["function"].get("arguments") or {}, ensure_ascii=False)},
|
||||
**({"extra_content": tc["extra_content"]} if tc.get("extra_content") else {})}
|
||||
for tc in m["tool_calls"]]})
|
||||
else:
|
||||
msgs.append({"role": m["role"], "content": m["content"]})
|
||||
@@ -172,7 +173,10 @@ def _chat_openai_compat(base, key, model, messages, timeout):
|
||||
args = tc["function"].get("arguments") or "{}"
|
||||
try: args = json.loads(args) if isinstance(args, str) else args
|
||||
except Exception: args = {"_raw": args}
|
||||
tcs.append({"id": tc.get("id") or "", "function": {"name": tc["function"]["name"], "arguments": args}})
|
||||
item = {"id": tc.get("id") or "", "function": {"name": tc["function"]["name"], "arguments": args}}
|
||||
# Gemini 3는 함수 호출의 thought_signature를 다음 턴에 그대로 돌려줘야 한다(없으면 HTTP 400)
|
||||
if tc.get("extra_content"): item["extra_content"] = tc["extra_content"]
|
||||
tcs.append(item)
|
||||
return {"content": msg.get("content") or "", "tool_calls": tcs}
|
||||
|
||||
def chat(endpoint, model, messages, timeout=150):
|
||||
|
||||
Reference in new issue
Block a user