kimi-code
kimi-code copied to clipboard
fix(provider): ensure OpenAI tool schemas use array required
Summary
- OpenAI-compatible relays that forward to Moonshot backends validate tool parameters as Moonshot-flavored JSON Schema.
- With
providers.*.type = "openai",toolToOpenAIpreviously passed toolparametersthrough unchanged. - If any object schema had missing / non-array
required, the upstream returns:
400 Invalid request: ***.***.parameters is not a valid moonshot flavored json schema
details: <At path 'required': required must be an array>
- This PR makes
toolToOpenAIforcerequired: []ontype: "object"nodes whenrequiredis missing or not an array (bothpackages/kosongandpackages/agent-core-v2). - The
type = "kimi"path already runsnormalizeKimiToolSchema; this closes the gap for the OpenAI wire used by third-party relays.
Test plan
- [x]
pnpm --filter @moonshot-ai/kosong exec vitest run test/providers/openai-common-tool-schema.test.ts - [ ] CI full suite on this PR
- [ ] Manual:
kimiwithtype = "openai"against a Moonshot-strict relay, ensure tool-enabled turns no longer 400 onrequired
Notes
This is a focused wire-format compatibility fix. It does not change Anthropic/Google tool conversion.
🦋 Changeset detected
Latest commit: 420dc202fe5e017070308680f46a319c0025616f
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @moonshot-ai/kimi-code | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR