diff --git a/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj b/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj index 53518b38..9262828f 100644 --- a/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj +++ b/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Plugins/BotSharp.Plugin.Planner/Functions/PrimaryStagePlanFn.cs b/src/Plugins/BotSharp.Plugin.Planner/Functions/PrimaryStagePlanFn.cs index 664ad7b9..84378158 100644 --- a/src/Plugins/BotSharp.Plugin.Planner/Functions/PrimaryStagePlanFn.cs +++ b/src/Plugins/BotSharp.Plugin.Planner/Functions/PrimaryStagePlanFn.cs @@ -96,9 +96,6 @@ public class PrimaryStagePlanFn : IFunctionCallback var conv = _services.GetRequiredService(); var wholeDialogs = conv.GetDialogHistory(); - // Append text - wholeDialogs.Last().Content += "\n\nYou must analyze the table description to infer the table relations. Only output the JSON result."; - var completion = CompletionProvider.GetChatCompletion(_services, provider: plannerAgent.LlmConfig.Provider, model: plannerAgent.LlmConfig.Model); diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlValidateFn.cs b/src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlValidateFn.cs index 8778b5a5..a1c4dca9 100644 --- a/src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlValidateFn.cs +++ b/src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlValidateFn.cs @@ -74,7 +74,7 @@ public class SqlValidateFn : IFunctionCallback Message = "Correct SQL Statement", Data = new Dictionary { - { "original_sql", validateSql }, + { "original_sql", sql }, { "error_message", ex.Message }, { "table_structure", ddl } } diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/verify_dictionary_term.json b/src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/verify_dictionary_term.json index 0e79a2fe..871210a2 100644 --- a/src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/verify_dictionary_term.json +++ b/src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/verify_dictionary_term.json @@ -18,13 +18,13 @@ }, "tables": { "type": "array", - "description": "all related dictionary tables", + "description": "all related dictionary tables must be from related knowledge in the context", "items": { "type": "string", - "description": "table name" + "description": "table name from related knowledge in the context" } } }, "required": [ "sql_statement", "reason", "tables" ] } -} \ No newline at end of file +} diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioVoiceController.cs b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioVoiceController.cs index dd3db295..4f91b81b 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioVoiceController.cs +++ b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioVoiceController.cs @@ -43,14 +43,10 @@ public class TwilioVoiceController : TwilioController } VoiceResponse response = null; - request.ConversationId = $"TwilioVoice_{request.CallSid}"; - var instruction = new ConversationalVoiceResponse { SpeechPaths = ["twilio/welcome.mp3"], - CallbackPath = $"twilio/voice/{request.ConversationId}/receive/0?{GenerateStatesParameter(request.States)}", - ActionOnEmptyResult = true, - Timeout = 2 + ActionOnEmptyResult = true }; await HookEmitter.Emit(_services, async hook => { @@ -60,6 +56,9 @@ public class TwilioVoiceController : TwilioController OnlyOnce = true }); + request.ConversationId = $"TwilioVoice_{request.CallSid}"; + instruction.CallbackPath = $"twilio/voice/{request.ConversationId}/receive/0?{GenerateStatesParameter(request.States)}"; + var twilio = _services.GetRequiredService(); if (string.IsNullOrWhiteSpace(request.Intent)) { @@ -107,7 +106,6 @@ public class TwilioVoiceController : TwilioController var twilio = _services.GetRequiredService(); var messageQueue = _services.GetRequiredService(); var sessionManager = _services.GetRequiredService(); - var messages = await sessionManager.RetrieveStagedCallerMessagesAsync(request.ConversationId, request.SeqNum); string text = (request.SpeechResult + "\r\n" + request.Digits).Trim(); @@ -146,7 +144,7 @@ public class TwilioVoiceController : TwilioController else { // keep waiting for user response - if (request.Attempts > 2) + if (request.Attempts > 3) { var instruction = new ConversationalVoiceResponse { @@ -185,7 +183,7 @@ public class TwilioVoiceController : TwilioController ActionOnEmptyResult = true }; - if (request.Attempts == 2) + if (request.Attempts == 3) { instruction.SpeechPaths.Add($"twilio/say-it-again-{Random.Shared.Next(1, 5)}.mp3"); } @@ -218,7 +216,6 @@ public class TwilioVoiceController : TwilioController var sessionManager = _services.GetRequiredService(); var twilio = _services.GetRequiredService(); var fileStorage = _services.GetRequiredService(); - if (request.SpeechResult != null) { await sessionManager.StageCallerMessageAsync(request.ConversationId, nextSeqNum, request.SpeechResult); diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs b/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs index ebb59229..8acbc9f4 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs +++ b/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs @@ -115,7 +115,7 @@ public class TwilioService }, Action = new Uri($"{_settings.CallbackHost}/{conversationalVoiceResponse.CallbackPath}"), SpeechModel = Gather.SpeechModelEnum.PhoneCall, - SpeechTimeout = conversationalVoiceResponse.Timeout > 0 ? conversationalVoiceResponse.Timeout.ToString() : "3", + SpeechTimeout = "auto", // conversationalVoiceResponse.Timeout > 0 ? conversationalVoiceResponse.Timeout.ToString() : "3", Timeout = conversationalVoiceResponse.Timeout > 0 ? conversationalVoiceResponse.Timeout : 3, ActionOnEmptyResult = conversationalVoiceResponse.ActionOnEmptyResult };