Skip to content

OpenAIJsonSchema

Namespace: Vercel.AI.OpenAI

public static class OpenAIJsonSchema

Removes JSON Schema keywords OpenAI does not enforce: string propertyNames and regex lookaround in pattern.

Inheritance: object

View source

public const string LookaroundDetails = "OpenAI does not support regex lookaround in JSON Schema patterns. The pattern was removed before sending the schema, so OpenAI will not enforce that constraint."

The warning OpenAI emits when a lookaround pattern is removed.

Value: string

View source

public const string PropertyNamesDetails = "OpenAI does not support JSON Schema propertyNames. It was removed before sending the schema, so OpenAI will not enforce property-name constraints."

The warning OpenAI emits when propertyNames is removed.

Value: string

View source

public static bool ContainsRegexLookaround(string pattern)

True when <code class=“paramref”>pattern</code> contains an unescaped regex lookaround.

Parameters

Name Type Description
pattern string

Returns: bool

View source

public static OpenAIJsonSchemaResult Normalize(JsonElement schema)

Returns a copy of <code class=“paramref”>schema</code> safe to send to OpenAI.

Parameters

Name Type Description
schema JsonElement

Returns: OpenAIJsonSchemaResult

View source

public static OpenAIJsonSchemaResult Normalize(JsonNode schema)

Returns a copy of <code class=“paramref”>schema</code> safe to send to OpenAI.

Parameters

Name Type Description
schema JsonNode

Returns: OpenAIJsonSchemaResult

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product