diff --git a/src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs b/src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs
index d145d175..306e72e3 100644
--- a/src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs
@@ -10,7 +10,7 @@ public interface IChatCompletion
///
/// Set model name, one provider can consume different model or version(s)
///
- ///
+ /// deployment name
void SetModelName(string model);
Task GetChatCompletions(Agent agent,
diff --git a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
index b7b44f98..1faf3c52 100644
--- a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
@@ -12,6 +12,11 @@ public class LlmModelSetting
///
public string Name { get; set; }
+ ///
+ /// Model version
+ ///
+ public string Version { get; set; } = "1106-Preview";
+
///
/// Deployment same functional model in a group.
/// It can be used to deploy same model in different regions.
diff --git a/src/Plugins/BotSharp.Plugin.AzureOpenAI/Providers/ChatCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.AzureOpenAI/Providers/ChatCompletionProvider.cs
index 2069ab31..60370bbd 100644
--- a/src/Plugins/BotSharp.Plugin.AzureOpenAI/Providers/ChatCompletionProvider.cs
+++ b/src/Plugins/BotSharp.Plugin.AzureOpenAI/Providers/ChatCompletionProvider.cs
@@ -22,7 +22,7 @@ public class ChatCompletionProvider : IChatCompletion
private readonly IServiceProvider _services;
private readonly ILogger _logger;
- private string _model;
+ private string _model, _version;
public string Provider => "azure-openai";
@@ -231,10 +231,14 @@ public class ChatCompletionProvider : IChatCompletion
{
if (message.Role == ChatRole.Function)
{
- chatCompletionsOptions.Messages.Add(new ChatRequestAssistantMessage(string.Empty)
+ if (_version == "0125-Preview")
{
- FunctionCall = new FunctionCall(message.FunctionName, message.FunctionArgs),
- });
+ chatCompletionsOptions.Messages.Add(new ChatRequestAssistantMessage(string.Empty)
+ {
+ FunctionCall = new FunctionCall(message.FunctionName, message.FunctionArgs),
+ });
+ }
+
chatCompletionsOptions.Messages.Add(new ChatRequestFunctionMessage(message.FunctionName, message.Content));
}
else if (message.Role == ChatRole.User)
@@ -330,5 +334,9 @@ public class ChatCompletionProvider : IChatCompletion
public void SetModelName(string model)
{
_model = model;
+
+ var settingsService = _services.GetRequiredService();
+ var settings = settingsService.GetSetting(Provider, model);
+ _version = settings.Version;
}
}
diff --git a/src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj b/src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj
index bc0c0c2d..9d790284 100644
--- a/src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj
+++ b/src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/src/Plugins/BotSharp.Plugin.SemanticKernel/SemanticKernelChatCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.SemanticKernel/SemanticKernelChatCompletionProvider.cs
index 22c7fc68..156f238c 100644
--- a/src/Plugins/BotSharp.Plugin.SemanticKernel/SemanticKernelChatCompletionProvider.cs
+++ b/src/Plugins/BotSharp.Plugin.SemanticKernel/SemanticKernelChatCompletionProvider.cs
@@ -22,7 +22,7 @@ namespace BotSharp.Plugin.SemanticKernel
private Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService _kernelChatCompletion;
private IServiceProvider _services;
private ITokenStatistics _tokenStatistics;
- private string? _model = null;
+ private string _model;
///
public string Provider => "semantic-kernel";
@@ -100,8 +100,7 @@ namespace BotSharp.Plugin.SemanticKernel
///
public void SetModelName(string model)
{
- if (!string.IsNullOrWhiteSpace(model))
- this._model = model;
+ _model = model;
}
}
}
\ No newline at end of file
diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json
index 08fdfab0..c3692a1a 100644
--- a/src/WebStarter/appsettings.json
+++ b/src/WebStarter/appsettings.json
@@ -41,7 +41,9 @@
"Provider": "azure-openai",
"Models": [
{
+ "Id": "gpt-3.5-turbo",
"Name": "gpt-35-turbo",
+ "Version": "1106",
"ApiKey": "",
"Endpoint": "https://gpt-35-turbo.openai.azure.com/",
"Type": "chat",
@@ -50,6 +52,7 @@
},
{
"Name": "gpt-35-turbo-instruct",
+ "Version": "0914",
"ApiKey": "",
"Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/",
"Type": "text",