Class: LlamaJsonSchemaGrammar<T>
Defined in: evaluator/LlamaJsonSchemaGrammar.ts:13
See
Extends
Type Parameters
Type Parameter |
---|
T extends GbnfJsonSchema |
Constructors
new LlamaJsonSchemaGrammar()
ts
new LlamaJsonSchemaGrammar<T>(llama: Llama, schema: Readonly<T>): LlamaJsonSchemaGrammar<T>
Defined in: evaluator/LlamaJsonSchemaGrammar.ts:20
Prefer to create a new instance of this class by using llama.createGrammarForJsonSchema(...)
.
Parameters
Parameter | Type |
---|---|
llama | Llama |
schema | Readonly <T > |
Returns
Deprecated
Use llama.createGrammarForJsonSchema(...)
instead.
Overrides
Accessors
grammar
Get Signature
ts
get grammar(): string
Defined in: evaluator/LlamaGrammar.ts:64
Returns
string
Inherited from
rootRuleName
Get Signature
ts
get rootRuleName(): string
Defined in: evaluator/LlamaGrammar.ts:68
Returns
string
Inherited from
stopGenerationTriggers
Get Signature
ts
get stopGenerationTriggers(): readonly (
| string
| LlamaText
| readonly (string | Token)[])[]
Defined in: evaluator/LlamaGrammar.ts:72
Returns
readonly ( | string
| LlamaText
| readonly (string
| Token
)[])[]
Inherited from
LlamaGrammar
.stopGenerationTriggers
trimWhitespaceSuffix
Get Signature
ts
get trimWhitespaceSuffix(): boolean
Defined in: evaluator/LlamaGrammar.ts:76
Returns
boolean
Inherited from
LlamaGrammar
.trimWhitespaceSuffix
schema
Get Signature
ts
get schema(): Readonly<T>
Defined in: evaluator/LlamaJsonSchemaGrammar.ts:32
Returns
Readonly
<T
>
Methods
getFor()
ts
static getFor(llama: Llama, type:
| "json"
| "json_arr"
| "english"
| "list"
| "c"
| "arithmetic"
| "japanese"
| "chess"): Promise<LlamaGrammar>
Defined in: evaluator/LlamaGrammar.ts:88
Parameters
Parameter | Type |
---|---|
llama | Llama |
type | | "json" | "json_arr" | "english" | "list" | "c" | "arithmetic" | "japanese" | "chess" |
Returns
Inherited from
parse()
ts
parse(json: string): GbnfJsonSchemaToType<T>
Defined in: evaluator/LlamaJsonSchemaGrammar.ts:36
Parameters
Parameter | Type |
---|---|
json | string |