MaxRecursiveDepth setting.
This commit is contained in:
parent
c8b9ce128f
commit
434324358a
|
|
@ -8,4 +8,5 @@ public class AgentSettings
|
|||
public string RouterId { get; set; }
|
||||
public string DataDir { get; set; }
|
||||
public string TemplateFormat { get; set; }
|
||||
public int MaxRecursiveDepth { get; set; } = 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ namespace BotSharp.Core.Conversations.Services;
|
|||
|
||||
public partial class ConversationService
|
||||
{
|
||||
const int maxRecursiveDepth = 3;
|
||||
int currentRecursiveDepth = 0;
|
||||
|
||||
private async Task<bool> GetChatCompletionsAsyncRecursively(IChatCompletion chatCompletion,
|
||||
string conversationId,
|
||||
Agent agent,
|
||||
List<RoleDialogModel> wholeDialogs,
|
||||
int maxRecursiveDepth,
|
||||
Func<RoleDialogModel, Task> onMessageReceived,
|
||||
Func<RoleDialogModel, Task> onFunctionExecuting,
|
||||
Func<RoleDialogModel, Task> onFunctionExecuted)
|
||||
|
|
@ -83,6 +83,7 @@ public partial class ConversationService
|
|||
conversationId,
|
||||
agent,
|
||||
wholeDialogs,
|
||||
maxRecursiveDepth,
|
||||
onMessageReceived,
|
||||
onFunctionExecuting,
|
||||
onFunctionExecuted);
|
||||
|
|
|
|||
|
|
@ -65,11 +65,14 @@ public partial class ConversationService
|
|||
await hook.BeforeCompletion();
|
||||
}
|
||||
|
||||
var agentSettings = _services.GetRequiredService<AgentSettings>();
|
||||
|
||||
var chatCompletion = GetChatCompletion();
|
||||
var result = await GetChatCompletionsAsyncRecursively(chatCompletion,
|
||||
conversationId,
|
||||
agent,
|
||||
wholeDialogs,
|
||||
agentSettings.MaxRecursiveDepth,
|
||||
onMessageReceived,
|
||||
onFunctionExecuting,
|
||||
onFunctionExecuted);
|
||||
|
|
|
|||
Loading…
Reference in a new issue