Skip to content

Commit c76d68a

Browse files
author
wisedev
committed
feat: allow empty inference params
1 parent 93b9913 commit c76d68a

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

src/MaIN.Core/.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>MaIN.NET</id>
5-
<version>0.10.2</version>
5+
<version>0.10.3</version>
66
<authors>Wisedev</authors>
77
<owners>Wisedev</owners>
88
<icon>favicon.png</icon>

src/MaIN.Services/Services/AgentService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public async Task<Agent> CreateAgent(Agent agent, bool flow = false, bool intera
103103
Name = agent.Name,
104104
ImageGen = agent.Model == ImageGenService.LocalImageModels.FLUX,
105105
ToolsConfiguration = agent.ToolsConfiguration,
106-
BackendParams = inferenceParams ?? new LocalInferenceParams(),
106+
BackendParams = inferenceParams,
107107
MemoryParams = memoryParams ?? new MemoryParams(),
108108
Messages = [],
109109
Interactive = interactiveResponse,

src/MaIN.Services/Services/LLMService/AnthropicService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void ValidateApiKey()
5959

6060
public async Task<ChatResult?> Send(Chat chat, ChatRequestOptions options, CancellationToken cancellationToken = default)
6161
{
62-
if (chat.BackendParams is not AnthropicInferenceParams)
62+
if (chat.BackendParams != null && chat.BackendParams is not AnthropicInferenceParams)
6363
{
6464
throw new InvalidBackendParamsException(LLMApiRegistry.Anthropic.ApiName, nameof(AnthropicInferenceParams), chat.BackendParams.GetType().Name);
6565
}

src/MaIN.Services/Services/LLMService/LLMService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public LLMService(
5656
ChatRequestOptions requestOptions,
5757
CancellationToken cancellationToken = default)
5858
{
59+
chat.BackendParams ??= new LocalInferenceParams();
60+
5961
if (chat.BackendParams is not LocalInferenceParams)
6062
{
6163
throw new InvalidBackendParamsException("Local LLM", nameof(LocalInferenceParams), chat.BackendParams.GetType().Name);

src/MaIN.Services/Services/LLMService/OpenAiCompatibleService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public abstract class OpenAiCompatibleService(
5151
ChatRequestOptions options,
5252
CancellationToken cancellationToken = default)
5353
{
54-
if (chat.BackendParams.GetType() != ExpectedParamsType)
54+
if (chat.BackendParams != null && chat.BackendParams?.GetType() != ExpectedParamsType)
5555
{
56-
throw new InvalidBackendParamsException(GetApiName(), ExpectedParamsType.Name, chat.BackendParams.GetType().Name);
56+
throw new InvalidBackendParamsException(GetApiName(), ExpectedParamsType.Name, chat.BackendParams!.GetType().Name);
5757
}
5858

5959
ValidateApiKey();

0 commit comments

Comments
 (0)