@@ -363,23 +363,6 @@ func embeddingsEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
363
363
}
364
364
365
365
func 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
- }
383
366
384
367
process := func (s string , req * OpenAIRequest , config * Config , loader * model.ModelLoader , responses chan OpenAIResponse ) {
385
368
initialMessage := OpenAIResponse {
@@ -423,9 +406,34 @@ func chatEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
423
406
424
407
processFunctions = true
425
408
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
+
426
434
// Append the no action function
427
435
funcs = append (funcs , input .Functions ... )
428
- if ! config .DisableDefaultAnswer {
436
+ if ! config .FunctionsConfig . DisableNoAction {
429
437
funcs = append (funcs , noActionGrammar )
430
438
}
431
439
0 commit comments