MCPcopy Create free account
hub / github.com/Effect-TS/effect / supportsType

Function supportsType

packages/effect/src/unstable/ai/OpenAiStructuredOutput.ts:103–127  ·  view source on GitHub ↗
(key: string, type: unknown)

Source from the content-addressed store, hash-verified

101}
102
103function supportsType(key: string, type: unknown): boolean {
104 if (typeof type !== "string") return true
105 switch (key) {
106 case "pattern":
107 case "format":
108 return type === "string"
109 case "multipleOf":
110 case "minimum":
111 case "exclusiveMinimum":
112 case "maximum":
113 case "exclusiveMaximum":
114 return type === "number" || type === "integer"
115 case "items":
116 case "minItems":
117 case "maxItems":
118 return type === "array"
119 case "properties":
120 case "patternProperties":
121 case "required":
122 case "additionalProperties":
123 return type === "object"
124 default:
125 return true
126 }
127}
128
129function normalizeAllOf(schema: JsonSchema.JsonSchema): JsonSchema.JsonSchema {
130 if (!Array.isArray(schema.allOf)) return schema

Callers 1

rewriteOpenAIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected