Anotiaww on X: LobeHub's OpenAI provider, pointed at magpie, asked a
Codex model on Responses and got "Codex: Invalid schema for
'tools[3].parameters': oneOf constraints are not supported. Enable
'coerce_one_of' option to approximate oneOf with anyOf".
Cause: LobeHub sends its tools on Responses with no strict
(convertChatCompletionToolToResponseTool spreads the function, no
strict), and magpie passed them to the ChatGPT backend so. Left out,
the backend compiles a tool's parameters as a strict grammar; its
calculator's defintegrate bounds and limit's point are a oneOf of
string and number. Codex CLI itself says "strict": false on every
function tool (codex-rs/tools ResponsesApiTool). A Chat or Messages
client asking strict true with a schema strict mode refuses (calculate's
optional precision, an allOf, a lookaround) was turned away the same way.
Fix, in codexBody, so every route to a Codex account (Responses relayed,
Chat and Messages built as Responses) passes it: a function tool's
strict left out goes false, as Codex says it; strict true is kept when
the schema fits strict mode, with a oneOf asked as anyOf (the backend's
own suggestion); a schema strict mode still can't take goes as written
with strict false. Namespace tools, additional_tools and
tool_search_output are covered. coerce_one_of is not used: it is nowhere
in Codex's source or any docs found. Other vendors are unchanged.
What strict mode takes was tried on the backend (2026-11-19, the
owner's ChatGPT account, gpt-5.6-luna and gpt-6-sol among others):
refused with strict true: oneOf, allOf, not, if, uniqueItems,
minProperties, contains, propertyNames, dependentRequired, an optional
property, additionalProperties not false, a root anyOf, a lookaround, a
node with only a const ("schema must specify a type"); taken: anyOf
(nested, in items, in $defs), $ref, enum alone, a type list, const with
a type, min/max keywords, format, pattern, $schema, title, examples.
Left out, a lookaround is refused and false takes it.
Run:
- go test ./internal/provider -run TestCodexToolStrict,
./internal/gateway -run 'TestCodexToolSchemasTheBackendCompiles|
TestToolStrictOnlyForCodex': ok on mica.
- go vet ./internal/provider ./internal/gateway for darwin, linux and
windows: ok on mica. gofmt -l: clean.
- Real backend: LobeHub's 10 calculator tools as this change sends them
(strict false on Responses; strict true from a Chat client, defintegrate
kept strict as anyOf; calculate, evaluate, sort, limit and solve,
which have optional properties, false)
and a mixed set (oneOf nested in items and $defs, a const-only oneOf,
an allOf, a lookaround): 200 on gpt-5.6-luna and gpt-6-sol. The old
strict-true request was refused ("required must include declared
property precision"). That run found the const-only case, fixed here.
Broken by hand: with the codexToolStrict call removed, the gateway
test is red with the reporter's message word for word (tools[5],
defintegrate). TestToolStrictOnlyForCodex passes on the old code too;
it guards scope (OpenAI's API, a relay and a Chat provider keep strict
left out and the oneOf).
Not tried: the reporter's exact 400 could not be reproduced on this
account, where a oneOf with strict left out was taken on every model
tried; the lookaround case shows the same rule. LobeHub itself was not
run. The full suite runs after the tag (mote load 28 on 18 cores, mica
in another session's suite); its result goes in a follow-up.
306 lines
8.0 KiB
JSON
306 lines
8.0 KiB
JSON
[
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____calculate____builtin",
|
|
"description": "Calculate result of a mathematical expression.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to calculate (e.g., \"2 + 3 * 4\", \"sqrt(16)\", \"sin(30 deg)\", \"det([[1,2],[3,4]])\", \"5 cm to inch\")",
|
|
"type": "string"
|
|
},
|
|
"precision": {
|
|
"description": "Number of decimal places for result (optional, defaults to 10)",
|
|
"maximum": 20,
|
|
"minimum": 0,
|
|
"type": "number"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____evaluate____builtin",
|
|
"description": "Evaluate a complex mathematical expression with variable support.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to evaluate (e.g., \"x^2 + 2*x + 1\", \"det([[a,b],[c,d]])\", \"sqrt(a^2 + b^2)\")",
|
|
"type": "string"
|
|
},
|
|
"precision": {
|
|
"description": "Number of decimal places for result (optional, defaults to 10)",
|
|
"maximum": 20,
|
|
"minimum": 0,
|
|
"type": "number"
|
|
},
|
|
"variables": {
|
|
"description": "Key-value pairs of variables to substitute in expression (e.g., {\"x\": 5, \"r\": 3})",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____sort____builtin",
|
|
"description": "Sort multiple numbers with flexible output options (sorted array, largest value, or smallest value).",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"mode": {
|
|
"description": "Optional mode: \"largest\" returns only largest value; \"smallest\" returns only smallest value; if not specified, returns sorted array",
|
|
"enum": [
|
|
"largest",
|
|
"smallest"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"numbers": {
|
|
"description": "Array of numbers to compare (e.g., [\"3.14\", \"2.718\", \"1.618\"] or [3.14, 2.718, 1.618])",
|
|
"items": {
|
|
"type": [
|
|
"string",
|
|
"number"
|
|
]
|
|
},
|
|
"minItems": 2,
|
|
"type": "array"
|
|
},
|
|
"precision": {
|
|
"description": "Number of decimal places for comparison results (optional, defaults to 10)",
|
|
"maximum": 20,
|
|
"minimum": 0,
|
|
"type": "number"
|
|
},
|
|
"reverse": {
|
|
"description": "Sort order: false (default) sorts ascending (smallest to largest); true sorts descending (largest to smallest)",
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"numbers"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____base____builtin",
|
|
"description": "Convert numbers between different number bases.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"fromBase": {
|
|
"description": "Source base of the input number (numeric value between 2-36)",
|
|
"maximum": 36,
|
|
"minimum": 2,
|
|
"type": "number"
|
|
},
|
|
"number": {
|
|
"description": "The number to convert (string or number, e.g., \"1010\", 1010, \"77\", \"255\", \"FF\", \"Z\")",
|
|
"type": [
|
|
"string",
|
|
"number"
|
|
]
|
|
},
|
|
"toBase": {
|
|
"description": "Target base for conversion (numeric value between 2-36)",
|
|
"maximum": 36,
|
|
"minimum": 2,
|
|
"type": "number"
|
|
}
|
|
},
|
|
"required": [
|
|
"number",
|
|
"fromBase",
|
|
"toBase"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____differentiate____builtin",
|
|
"description": "Differentiate a mathematical expression with respect to a variable.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to differentiate (e.g., \"x^2\", \"sin(x)\", \"x^3 + 2*x + 1\")",
|
|
"type": "string"
|
|
},
|
|
"variable": {
|
|
"description": "Variable to differentiate with respect to (e.g., \"x\", \"y\", \"t\")",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression",
|
|
"variable"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____defintegrate____builtin",
|
|
"description": "Compute definite integral of a mathematical expression with respect to a variable over a given interval.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to integrate (e.g., \"x^2\", \"sin(x)\", \"exp(x)\")",
|
|
"type": "string"
|
|
},
|
|
"lowerBound": {
|
|
"description": "Lower bound of integration (can be number, \"0\", \"-infinity\", etc.)",
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "number"
|
|
}
|
|
]
|
|
},
|
|
"upperBound": {
|
|
"description": "Upper bound of integration (can be number, \"pi\", \"infinity\", etc.)",
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "number"
|
|
}
|
|
]
|
|
},
|
|
"variable": {
|
|
"description": "Variable to integrate with respect to (e.g., \"x\", \"y\", \"t\")",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression",
|
|
"variable",
|
|
"lowerBound",
|
|
"upperBound"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____integrate____builtin",
|
|
"description": "Integrate a mathematical expression with respect to a variable (indefinite integral).",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to integrate (e.g., \"x^2\", \"sin(x)\", \"exp(x)\")",
|
|
"type": "string"
|
|
},
|
|
"variable": {
|
|
"description": "Variable to integrate with respect to (e.g., \"x\", \"y\", \"t\")",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression",
|
|
"variable"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____execute____builtin",
|
|
"description": "Execute a generic nerdamer expression for symbolic math computations.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Nerdamer expression to execute (e.g., \"expand((x+1)^2)\", \"factor(x^2-1)\", \"partfrac(1/(x^2-1))\")",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____limit____builtin",
|
|
"description": "Compute the limit of a mathematical expression.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"expression": {
|
|
"description": "Mathematical expression to compute limit for (e.g., \"sin(x)/x\", \"x^2\", \"exp(-x)\")",
|
|
"type": "string"
|
|
},
|
|
"point": {
|
|
"description": "Point at which to evaluate the limit (optional). If not specified, computes the limit as variable approaches the expression. Can be a specific value or \"infinity\" (e.g., \"0\", \"1\", \"infinity\")",
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "number"
|
|
}
|
|
]
|
|
},
|
|
"variable": {
|
|
"description": "Variable to compute limit with respect to (e.g., \"x\", \"y\", \"t\")",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"expression",
|
|
"variable"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"name": "lobe-calculator____solve____builtin",
|
|
"description": "Solve algebraic equations or systems of equations symbolically.",
|
|
"parameters": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"equation": {
|
|
"description": "The equation(s) to solve. Single equation (e.g., [\"x^2 + 2*x + 1 = 0\"]) or system of equations (e.g., [\"2*x+y=5\", \"x-y=1\"])",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"variable": {
|
|
"description": "Variable(s) to solve for. For single equation: array with one variable (optional, defaults to [\"x\"], e.g., [\"x\"]). For system of equations: array of variables (e.g., [\"x\", \"y\"])",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
}
|
|
},
|
|
"required": [
|
|
"equation"
|
|
],
|
|
"type": "object"
|
|
}
|
|
}
|
|
]
|