feat(ai): support custom reasoning fields (#38227)

This commit is contained in:
Aiden Cline 2026-07-21 23:42:59 -05:00 committed by GitHub
commit 23483ea013
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 306 additions and 67 deletions

View file

@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
import { Schema } from "effect"
import { Model } from "../src/model.js"
describe("Model.Ref", () => {
@ -20,3 +21,12 @@ describe("Model.Ref", () => {
expect(() => Model.Ref.parse("openai/gpt-5#high#extra")).toThrow()
})
})
describe("Model.ReasoningField", () => {
test("accepts suggested and custom fields", () => {
const decode = Schema.decodeUnknownSync(Model.ReasoningField)
for (const field of ["reasoning", "reasoning_content", "reasoning_text", "vendor_reasoning"])
expect(decode(field)).toBe(field)
})
})