From 2a96232f99e27c873703011550ed7ddb82f465e1 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Fri, 19 Jul 2024 09:07:29 +0200 Subject: [PATCH] feat(grammar): mark grammar disabled by default Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/openai/chat.go | 2 +- gallery/mudler.yaml | 3 ++- pkg/functions/parse.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/http/endpoints/openai/chat.go b/core/http/endpoints/openai/chat.go index f63a991319d..f0088d2a691 100644 --- a/core/http/endpoints/openai/chat.go +++ b/core/http/endpoints/openai/chat.go @@ -201,7 +201,7 @@ func ChatEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, startup } switch { - case !config.FunctionsConfig.GrammarConfig.NoGrammar && shouldUseFn: + case config.FunctionsConfig.GrammarConfig.EnableGrammar && shouldUseFn: noActionGrammar := functions.Function{ Name: noActionName, Description: noActionDescription, diff --git a/gallery/mudler.yaml b/gallery/mudler.yaml index 77bdc8eb4b6..3ca8595a481 100644 --- a/gallery/mudler.yaml +++ b/gallery/mudler.yaml @@ -10,7 +10,8 @@ config_file: |- - <|end_of_text|> function: - return_name_in_function_response: true + grammar: + enable: true template: chat: | diff --git a/pkg/functions/parse.go b/pkg/functions/parse.go index 8e848a60b1f..585bee4f39d 100644 --- a/pkg/functions/parse.go +++ b/pkg/functions/parse.go @@ -25,8 +25,8 @@ type GrammarConfig struct { // In this way if the LLM selects a free string, it won't be mixed necessarly with JSON objects NoMixedFreeString bool `yaml:"no_mixed_free_string"` - // NoGrammar disables the grammar parsing and parses the responses directly from the LLM - NoGrammar bool `yaml:"disable"` + // EnableGrammar disables the grammar parsing and parses the responses directly from the LLM + EnableGrammar bool `yaml:"enable"` // Prefix is the suffix to append to the grammar when being generated // This is useful when models prepend a tag before returning JSON