Skip to content

Commit f8a18b0

Browse files
authored
Merge pull request SciSharp#1356 from iceljc/bugfix/remove-temp-for-reasoning
Bugfix/remove temp for reasoning
2 parents b3c02b3 + 0f3f5b0 commit f8a18b0

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,7 @@ private async Task<InstructResult> RunLlm(
251251
var templateLlmConfig = agent.Templates?.FirstOrDefault(x => x.Name.IsEqualTo(templateName))?.LlmConfig;
252252
if (templateLlmConfig?.IsValid == true)
253253
{
254-
llmConfig = new AgentLlmConfig
255-
{
256-
Provider = templateLlmConfig.Provider,
257-
Model = templateLlmConfig.Model,
258-
MaxOutputTokens = templateLlmConfig.MaxOutputTokens,
259-
ReasoningEffortLevel = templateLlmConfig.ReasoningEffortLevel
260-
};
254+
llmConfig = new AgentLlmConfig(templateLlmConfig);
261255
}
262256
}
263257
else

src/Plugins/BotSharp.Plugin.OpenAI/Providers/Chat/ChatCompletionProvider.Response.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using BotSharp.Abstraction.MessageHub.Models;
33
using BotSharp.Core.Infrastructures.Streams;
44
using BotSharp.Core.MessageHub;
5-
using OpenAI.Chat;
65
using OpenAI.Responses;
76

87
namespace BotSharp.Plugin.OpenAI.Providers.Chat;
@@ -425,12 +424,14 @@ private async Task<RoleDialogModel> InnerCreateResponseStreamingAsync(Agent agen
425424
var allowMultiModal = settings != null && settings.MultiModal;
426425
renderedInstructions = [];
427426

427+
float? temperature = float.Parse(_state.GetState("temperature", "0.0"));
428428
var maxTokens = int.TryParse(_state.GetState("max_tokens"), out var tokens)
429429
? tokens
430430
: agent.LlmConfig?.MaxOutputTokens ?? LlmConstant.DEFAULT_MAX_OUTPUT_TOKEN;
431431

432432
var options = new CreateResponseOptions(_model, [])
433433
{
434+
Temperature = temperature,
434435
MaxOutputTokenCount = maxTokens
435436
};
436437

@@ -442,6 +443,11 @@ private async Task<RoleDialogModel> InnerCreateResponseStreamingAsync(Agent agen
442443
ReasoningEffortLevel = reasoningEffortLevel.Value,
443444
ReasoningSummaryVerbosity = ResponseReasoningSummaryVerbosity.Auto
444445
};
446+
447+
if (reasoningEffortLevel != ResponseReasoningEffortLevel.None)
448+
{
449+
options.Temperature = null;
450+
}
445451
}
446452

447453
// Prepare instruction and functions

0 commit comments

Comments
 (0)