mirror of
https://github.com/mudler/LocalAI.git
synced 2026-02-21 18:58:59 -06:00
feat(llama.cpp): Add support to grammar triggers (#4733)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
committed by
GitHub
parent
d79f02ea09
commit
1d6afbd65d
@@ -47,6 +47,14 @@ type GrammarConfig struct {
|
||||
// SchemaType can be configured to use a specific schema type to force the grammar
|
||||
// available : json, llama3.1
|
||||
SchemaType string `yaml:"schema_type"`
|
||||
|
||||
GrammarTriggers []GrammarTrigger `yaml:"triggers"`
|
||||
}
|
||||
|
||||
type GrammarTrigger struct {
|
||||
// Trigger is the string that triggers the grammar
|
||||
Word string `yaml:"word"`
|
||||
AtStart bool `yaml:"at_start"`
|
||||
}
|
||||
|
||||
// FunctionsConfig is the configuration for the tool/function call.
|
||||
@@ -361,6 +369,6 @@ func ParseFunctionCallArgs(functionArguments string, functionConfig FunctionsCon
|
||||
}
|
||||
|
||||
jsonBytes, _ := json.Marshal(args)
|
||||
|
||||
|
||||
return string(jsonBytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user