Type Alias: GbnfJsonObjectSchema<Keys>
type GbnfJsonObjectSchema<Keys> = {
type: "object";
properties: { readonly [key in Keys]: GbnfJsonSchema };
additionalProperties: boolean | GbnfJsonSchema;
minProperties: number;
maxProperties: number;
required: readonly Keys[];
description: string;
};
Defined in: utils/gbnfJson/types.ts:81
Type Parameters
Type Parameter | Default type |
---|---|
Keys extends string | string |
Type declaration
type
readonly type: "object";
properties?
readonly optional properties: { readonly [key in Keys]: GbnfJsonSchema };
additionalProperties?
readonly optional additionalProperties: boolean | GbnfJsonSchema;
Unlike the JSON Schema spec, additionalProperties
defaults to false
to avoid breaking existing code.
minProperties?
readonly optional minProperties: number;
Make sure you define additionalProperties
for this to have any effect.
When using minProperties
and/or maxProperties
, ensure to inform the model as part of the prompt what your expectations are regarding the number of keys in the object. Not doing this may lead to hallucinations.
maxProperties?
readonly optional maxProperties: number;
Make sure you define additionalProperties
for this to have any effect.
When using minProperties
and/or maxProperties
, ensure to inform the model as part of the prompt what your expectations are regarding the number of keys in the object. Not doing this may lead to hallucinations.
required?
readonly optional required: readonly Keys[];
required
is always set to all keys in properties
, and setting it has no effect.
This limitation is due to how the generation works, and may be fixed in the future.
This key is part of the type to avoid breaking exiting code (though it was never actually used in the past), and will be removed in the future.
Deprecated
description?
readonly optional description: string;
A description of what you expect the model to set this value to.
Only passed to the model when using function calling, and has no effect when using JSON Schema grammar directly.