gateway: a Responses request translated to Mistral carries its thinking as parts, not reasoning_content (#4906)
Codex on /v1/responses with a DeepSeek-named model served at Mistral (preset mistral or api.mistral.ai, here deepseek-v4-1-flash-1017) broke after its first tool call: the Chat build replays an earlier turn's thinking in reasoning_content for any model whose name says DeepSeek, wherever it is served (chatReplaysReasoning keys on the name), and Mistral answers that field with 422 extra_forbidden. The #494 fix converted it to Mistral's typed thinking part (mistralThinking) only on the Chat passthrough route, so /v1/chat/completions on the same provider answered 200 while every follow-up on /v1/responses was refused. forwardTranslated now runs mistralThinking on the body built for a Mistral upstream, with the same gate the relayed route uses. Other upstreams keep the #1462 replay (a DeepSeek at DeepSeek still gets reasoning_content), and the relayed route is unchanged. MystryMocha's nit: a whitespace-only thinking (the " " placeholder the replay gives a tool turn with no reasoning item) is now dropped instead of being sent as a blank thinking part. This applies to the relayed route too; Mistral accepts the dropped field (MystryMocha's raw table). Ported from skygunner's 29b0ea308 (branch fix/4906-mistral-translated-reasoning), on origin/main1c45645b5. Edward4226's 0b8aee26f was an independent fix of the same shape. Run (all through mote-run, at this tree): - gofmt -l internal/gateway docs: empty - go test -tags nogui ./internal/gateway -count=1 -timeout 45m: ok (894.9s) - GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go vet ./..., go build: ok Run at this change on1c45645b5, then rebased onto 3f53fa1f3; the two commits between (763ea9438,3f53fa1f3) touch GUI CSS, webfonts.js and GUI tests only, nothing Go. Broken by hand: - forwardTranslated's mistralThinking call taken out: TestTranslatedReasoningAsThinkingForMistral red with the reporter's 422 at messages[1].assistant.reasoning_content ("I should read note.txt with the tool."), and the new TestTranslatedToolTurnWithoutReasoningForMistral red with the same 422 on the " " placeholder. - TrimSpace reverted to think == "": only TestTranslatedToolTurnWithoutReasoningForMistral red ("the call was given a blank thinking part"). Real use: not tried here, no Mistral key. MystryMocha ran skygunner's 29b0ea308 on maina92cc3f3(Windows/amd64) against the real Mistral API and in real Codex Desktop on mistral/deepseek-v4-1-flash-1017: a 12-minute session of many tool calls with no 422, and turn 2 and a tool turn without a reasoning item 422 on main, 200 with the fix. The TrimSpace change on top of it was not run against the real API; per the same report, Mistral answers 200 with the field dropped. Co-authored-by: skygunner <84759+skygunner@users.noreply.github.com>
This commit is contained in:
@@ -207,7 +207,7 @@ recorded as a prediction failure (`noPrediction`).
|
||||
- Claude's, GPT's, Gemini's and DeepSeek's reasoning is held (`refusesAfterThinking`, up to `holdThinking`, 4 minutes) so that a refusal after it goes to the next candidate unseen (#248). It is held only while one could: on the last candidate a refusal isn't asked again, so their reasoning streams as it comes there, and a refusal after it reaches the agent as the vendor's own. Held there, a lone relay's Claude or GPT showed Claude Code its thinking all at once with the text, and Codex none until then (iTianbao on X). Gemini's streams there too: a reply that only reasoned is asked again in place by `streamTranslated`, the reasoning the agent has kept and the next try's after it (#667), so holding it only kept Codex on a Gemini model with nothing at all, not even `response.created`, for the whole of its thinking (LuckymanJC on Discord; `TestThinkingStreamsWithNoOneElse`'s gemini cases). DeepSeek's is held since plugins #540: deepseek-v4.1-flash on WorkBuddy reasoned, then ended `content_filter` with nothing said (the WorkBuddy plugin takes the filter's canned "Sorry, I can't respond to this question." out of such a reply), and with its reasoning already through, the group's next member was never asked (`TestDeepSeekRefusalAfterThinkingFailsOver`). Where a refusal after the reasoning can still go to the next candidate in the same stream (`handsOver`: the agent asked for a Chat, Anthropic or Responses stream and another candidate is left; [`refusal_handover.go`](../../internal/gateway/refusal_handover.go)), a member whose thinking has gone on to an answer `thoughtCleanMost` (3) times running has its reasoning as it comes (`holdsThinking`), and a refusal after it, nothing yet said, is handed over, the next candidate's stream following as the same reply: DeepSeek's whether or not it can be handed over (#4512), Claude's, GPT's and Gemini's only where it can, so their refusal never reaches the agent while another could answer. Held whatever the member answered, a group of one model's accounts showed Claude Code its Claude's thinking only with its text, all at once, and never its `thinking with <effort> effort` (#4166). A retryable error after the reasoning, nothing yet said (Anthropic's `overloaded_error` mid-stream), is handed over the same way (`passOver`), its status and words failing the try as a held one's would, so trusting a member doesn't cost the group its failover; one the next candidate wouldn't be asked for (a request at fault) is the agent's (`TestTrustedThinkingFailsOverOnEveryPath`: Claude, GPT and Gemini members, refused, overloaded or invalid, to Claude Code, a Chat client and Codex; `TestClaudeTrustedThinkingErrorFailsOver`). A refusal takes the trust back (`thoughtRefused`), and the member's next reasoning is held again. `TestDeepSeekThinkingStreamsOnceTrusted`, `TestDeepSeekRefusalHoldsATrustedMemberAgain`, `TestClaudeThinkingStreamsOnceTrusted` and `TestClaudeTrustedThinkingStreamsThroughGroup` in [`thinking_streams_test.go`](../../internal/gateway/thinking_streams_test.go). Any other model's reasoning (GLM's, Kimi's…) is never held.
|
||||
- A streamed reply stuck in a loop is ended, not let run to its output limit (#1359, Moody-Sin: WorkBuddy's DeepSeek v4.1 flash reasoned round "Now." "Writing." "Go." "Let me write." "OK." until max tokens while dsh and Pi waited). `holdWriter.Write` feeds every streamed try, passed through or translated, a key's, a built-in subscription's or a plugin's (a moved WorkBuddy's fetch in the plugin host, `TestLoopEndsWorkBuddysReply`), in each of the agent's protocols, to a `loopGuard` ([`loop_guard.go`](../../internal/gateway/loop_guard.go)). It cuts the reasoning and the text, each apart, into units, its lines and sentences (a list's `1.` or a decimal is no sentence's end), compared without case or a closing stop. A unit with no word in it (a letter run with no digit: not a brace, a rule, `0x00`, a hash or a row of numbers) isn't counted. When the last `loopWindow` (256) counted units of either are among no more than `loopDistinct` (24) different ones, the try is cut (`cutLoop`): what came with that write goes out, then, after a blank line (two newlines when that write stopped inside a line, `holdWriter.atLine`, #2446), the protocol's stream error (`streamError`, 502) naming the loop and quoting its units, and the vendor's request is cancelled. It falls back to nobody and rests nobody (`failLoop`); its usage record's error type is `reply_loop` (`usage.LoopErrType`), and Usage counts them per model (`Totals.Loops`), as "{n} looped" beside the model's failures in the Overview's rows and the Requests ranking (#1858, `TestLoopsCountedPerModel`, `usage-loops.test.cjs`). A reply magpie translates into the agent's protocol (`streamTranslated`) whose *reasoning* loops before it has said a text or a call, and isn't a continuation, is asked again once in place instead (`loopReasks`, through `holdWriter.onLoop`; cdredfox on X, WorkBuddy AI's DeepSeek v4 flash): the agent keeps the reasoning it has, the next try's follows it in the same stream, as an empty reply's re-ask does (#667), and only a loop on that try ends the reply with the error (`TestReasoningLoopIsAskedAgain`). A reply passed through in the agent's own protocol is asked again once too, at the fallback loop (`holdWriter.mayReloop`, `letGoLoop`; #2436, lqisgod: pi's Chat stream to WorkBuddy was cut at once): when nothing of the try has reached the agent yet, in any protocol, its held bytes are dropped; when its reasoning is already passing, only a Chat stream goes on, written up to the end of the tripping event, with the next try's chunks after it. An Anthropic or Responses stream already passing still ends with the error, since a second `message_start` or `response.created` can't follow. Each re-ask, in place or at the fallback loop, counts in the usage record's tries. A loop in the text, or after a text or call, is ended at once (`TestLoopAfterTextIsNotAskedAgain`). A cycle need not be exact. Code, tables, lists, logs, CSV and base64 differ line to line or have no words, and don't trip it (`TestLoopGuardLeavesOrdinaryRepliesAlone` feeds magpie's own sources and docs through it). A reply sent whole (no stream, or Gemini without `alt=sse`) isn't read. Settings › Models › Replies › *Stop looping replies* (`noLoopGuard`) turns it off.
|
||||
- A conversation going round one tool call is answered by magpie and sent nowhere (audie on Discord: Codex Desktop on WorkBuddy's deepseek-v4-pro read the same file 308 times in half an hour, and 340 times that evening, 537 credits). `stoppedToolLoop` ([`tool_loop.go`](../../internal/gateway/tool_loop.go)) runs in `serveAgent` before hooks, middleware and routing, and in the Codex backend's passthrough on Codex's own sign-in. It reads the request's own history, so it is per conversation and keeps no state: when the last `toolLoopRepeats` (8) turns are each the same calls (name and arguments, keys in any order, call ids ignored) answered with the same results (with Codex's `Wall time`, `Chunk ID` and `duration_seconds` taken out, `runNoise`) and nothing else from the user, the turn is answered in the agent's own protocol, streamed or whole (`writeLocalText` through `relayStatus`), with a notice naming the call. Any different result, or a word of the user's, starts the count again; the notice is a turn without calls, so the user's next word goes on. A body with fewer than 8 tool results isn't parsed (`mayLoop`), and only the newest 64 items of a long one are (`tailOf`, gjson), ~1ms for a 1.5MB turn (`BenchmarkToolLoopCheck`). The turn is recorded as Codex's title turns are (`answeredHere`): the Routing trace as "Tool loop stopped", and a usage row with provider `magpie`, rejected, its session and an error starting `tool loop:`. A poll that gets the same answer 8 times in a row is stopped too. Settings › Models › Replies › *Stop looping replies* (`noLoopGuard`) turns it off with the reply guard. Verification: `go test -tags nogui ./internal/gateway -run 'TestToolLoop'`.
|
||||
- A Chat request's earlier turns carry the assistant's thinking back in the spelling its own client used: `reasoning_content` (DeepSeek's, which OpenCode and most clients send), `reasoning` (OpenRouter's) or `reasoning_details` (OpenRouter's structured one). A request translated to a non-Chat upstream reads whichever of the three the turn has, in that order, as the turn's thinking (`messageReasoning`, `reasoningText`, read by `parseChat` in [chat.go](../../internal/gateway/chat.go)); the passthrough has read all three since `mistralThinking` (#494), which was the one place that did. Before that the parse layer read `reasoning_content` alone, so a tool-calling session whose client spelled it another way went on from its second turn without the model's own reasoning.
|
||||
- A Chat request's earlier turns carry the assistant's thinking back in the spelling its own client used: `reasoning_content` (DeepSeek's, which OpenCode and most clients send), `reasoning` (OpenRouter's) or `reasoning_details` (OpenRouter's structured one). A request translated to a non-Chat upstream reads whichever of the three the turn has, in that order, as the turn's thinking (`messageReasoning`, `reasoningText`, read by `parseChat` in [chat.go](../../internal/gateway/chat.go)); the passthrough has read all three since `mistralThinking` (#494), which was the one place that did. The same conversion covers a request translated to Mistral's Chat API (`forwardTranslated`): the build replays a turn's thinking in `reasoning_content` for a model whose name says DeepSeek wherever it is served (`chatReplaysReasoning`), which Mistral refuses — 422 `extra_forbidden` on `messages[].reasoning_content`, every follow-up of a Codex tool loop after its first call (#4906) — so the built body goes through `mistralThinking` too, and its thinking parts reach Mistral as its own replies carry them; a whitespace-only thinking (the `" "` a tool turn with no reasoning item is given) is dropped, not sent as a blank part. `TestTranslatedReasoningAsThinkingForMistral`, `TestTranslatedToolTurnWithoutReasoningForMistral`. Before that the parse layer read `reasoning_content` alone, so a tool-calling session whose client spelled it another way went on from its second turn without the model's own reasoning.
|
||||
- The order of the steps a request's accounts go through, how much the accounts' own order (*Make first*) counts under each routing, and how often an allowance is read are described for users in [How magpie picks an account](../reference.md#how-magpie-picks-an-account). Smart compares renewals window by window, biggest first, each truncated to the hour (`weighRouted`), so the order decides only when every window falls in the same hour. A window's renewal is its reset, or, when what it has left runs out sooner or it has no reset, that moment (`Limit.RunsOut`, from `QuotaWindow.RunsOutAt`; `Allowance.Renewal`): the WorkBuddy plugin (0.1.14) sends it on its Credits window as the soonest end of a package with credits left (cdredfox on X). When the renewals tie to the hour, Smart goes by that moment once more (`Allowance.Lapse`, `Seat.Lapse`), so of accounts renewing together (WorkBuddy's free accounts all reset at the month's end, plugin 0.1.35) the one whose credits left lapse first, after that end, goes first, and one telling none goes after (zhaocai_83020 on Discord). Only Smart reads it; Use before expiry, the 90%/98% tiers and rests go by the window's share and reset as before. A row on the Routing page says the share used (the fullest window's, `Allowance.For`) with when that same window renews (`Allowance.Fullest`, the trace's `usedRenews`), not the biggest window's: a Factory account 32% into its week and 16% into its month reads "32% used · renews in 3 days" while Smart still ranks it by its month (#1778). A route from before `usedRenews` says when only for an account of one window. Affinity keeps a conversation on an account at 90–97%: only `SpentShareOf` (98%, 100% In order) stops it (`affine`), while the 90% tier (`lowShare`) orders only conversations nobody has answered.
|
||||
- A turn's end is told to the app for the "Task done alert" notification (itieniu on X, `turndone.go`). The trace follows each agent session's turn (`turns`, keyed by agent and session): a request is of the turn unless it has a `Kind` or is a Claude Code subagent's (`agentTurnOf`), and its reply is scanned on the way to the agent for a tool call in any wire format (`toolScan`, a JSON value such as `"type":"tool_use"` or `"finish_reason":"tool_calls"`, never a key or text). The turn is done when no request of it is going, the last reply was whole, under 400 and called no tool, and nothing more came for `turnQuiet` (4s); a session idle past `turnStale` (30m) starts over. Only a turn that ran at least `settings.TurnDoneAlert` seconds is told (`TurnDone`, set by the GUI; nil under `magpie serve`, so nothing is followed). The ChatGPT backend path (`codexBackend`) is followed the same way. `TestTurnDoneSaidAtTheTurnsEnd`, `TestTurnDoneCodexBackend`, `TestToolScan`, `turn-done.test.cjs`.
|
||||
- A request's masking record is told to the app for the "Masking alert" notification (Must2333 on X, `OnMasked` in [`masked.go`](../../internal/gateway/masked.go), set by the GUI; nil under `magpie serve`), after `maskrec.Hold` and with its text around placeholders (`Snips`, `Back`) taken out. [`mask_alert.go`](../../internal/gui/mask_alert.go) keeps the records while `settings.MaskAlert` is on (off until turned on, in Settings → Usage, hidden with masking) and says only the values a record masked for the first time (`maskrec.Fresh`, [`first.go`](../../internal/maskrec/first.go): each placeholder by the key of the first record that had it, read from memory and the days kept, so a conversation's history sent again each turn, or after a restart, is not news; a value sent as written is not one masked). A burst is gathered for `maskGather` (3s) and said as one, and one is said at most every `maskGap` (1 minute), what came in between said after it. It says each kind with its count and up to two agents, never a value nor its hint; a click opens the Masking page on the latest record (`clickView`, `masking&key=`). A held-back request (`noteBlocked`) is not said; a value whose records have all aged out (30 days) is new again. `TestFreshOnlyTheFirstTime`, `TestMaskAlertFirstTimeOnly`, `TestMaskAlertNeverSaysTheValue`, `TestMaskAlertCoalesces`, `mask-alert.test.cjs`.
|
||||
|
||||
@@ -1044,7 +1044,10 @@ func mistralThinking(body []byte) []byte {
|
||||
}
|
||||
var role string
|
||||
decodeJSON(m["role"], &role)
|
||||
if think == "" || role != "assistant" {
|
||||
// a whitespace-only thinking is the placeholder a DeepSeek
|
||||
// replay puts on a tool turn that had none (#1462): dropped, not
|
||||
// sent as a blank thinking part (#4906)
|
||||
if strings.TrimSpace(think) == "" || role != "assistant" {
|
||||
return true
|
||||
}
|
||||
thinking, _ := marshalPlain(map[string]any{"type": "thinking",
|
||||
|
||||
@@ -7502,6 +7502,16 @@ func (s *Server) forwardTranslated(ctx context.Context, p provider.Provider, to
|
||||
if to == provider.Chat && (p.IsBedrock() || p.IsAzure()) {
|
||||
body = asCompletionTokens(body)
|
||||
}
|
||||
if to == provider.Chat && (p.Preset == "mistral" || p.Host() == "api.mistral.ai") {
|
||||
// an earlier turn's reasoning, which the build replays in
|
||||
// reasoning_content for a model whose name says DeepSeek
|
||||
// wherever it is served (chatReplaysReasoning), and Mistral
|
||||
// turns that field away (#494): the thinking part it takes,
|
||||
// as the relayed route converts it. The Chat route alone had
|
||||
// it; every follow-up of a Codex tool loop was refused, 422
|
||||
// extra_forbidden (#4906)
|
||||
body = mistralThinking(body)
|
||||
}
|
||||
if to == provider.Responses && !keepsLoneNone(p) {
|
||||
// the "none" buildResponses keeps for a request that turned
|
||||
// tools off with none declared goes to the Grok plugin alone,
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// mistralRefuse answers as Mistral's chat completions do a body with a
|
||||
// field it doesn't know: 422 extra_forbidden, every such field listed.
|
||||
func mistralRefuse(body []byte) (int, string) {
|
||||
known := []string{"model", "messages", "stream", "max_tokens", "temperature", "top_p", "tools", "tool_choice",
|
||||
known := []string{"model", "messages", "stream", "stream_options", "max_tokens", "temperature", "top_p", "tools", "tool_choice",
|
||||
"parallel_tool_calls", "response_format", "stop", "random_seed", "presence_penalty", "frequency_penalty", "n"}
|
||||
var m map[string]json.RawMessage
|
||||
json.Unmarshal(body, &m)
|
||||
|
||||
@@ -134,3 +134,103 @@ func TestMessageReasoningRefused(t *testing.T) {
|
||||
sameJSON(t, ms[1], `{"role":"assistant","content":null,"tool_calls":[{"id":"call_1","type":"function","function":{"name":"read","arguments":"{}"}}]}`)
|
||||
}
|
||||
}
|
||||
|
||||
// The Responses route through the same provider, with a model whose name
|
||||
// says DeepSeek served at Mistral (#4906): the Chat build replays the
|
||||
// turn's reasoning in reasoning_content wherever the model is served
|
||||
// (chatReplaysReasoning keys on the name), and Mistral turns that field
|
||||
// away — 422 extra_forbidden on every follow-up of a tool loop, where the
|
||||
// direct Chat route converts it (above). The translated body is converted
|
||||
// the same way.
|
||||
func TestTranslatedReasoningAsThinkingForMistral(t *testing.T) {
|
||||
f := &fake{t: t, refuse: mistralRefuseMessages, reply: sse(
|
||||
`data: {"id":"c1","object":"chat.completion.chunk","model":"m1","choices":[{"index":0,"delta":{"role":"assistant","content":"pelican"},"finish_reason":"stop"}],"usage":{"prompt_tokens":5,"completion_tokens":2}}`,
|
||||
`data: [DONE]`)}
|
||||
up := setup(t, provider.Chat, f)
|
||||
if err := provider.Save(provider.Provider{ID: "fake", Name: "Fake", Key: "k", Models: []string{"deepseek-v4-1-flash-1017"},
|
||||
Preset: "mistral", Chat: up.URL + "/v1"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// the issue's request: a reasoning item before the call its thinking
|
||||
// was of, the call answered
|
||||
code, body := postTo(t, New(), "/v1/responses", `{"model":"fake/deepseek-v4-1-flash-1017","stream":false,"max_output_tokens":40,
|
||||
"tools":[{"type":"function","name":"read_file","parameters":{"type":"object","properties":{"path":{"type":"string"}}}}],
|
||||
"input":[
|
||||
{"type":"message","role":"user","content":[{"type":"input_text","text":"Read note.txt and tell me the word."}]},
|
||||
{"type":"reasoning","summary":[{"type":"summary_text","text":"I should read note.txt with the tool."}]},
|
||||
{"type":"function_call","call_id":"call_1","name":"read_file","arguments":"{\"path\":\"note.txt\"}"},
|
||||
{"type":"function_call_output","call_id":"call_1","output":"pelican"}]}`)
|
||||
if code != 200 || f.calls != 1 {
|
||||
t.Fatalf("%d after %d calls: %s", code, f.calls, body)
|
||||
}
|
||||
for _, m := range sentMessages(t, f.got) {
|
||||
if strings.Contains(string(m), "reasoning_content") {
|
||||
t.Fatalf("a message still carries reasoning_content: %s", f.got)
|
||||
}
|
||||
}
|
||||
var think string
|
||||
for _, m := range sentMessages(t, f.got) {
|
||||
var msg struct {
|
||||
ToolCalls []any `json:"tool_calls"`
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
Thinking []struct {
|
||||
Text string `json:"text"`
|
||||
} `json:"thinking"`
|
||||
} `json:"content"`
|
||||
}
|
||||
if json.Unmarshal(m, &msg) != nil || len(msg.ToolCalls) == 0 {
|
||||
continue
|
||||
}
|
||||
if len(msg.Content) != 1 || msg.Content[0].Type != "thinking" {
|
||||
t.Fatalf("the turn's thinking is not the part Mistral takes: %s", m)
|
||||
}
|
||||
think = msg.Content[0].Thinking[0].Text
|
||||
}
|
||||
if think != "I should read note.txt with the tool." {
|
||||
t.Fatalf("the reasoning item's summary is not the thinking: %q", think)
|
||||
}
|
||||
}
|
||||
|
||||
// A tool turn with no reasoning item, translated for a DeepSeek-named
|
||||
// model at Mistral (#4906): the build's " " placeholder in
|
||||
// reasoning_content is dropped, not sent as a blank thinking part, and
|
||||
// the call goes as the client made it.
|
||||
func TestTranslatedToolTurnWithoutReasoningForMistral(t *testing.T) {
|
||||
f := &fake{t: t, refuse: mistralRefuseMessages, reply: sse(
|
||||
`data: {"id":"c1","object":"chat.completion.chunk","model":"m1","choices":[{"index":0,"delta":{"role":"assistant","content":"pelican"},"finish_reason":"stop"}],"usage":{"prompt_tokens":5,"completion_tokens":2}}`,
|
||||
`data: [DONE]`)}
|
||||
up := setup(t, provider.Chat, f)
|
||||
if err := provider.Save(provider.Provider{ID: "fake", Name: "Fake", Key: "k", Models: []string{"deepseek-v4-1-flash-1017"},
|
||||
Preset: "mistral", Chat: up.URL + "/v1"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
code, body := postTo(t, New(), "/v1/responses", `{"model":"fake/deepseek-v4-1-flash-1017","stream":false,"max_output_tokens":40,
|
||||
"tools":[{"type":"function","name":"read_file","parameters":{"type":"object","properties":{"path":{"type":"string"}}}}],
|
||||
"input":[
|
||||
{"type":"message","role":"user","content":[{"type":"input_text","text":"Read note.txt and tell me the word."}]},
|
||||
{"type":"function_call","call_id":"call_1","name":"read_file","arguments":"{\"path\":\"note.txt\"}"},
|
||||
{"type":"function_call_output","call_id":"call_1","output":"pelican"}]}`)
|
||||
if code != 200 || f.calls != 1 {
|
||||
t.Fatalf("%d after %d calls: %s", code, f.calls, body)
|
||||
}
|
||||
calls := 0
|
||||
for _, m := range sentMessages(t, f.got) {
|
||||
var msg map[string]json.RawMessage
|
||||
if json.Unmarshal(m, &msg) != nil || msg["tool_calls"] == nil {
|
||||
continue
|
||||
}
|
||||
calls++
|
||||
for _, k := range messageReasoning {
|
||||
if _, ok := msg[k]; ok {
|
||||
t.Fatalf("the call carries %s: %s", k, m)
|
||||
}
|
||||
}
|
||||
if strings.Contains(string(msg["content"]), "thinking") {
|
||||
t.Fatalf("the call was given a blank thinking part: %s", m)
|
||||
}
|
||||
}
|
||||
if calls != 1 {
|
||||
t.Fatalf("%d calls sent: %s", calls, f.got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user