@@ -363,23 +363,6 @@ func embeddingsEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
363363}
364364
365365func chatEndpoint (cm * ConfigMerger , o * Option ) func (c * fiber.Ctx ) error {
366- // TODO: replace this with config settings
367- // Allow the user to set custom actions via config file
368- // to be "embedded" in each model
369- const noActionName = "answer"
370- const noActionDescription = "use this action to answer without performing any action"
371-
372- noActionGrammar := grammar.Function {
373- Name : noActionName ,
374- Description : noActionDescription ,
375- Parameters : map [string ]interface {}{
376- "properties" : map [string ]interface {}{
377- "message" : map [string ]interface {}{
378- "type" : "string" ,
379- "description" : "The message to reply the user with" ,
380- }},
381- },
382- }
383366
384367 process := func (s string , req * OpenAIRequest , config * Config , loader * model.ModelLoader , responses chan OpenAIResponse ) {
385368 initialMessage := OpenAIResponse {
@@ -423,9 +406,34 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
423406
424407 processFunctions = true
425408
409+ // TODO: replace this with config settings
410+ // Allow the user to set custom actions via config file
411+ // to be "embedded" in each model
412+ noActionName := "answer"
413+ noActionDescription := "use this action to answer without performing any action"
414+
415+ if config .FunctionsConfig .NoActionFunctionName != "" {
416+ noActionName = config .FunctionsConfig .NoActionFunctionName
417+ }
418+ if config .FunctionsConfig .NoActionDescriptionName != "" {
419+ noActionDescription = config .FunctionsConfig .NoActionDescriptionName
420+ }
421+
422+ noActionGrammar := grammar.Function {
423+ Name : noActionName ,
424+ Description : noActionDescription ,
425+ Parameters : map [string ]interface {}{
426+ "properties" : map [string ]interface {}{
427+ "message" : map [string ]interface {}{
428+ "type" : "string" ,
429+ "description" : "The message to reply the user with" ,
430+ }},
431+ },
432+ }
433+
426434 // Append the no action function
427435 funcs = append (funcs , input .Functions ... )
428- if ! config .DisableDefaultAnswer {
436+ if ! config .FunctionsConfig . DisableNoAction {
429437 funcs = append (funcs , noActionGrammar )
430438 }
431439
0 commit comments