25 lines
1.2 KiB
Bash
25 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# tool-use тест НАПРЯМУЮ в шим (без ретрай-цепочки new-api)
|
|
BODY='{"model":"MODEL","messages":[{"role":"user","content":"Weather in Paris? Use the tool."}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"auto","max_tokens":300}'
|
|
for m in claude-opus-5-5 gemini-4-argon gpt-6.1-sol kimi-k3.1-pro glm-5.3-flash deepseek-v4.1-flash gpt-6-luna; do
|
|
b="${BODY/MODEL/$m}"
|
|
printf "%-20s " "$m"
|
|
out=$(curl -s -m 90 -X POST 127.0.0.1:8840/v1/chat/completions \
|
|
-H "Content-Type: application/json" -H "Authorization: Bearer none" -d "$b")
|
|
echo "$out" | python3 -c "
|
|
import json,sys
|
|
t=sys.stdin.read()
|
|
try:
|
|
d=json.loads(t)
|
|
except Exception:
|
|
print('RAW', t[:80]); raise SystemExit
|
|
ch=(d.get('choices') or [{}])[0]
|
|
msg=ch.get('message') or {}
|
|
tc=msg.get('tool_calls') or []
|
|
if tc:
|
|
fn=tc[0].get('function') or {}
|
|
print('TOOL_CALLS', fn.get('name'), fn.get('arguments'))
|
|
else:
|
|
print('NO_TOOL finish=%s content=%r' % (ch.get('finish_reason'), (msg.get('content') or '')[:40]))
|
|
"
|
|
done |