EdgeAIG/opencode / .opencode /node_modules /effect /dist /unstable /ai /OpenAiStructuredOutput.d.ts
EdgeAIG's picture
download
raw
1.46 kB
import * as JsonSchema from "../../JsonSchema.ts";
import * as Schema from "../../Schema.ts";
/**
* Converts a `Schema.Codec` to OpenAI structured-output JSON Schema and a
* matching codec for model output.
*
* **When to use**
*
* Use when you send Effect Schema-backed structured output requests to OpenAI
* and need provider-compatible JSON Schema without losing the decoded
* application type.
*
* **Details**
*
* Returns the JSON Schema to include in the request and the codec to use when
* decoding the model response. If the input schema already fits OpenAI's
* supported JSON Schema subset, the original codec is returned unchanged.
*
* **Gotchas**
*
* - Some schemas use a provider-safe encoded shape: tuples become objects with
* numeric string keys, records become arrays of `[key, value]` pairs, and
* optional properties become required nullable properties.
* - `oneOf` unions are emitted as `anyOf` unions.
* - Regex patterns from multiple filters are merged into one `pattern` because
* OpenAI structured output does not support `allOf`.
* - Unsupported schema kinds throw during conversion instead of producing a
* lossy schema.
*
* @category Codec Transformation
* @since 4.0.0
*/
export declare function toCodecOpenAI<T, E, RD, RE>(schema: Schema.Codec<T, E, RD, RE>): {
codec: Schema.Codec<T, unknown, RD, RE>;
jsonSchema: JsonSchema.JsonSchema;
};
//# sourceMappingURL=OpenAiStructuredOutput.d.ts.map

Xet Storage Details

Size:
1.46 kB
·
Xet hash:
22a15ecac1e96d81ff391228be38a05595d355a8d62f07a65d86f4754dbd28d8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.