4794de398ea8337d223a91e207181c56fcf4ad76
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d82985eee1 |
agent: a routing group whose members are all best on Responses is asked there by Pi, omp, droid and dsh, so its tool-call arguments stream (#1594, ObsidianArch02)
magpieModels gave a routing group no native API, since its members may each want another. Pi, omp and droid then asked every group on Chat Completions, and dsh put it on its Chat route, even a group of GPT members all served on Responses. The gateway translated each answer from Responses to Chat, and that translation holds a tool call's arguments until the call ends (#613), so Pi's Code Mode saw no code until the whole call had been generated. A group now has APIs ["responses"] when every member, nested groups' included, is served best on Responses (allResponses over the group's members, by Provider.Native). Any other group keeps none: one with a Chat member, and a Messages-only group too, as the gateway knows whether a Claude thinks adaptively by its own model id, not the group's. dsh moves a start on such a group to its Responses route (dshStartOnItsRoute); a dsh session resumed on it asks for the model once, as for any model that moved routes. The rest of the request (a protocol picked per group, conversion shown per request) is not in this commit. Verified: - TestPiModelsAskedOnTheirNativeAPI: auto-gpt-5-5, a GPT group and a group of that group get openai-responses; a group with a Chat member and one of Messages-only members get none. Without the route.go change it fails for the three Responses groups. - TestOmpModelsAskedOnTheirNativeAPI: the same for omp. - TestGroupOnResponsesRelaysArgumentDeltas (gateway): a group of two Responses-only members asked on /v1/responses relays each function_call_arguments.delta as the vendor sent it, on /responses. It guards what this change relies on, and passed before it too. - go test ./internal/agent ./internal/provider, gofmt -l, GOOS=linux and windows go vet -tags nogui. - Not tried with a real Pi against a real group. |
||
|
|
8060650048 |
agent: Pi starts on the model magpie picks, and asks a Messages-only provider's models on Messages (#160 Aimer779; Cleary on Discord)
While Pi's ~/.pi/agent/settings.json has a non-empty enabledModels (its Ctrl+P / /scoped-models list), a new session starts on defaultProvider/defaultModel only when that list takes the model in, else on the list's first entry, so a model picked in magpie outside the list was written and never used. Setting Pi's model now adds it to enabledModels as provider/model, as Pi's own picker does, when nothing in the list takes it in already: the same reference with or without a :level after it, or a glob (*, ?, [..], without case) that the reference or its model id fits. The user's entries, their order and comments stay; no list is made where there is none, and an empty one is left as it is. Turning the model back to Pi's own takes magpie/… entries out with magpie's provider, removing the key rather than leaving it empty. The model field shows what a new session starts on: the list's first model when the saved default isn't in the list and that entry names one model outright. The list itself isn't editable in magpie yet; Field is single-valued, and an editor needs a multi-value field kind in the API, GUI (a multi-select, reorderable picker), TUI and CLI. Pi's models.json now gives each magpie model the API its provider speaks natively, so the gateway passes the request through instead of translating Chat: Responses-native models keep openai-responses; a Messages-only provider's (a custom Anthropic-compatible endpoint, as Cleary's) get api anthropic-messages with baseUrl the gateway's root (Anthropic's SDK adds /v1/messages). A Claude from 4.6 on also gets compat.forceAdaptiveThinking, so Pi asks for adaptive thinking and an effort, not the budget such a Claude refuses (why these stayed on Chat before). Magpie's models stay under providers.magpie; other providers are untouched. Why Chat→Messages could 400 where Pi's direct Messages didn't: with reasoning on, buildAnthropic raised max_tokens to budget+4096 (28096 for high) past the client's own max_completion_tokens, which Pi sets to the model's output limit, so an upstream capped below that refused it. The budget now fits under a cap the client gives (at most the cap less 1024; no thinking when the cap is 2048 or less); with no cap it still raises max_tokens as before. Tested: go test -tags nogui ./... (new: TestPiTakes, TestPiModelJoinsEnabledModels, TestPiModelOffLeavesEnabledModels, TestThinkingBudgetFitsTheClientsCap; TestPiModelsAskedOnTheirNativeAPI extended), nogui builds for darwin, linux and windows. In a sandbox HOME: settings.json with enabledModels [xai/grok-4.6, openai-codex/gpt-5.6-sol, deepseek/deepseek-flash], magpie pi magpie/cleary/kimi-k3 appended the model and kept the rest, magpie pi default took it out again; models.json listed cleary's models on anthropic-messages, a Chat relay's on the provider's openai-completions, a Responses vendor's on openai-responses. Pi 0.87.1 loaded that models.json (--list-models) and, against a fake Messages endpoint standing in for the gateway (MAGPIE_ADDR on a spare port), posted to /v1/messages with the gateway key: kimi-k3 with a 15360-token budget under max_tokens 16384, claude-sonnet-5 with adaptive thinking and effort high. |
||
|
|
761156a816 | agent: Pi asks a Responses-native model on Responses (Leo: 同协议优先) — every magpie model in Pi's models.json went out as openai-completions, so a ChatGPT sign-in's models, a Responses-only provider's, and GPT on OpenAI's API or Copilot's were asked on Chat and translated to Responses by the gateway. Now each such model carries "api": "openai-responses" (Pi takes a model's own api over its provider's, and posts it to baseUrl/responses), so the gateway relays what Pi sent as it is: reasoning effort and summary, its encrypted reasoning, images, tools, prompt_cache_key; a ChatGPT sign-in's still made into Codex CLI's request. Which API is a model's is provider.Native — what the provider serves it on itself, Responses first for an OpenAI model where the gateway already put it first (ResponsesFirst, moved from the gateway). Chat providers, groups, Cursor/Devin/Kiro/Claude Code sign-ins and Anthropic-API models stay on openai-completions: Pi's anthropic-messages picks thinking by the Claude ids it knows and asks a newer Claude for a thinking budget it refuses, which magpie's translation doesn't. Tested with Pi 0.73.1 and @earendil-works/pi-coding-agent 0.87.1 against a sandbox gateway and a fake Responses upstream: /v1/responses relayed with effort high, xhigh, none (thinking off); a Chat model still on /v1/chat/completions |