diff --git a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs index 064cb97d..501985f4 100644 --- a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs +++ b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs @@ -43,9 +43,9 @@ public class LlmModelSetting public bool ImageGeneration { get; set; } /// - /// Embedding dimension + /// Settings for embedding /// - public int Dimension { get; set; } + public EmbeddingSetting? Embedding { get; set; } /// /// Settings for reasoning model @@ -73,6 +73,11 @@ public class LlmModelSetting } } +public class EmbeddingSetting +{ + public int Dimension { get; set; } +} + public class ReasoningSetting { public float Temperature { get; set; } = 1.0f; diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs index 4409c8eb..ed99e0dd 100644 --- a/src/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs +++ b/src/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs @@ -126,7 +126,7 @@ public class CompletionProvider var found = llmProviderService.GetSetting(provider, model); completer.SetModelName(model); - completer.SetDimension(found.Dimension); + completer.SetDimension(found.Embedding?.Dimension ?? 0); return completer; } diff --git a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/KnowledgeSettingHelper.cs b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/KnowledgeSettingHelper.cs index 48742f0a..669f4ad1 100644 --- a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/KnowledgeSettingHelper.cs +++ b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/KnowledgeSettingHelper.cs @@ -43,6 +43,6 @@ public static class KnowledgeSettingHelper { var settings = services.GetRequiredService(); var found = settings.GetSetting(provider, model); - return found?.Dimension ?? 0; + return found?.Embedding?.Dimension ?? 0; } } diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 1e0365ee..f7f4d342 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -183,7 +183,9 @@ "Version": "3-small", "ApiKey": "", "Type": "embedding", - "Dimension": 1536 + "Embedding": { + "Dimension": 1536 + } } ] },