mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-04 09:42:53 +00:00
feat(grammar): expose properties_order (#2662)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
a8bfb6f9c2
commit
3eaf59021c
@ -42,3 +42,9 @@ func SetPrefix(suffix string) func(*GrammarOption) {
|
|||||||
o.Prefix = suffix
|
o.Prefix = suffix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetPropOrder(order string) func(*GrammarOption) {
|
||||||
|
return func(o *GrammarOption) {
|
||||||
|
o.PropOrder = order
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,11 @@ type GrammarConfig struct {
|
|||||||
|
|
||||||
// ExpectStringsAfterJSON enables mixed string suffix
|
// ExpectStringsAfterJSON enables mixed string suffix
|
||||||
ExpectStringsAfterJSON bool `yaml:"expect_strings_after_json"`
|
ExpectStringsAfterJSON bool `yaml:"expect_strings_after_json"`
|
||||||
|
|
||||||
|
// PropOrder selects what order to print properties
|
||||||
|
// for instance name,arguments will make print { "name": "foo", "arguments": { "bar": "baz" } }
|
||||||
|
// instead of { "arguments": { "bar": "baz" }, "name": "foo" }
|
||||||
|
PropOrder string `yaml:"properties_order"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FunctionsConfig is the configuration for the tool/function call.
|
// FunctionsConfig is the configuration for the tool/function call.
|
||||||
@ -104,6 +109,8 @@ func (g GrammarConfig) Options() []func(o *GrammarOption) {
|
|||||||
if g.ExpectStringsAfterJSON {
|
if g.ExpectStringsAfterJSON {
|
||||||
opts = append(opts, ExpectStringsAfterJSON)
|
opts = append(opts, ExpectStringsAfterJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts = append(opts, SetPropOrder(g.PropOrder))
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user