t3-code-android-nightly/.repos/effect-smol/packages/effect/test/ai/LanguageModelRepresentation.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

24 lines
864 B
TypeScript

import { assert, describe, it } from "@effect/vitest"
import { Schema } from "effect"
import { LanguageModel } from "effect/ai"
describe("LanguageModel representation v2", () => {
it("projects the encoded side before JSON Schema generation", () => {
assert.strictEqual(LanguageModel.defaultCodecTransformer(Schema.FiniteFromString).jsonSchema.type, "string")
})
it("uses custom JSON Schema compiler annotations in the default transformer", () => {
const schema = Schema.String.check(Schema.makeFilter<string>((value) => value.length >= 2, {
representation: {
id: "test/ai/language-model/minTwoCharacters",
payload: null
},
toJsonSchema: () => ({ minLength: 2 })
}))
assert.deepStrictEqual(LanguageModel.defaultCodecTransformer(schema).jsonSchema, {
type: "string",
minLength: 2
})
})
})