mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-23 20:14:59 +00:00
Add grammar_json to the request parameters to facilitate JSON generation
This commit is contained in:
parent
483fddccf9
commit
55befe396a
4 changed files with 11 additions and 6 deletions
|
@ -211,12 +211,12 @@ type Item struct {
|
|||
Properties Properties `json:"properties"`
|
||||
}
|
||||
|
||||
type JSONStructure struct {
|
||||
type JSONFunctionStructure struct {
|
||||
OneOf []Item `json:"oneOf,omitempty"`
|
||||
AnyOf []Item `json:"anyOf,omitempty"`
|
||||
}
|
||||
|
||||
func (j JSONStructure) Grammar(propOrder string) string {
|
||||
func (j JSONFunctionStructure) Grammar(propOrder string) string {
|
||||
dat, _ := json.Marshal(j)
|
||||
return NewJSONSchemaConverter(propOrder).GrammarFromBytes(dat)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue