chore: generate
This commit is contained in:
@@ -25,7 +25,8 @@ export const optionalNull = <const S extends Schema.Top>(schema: S) => Schema.op
|
|||||||
/** OpenAI function schemas require one flat object at the top level. */
|
/** OpenAI function schemas require one flat object at the top level. */
|
||||||
export const openAiToolInputSchema = (schema: JsonSchema.JsonSchema): JsonSchema.JsonSchema => {
|
export const openAiToolInputSchema = (schema: JsonSchema.JsonSchema): JsonSchema.JsonSchema => {
|
||||||
const variants = Array.isArray(schema.anyOf) ? schema.anyOf.filter(isRecord) : []
|
const variants = Array.isArray(schema.anyOf) ? schema.anyOf.filter(isRecord) : []
|
||||||
const flattened = variants.length === 0
|
const flattened =
|
||||||
|
variants.length === 0
|
||||||
? { ...schema, type: "object" }
|
? { ...schema, type: "object" }
|
||||||
: {
|
: {
|
||||||
...Object.fromEntries(Object.entries(schema).filter(([key]) => key !== "anyOf")),
|
...Object.fromEntries(Object.entries(schema).filter(([key]) => key !== "anyOf")),
|
||||||
|
|||||||
Reference in New Issue
Block a user