Google's Schema takes an anyOf alone: a tool whose parameters carry a
description beside an anyOf is turned away with "Unable to submit
request because `tool` functionDeclaration `parameters.response` schema
specified other fields alongside any_of. When using any_of, it must be
the only field set." Asked straight, Google points at
function_declarations[N].parameters, which shapeWords reads. A relay
(sub2api, TokenFree) passing Google's words on writes them camel-case,
the field in backticks and no path, so the 400 went back to the client
and the group's later members, a non-Gemini fallback among them, were
never asked (#5374, worksyang, with the two-channel comparison and the
one-line fix).
shapeWords now also reads "schema specified other fields alongside
any_?of" (any_of and anyOf). The next member is asked once and the relay
doesn't rest (failShape), as for every shape refusal. A plain "messages:
field required" and Google's "Invalid function name" 400 stay the
request's.
Run (mote, testenv sandbox HOME):
- TestGroupFailsOverAnAnyOfSchemaRefused with fallback.go put back to
4e7661adc: FAIL, gemini_anyof_fallback_test.go:39 "400 ... (a 1, b 0)"
(the relay's 400 went to the client, b never asked). With the change:
ok.
- go test -tags nogui -run 'AnyOf|Shape|Fallback|Retryable|Group'
./internal/gateway/: ok 65.5s.
- gofmt -l on both files: nothing. go vet, GOOS=linux go vet -tags nogui,
GOOS=windows go vet on ./internal/gateway/: clean.
Not tried: a real TokenFree / sub2api relay in front of Google (no such
credentials here); the wording is the reporter's gateway log. The full
suite is not run in this commit.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>