mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 02:24:59 +00:00
feat(llama.cpp): Add support to grammar triggers (#4733)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
d79f02ea09
commit
1d6afbd65d
4 changed files with 46 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue