f2eb56c6bbde1300dddc402861b59cd4e45e0215
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b1396d2360 |
gateway, provider, gui: a routing group of decision models answers /v1/systemone, failing over between them (ARNO on Discord)
ARNO asked for decision models to get the group feature too: /v1/systemone
took only "<provider>/<model>" (xxx/jev-latest), so one refusing key or
vendor failed the call with nothing to fall back on.
A routing group may now be of decision models alone (provider.Group.Decides,
provider/decide_group.go). SaveGroup refuses one mixed with models that hold
a conversation, a decision group inside a chat group, and patterns, rules,
classifier, effort, levels, fast mode or a member effort on it. It is kept
out of the agents' catalog (groupEntries), and a chat request to it gets a
400 pointing at /v1/systemone.
POST /v1/systemone with "model":"group/<id>" (or the group's id or name, as
GroupFor reads them) goes to serveDecisionGroup (gateway/decide_group.go):
- the members' keys and accounts are planned with planGroup in the group's
routing order, resting ones last; perKeyBarred no longer drops a
decision-only provider's keys (it speaks no chat protocol), so each key
is a try of its own;
- a gateway key's model and account limits and pause rules hold as for chat;
- a retryable failure that isn't the request's own (shape/prompt/protection)
rests the candidate via restAfter and the next is asked; a transport error
rests it as a 502; the last one's answer and Retry-After are passed on;
- every try is a Try of one route in the routing log; one usage row for the
answer.
A group classifier naming a decision group fails over the same way
(askDecisionGroup; systemOne now returns decideRefused with the vendor's
status, headers and body, and postDecide returns the headers).
The GUI group editor offers a group of decision models only decision models
(groups.deciders), a chat group no decision model or decision group, a new
one both, and a decision model's row has no reasoning picker (groupJSON
.decides). The TUI member picker and `magpie group add` follow the same rule.
#1514's plugin_decide_test and TestMixedDecisionProvider now assert a mixed group is refused and a group
of decision models saves. Docs: reference.md (routing groups),
gateway-routing.md, provider-plugins.md.
Run:
- go test -tags nogui -timeout 40m . ./internal/provider ./internal/gateway
./internal/gui ./internal/tui: ok
- new: TestSystemOneDecisionGroupFailsOver (httptest System One fakes: a
provider with two keys answering 429 and 503, then a second provider
answering 200: tries ka1,ka2,kb, both failures rested and ask by name
goes to kb first; all failing passes the last answer on; chat to the
group is 400), TestDecisionGroupClassifierFailsOver, TestDecisionGroup,
TestGroupAddDecisionModels, TestMemberOptionsDecisionGroup,
group-decide-members.test.cjs (Chromium and WebKit, en and zh; no new
strings)
- each broken by hand and seen red: no dispatch (404), no perKeyBarred
change (ka2 skipped), no classifier failover, no rest, decision group in
the catalog, CLI resolver, TUI and GUI picker filters
- GUI: group-*, routing-effort*, routing-levels, routing-save*,
routing-intent-entry, routing-manual, i18n-keys in both engines: 169 pass
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages
- after rebasing on
|
||
|
|
4b2f2ec31e |
provider, plugin: a plugin can serve System One for its provider, and the models it marks are a routing group's classifier (#1514, FourLeafTec)
A plugin had no way to say its provider answers TypeSafe's System One,
so a free decision model a plugin reaches (mu-zi-lee/magpie-our-free-model)
could only be listed as a chat model.
Now the plugin's config hook sets `decide: true` on the provider, and
`decides: true` on a model, in the config hook or on the models hook's
list. host.js passes both through (plugin.Provider.Decide,
plugin.Model.Decides). pluginProvider sets the provider's Decide to its
own base, plugin://<id>/v1, so System One is asked at {baseURL}/systemone
through the loader's fetch with the account's sign-in: pluginFetch sends
nowhere but the loader's host, so an address the plugin named itself
couldn't be reached. AskSystemOne now sends with Provider.Do, as the
gateway's classifier already did, so the editor's test goes through the
fetch too (Do is client.Do for every provider without an account).
decide.go treats a plugin provider's decision models as the ones it marks
plus Jev's by name (jev-*): kept from agents, refused for chat ("only
decides"), refused as a group member, offered as a group's classifier
(Deciders, DecisionModels, Jev). A mark without `decide` on the provider
changes nothing. Docs: site plugins page (en, zh, ja) and
docs/subsystems/provider-plugins.md.
Thanks to FourLeafTec, whose reference commit (bc0b3fee in their fork)
proposed the two fields and the plugin base; this is written afresh.
Run:
- internal/gateway TestPluginServesSystemOne and
TestPluginMarksWithoutDecide, through the real bun plugin host with the
fake plugin (FAKE_DECIDE). Red with host.js, plugins.go and decide.go
reverted ("Decide = \"\""), with only host.js reverted, and with only
decide.go reverted (no classifiers, offered to agents, chat to one 200).
- go test -tags nogui ./... (temp HOME): every package ok; internal/gateway
hit the 10m default at load ~140 in TestLargeRequestEndpoints, then
passed alone with -timeout 40m (548s).
- gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on
internal/plugin, internal/provider, internal/gateway.
- Real use: a nogui build in a sandbox HOME on 127.0.0.1:3612, a local
plugin declaring decide with judge-x marked, a fake vendor on 3613.
`magpie group rule add ... classifier=dec1514/judge-x` saved; judge-x
was not in /v1/models and not accepted as a member; a turn to the group
asked /v1/systemone judge-x (levels, then intent) with the plugin's key
and its fetch's own header, then went to chat-b; chat to judge-x
answered 400 "only decides".
- No GUI change: a plugin's editor is the account editor, which has no
address fields.
Co-authored-by: FourLeafTec <5875432+FourLeafTec@users.noreply.github.com>
|