Type schema info for LLM (Large Language Model) function calling.
Overview
ILlmSchema is a type schema info for LLM function calling, designed to be
compatible with multiple LLM providers while following the JSON schema
specification.
Specification
ILlmSchema basically follows the JSON schema definition of the OpenAPI v3.1
specification; OpenApiV3_1.IJsonSchema.
However, it deviates from the standard JSON schema specification and omits
many features to ensure compatibility across different LLM providers and
their function calling requirements.
Differences from OpenAPI v3.1
Here is the list of how ILlmSchema is different with the OpenAPI v3.1 JSON
schema:
Type schema info for LLM (Large Language Model) function calling.
Overview
ILlmSchemais a type schema info for LLM function calling, designed to be compatible with multiple LLM providers while following the JSON schema specification.Specification
ILlmSchemabasically follows the JSON schema definition of the OpenAPI v3.1 specification; OpenApiV3_1.IJsonSchema.However, it deviates from the standard JSON schema specification and omits many features to ensure compatibility across different LLM providers and their function calling requirements.
Differences from OpenAPI v3.1
Here is the list of how
ILlmSchemais different with the OpenAPI v3.1 JSON schema:Differences from OpenApi.IJsonSchema
Compared to OpenApi.IJsonSchema, the emended JSON schema specification:
Strict Mode
When ILlmSchema.IConfig.strict mode is enabled, the schema transformation follows OpenAI's structured output requirements:
Every ILlmSchema.IObject.additionalProperties is forced to
falseEvery property in ILlmSchema.IObject.properties becomes ILlmSchema.IObject.required
All constraint properties are removed from the schema and moved to IJsonSchemaAttribute.description in a JSDoc-like format:
minimum,maximum,exclusiveMinimum,exclusiveMaximum,multipleOfminLength,maxLength,pattern,format,contentMediaTypeminItems,maxItems,uniqueItems@minimum 0,@maximum 100,@format uuid