mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-30 14:51:17 +01:00
fix: disable strict mode for enhancement JSON schema
strict: true requires all property names to be known upfront, which is incompatible with the dynamic-key maps in slotFills. Also replace type array with anyOf for nullable slot values.
This commit is contained in:
@@ -46,7 +46,7 @@ export function createLlmClient(config: LlmClientConfig): LlmClient {
|
||||
type: "json_schema" as const,
|
||||
jsonSchema: {
|
||||
name: "enhancement_result",
|
||||
strict: true,
|
||||
strict: false,
|
||||
schema: enhancementResultJsonSchema,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -166,11 +166,12 @@ describe("schema sync", () => {
|
||||
expect(parseEnhancementResult(JSON.stringify(bad))).toBeNull()
|
||||
|
||||
// JSON Schema only allows string or null for slot values
|
||||
const slotValueTypes =
|
||||
const slotValueSchema =
|
||||
enhancementResultJsonSchema.properties.slotFills.additionalProperties
|
||||
.additionalProperties.type
|
||||
expect(slotValueTypes).toContain("string")
|
||||
expect(slotValueTypes).toContain("null")
|
||||
expect(slotValueTypes).not.toContain("number")
|
||||
.additionalProperties
|
||||
expect(slotValueSchema.anyOf).toEqual([
|
||||
{ type: "string" },
|
||||
{ type: "null" },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ export const enhancementResultJsonSchema = {
|
||||
additionalProperties: {
|
||||
type: "object",
|
||||
additionalProperties: {
|
||||
type: ["string", "null"],
|
||||
anyOf: [{ type: "string" }, { type: "null" }],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user