Skip to content

Commit

Permalink
Add a way to disable default action
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Jul 9, 2023
1 parent bbc4468 commit b3f43ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type Config struct {
MainGPU string `yaml:"main_gpu"`
ImageGenerationAssets string `yaml:"asset_dir"`

DisableDefaultAnswer bool `yaml:"disable_default_answer"`

PromptCachePath string `yaml:"prompt_cache_path"`
PromptCacheAll bool `yaml:"prompt_cache_all"`
PromptCacheRO bool `yaml:"prompt_cache_ro"`
Expand Down Expand Up @@ -269,7 +271,6 @@ func updateConfig(config *Config, input *OpenAIRequest) {
}
}
}

// Can be either a string or an object
switch fnc := input.FunctionCall.(type) {
case string:
Expand Down
4 changes: 3 additions & 1 deletion api/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {

// Append the no action function
funcs = append(funcs, input.Functions...)
funcs = append(funcs, noActionGrammar)
if !config.DisableDefaultAnswer {
funcs = append(funcs, noActionGrammar)
}

// Force picking one of the functions by the request
if config.functionCallNameString != "" {
Expand Down

0 comments on commit b3f43ab

Please sign in to comment.