Closed strikene closed 8 months ago
Hi @strikene, thank you for creating this issue. I have not been able to reproduce this. Looking at the stack trace, HandlebarsPlanner.GetAvailableFunctionsManual
is calling into HandlebarsPlanner.SetComplexTypeDefinition
which indicates that it's found at least one plugin registered.
If you have any plugins registered, can you please provide information about them to help us diagnose the issue?
If you are sure there are no plugins registered, could you please provide a minimal example that reproduces the error, showing how you are creating the kernel?
Thanks!
PR #4344 fixes an issue where a plugin with a parameter that is defined recursively results in a stack overflow exception. This may be the same issue that you are seeing. Please take a cool and let us know if this matches your situation. Thanks.
Hi @strikene, thank you for creating this issue. I have not been able to reproduce this. Looking at the stack trace,
HandlebarsPlanner.GetAvailableFunctionsManual
is calling intoHandlebarsPlanner.SetComplexTypeDefinition
which indicates that it's found at least one plugin registered.If you have any plugins registered, can you please provide information about them to help us diagnose the issue?
If you are sure there are no plugins registered, could you please provide a minimal example that reproduces the error, showing how you are creating the kernel?
Thanks!
HI @alliscode
I found the reason I loaded the TextMemoryPlugin,HttpPlugin,TextPlugin,TimePlugin,WaitPlugin,ConversationSummaryPlugin and once I didn't load it there would be no problem
here is code show add 'TextMemoryPlugin'
IKernelBuilder builder =
//new KernelBuilder()
Kernel.CreateBuilder()
.AddAzureOpenAIChatCompletion(
deploymentName: cfg_ChatCompletion.ModelName,
endpoint: cfg_ChatCompletion.EndPoint,
apiKey: cfg_ChatCompletion.Key,
serviceId: OpenAIUseType.ChatCompletion.ToString(),
modelId: "GPT-4")
.AddAzureOpenAIChatCompletion(
deploymentName: cfg_Planer.ModelName,
endpoint: cfg_Planer.EndPoint,
apiKey: cfg_Planer.Key,
serviceId: OpenAIUseType.Planer.ToString(),
modelId: "GPT-4")
.AddAzureOpenAIChatCompletion(
deploymentName: cfg_AssistantRole.ModelName,
endpoint: cfg_AssistantRole.EndPoint,
apiKey: cfg_AssistantRole.Key,
serviceId: OpenAIUseType.AssistantRole.ToString(),
modelId: "GPT-4")
.AddAzureOpenAITextEmbeddingGeneration(
deploymentName: cfg_Embedding.ModelName,
endpoint: cfg_Embedding.EndPoint,
apiKey: cfg_Embedding.Key,
serviceId: OpenAIUseType.Embedding.ToString(),
modelId: "text-embedding-ada-002")
;
/// 429
builder.Services.AddHttpClient();
builder.Services.ConfigureHttpClientDefaults(c =>
{
c.AddHttpMessageHandler(x => new AzureOpenAIRequestDelegatingHandler(
_MSSKV2LoggerFactory.CreateLogger(nameof(AzureOpenAIRequestDelegatingHandler))
, 10));
});
this._SK_Kernel = builder.Build();
ITextEmbeddingGenerationService embeddingGenerator = this._SK_Kernel.GetRequiredService
this._SemanticTextMemory = new(store.Result, embeddingGenerator); this._TextMemoryPlugin = new(this._SemanticTextMemory); // use for recall an add memory this._SK_Kernel.ImportPluginFromObject(this._TextMemoryPlugin);
this._SK_Kernel.ImportPluginFromObject(new ExtenedFilePlugin(), nameof(ExtenedFilePlugin)); this._SK_Kernel.ImportPluginFromObject(new HttpPlugin(), nameof(HttpPlugin)); this._SK_Kernel.ImportPluginFromObject(new TextPlugin(), nameof(TextPlugin)); this._SK_Kernel.ImportPluginFromObject(new TimePlugin(), nameof(TimePlugin)); this._SK_Kernel.ImportPluginFromObject(new WaitPlugin(), nameof(WaitPlugin)); this._SK_Kernel.ImportPluginFromObject(new ConversationSummaryPlugin(), nameof(ConversationSummaryPlugin));
In fact, this error occurs when I just load 'TextMemoryPlugin'.
Maybe I'm loading the plugin the wrong way?
Can you try importing the plugins using ImportPluginFromType? I.e., this._SK_Kernel.ImportPluginFromType
Closing as this should be resolved with PR #4344
Also verified import of all the following plugins at once doesn't produce exception
kernel.ImportPluginFromObject(new TextMemoryPlugin(memoryWithACS), nameof(TextMemoryPlugin));
kernel.ImportPluginFromObject(new HttpPlugin(), nameof(HttpPlugin));
kernel.ImportPluginFromObject(new TextPlugin(), nameof(TextPlugin));
kernel.ImportPluginFromObject(new TimePlugin(), nameof(TimePlugin));
kernel.ImportPluginFromObject(new WaitPlugin(), nameof(WaitPlugin));
kernel.ImportPluginFromObject(new ConversationSummaryPlugin(), nameof(ConversationSummaryPlugin));
Describe the bug This bug exists in RC3, RC4 at the same time, even if no plugins are loaded HandlebarsPlanner.CreatePlanAsync Throws an exception System.StackOverflowException To Reproduce Steps to reproduce the behavior: HandlebarsPlanner hbp = new HandlebarsPlanner(new HandlebarsPlannerOptions() {AllowLoops=false });
var createdplan = await hbp.CreatePlanAsync(sk._SK_Kernel, "Generate an analysis report, refer to C:\1. pdf" );
To Reproduce at Microsoft.SemanticKernel.Planning.Handlebars.KernelParameterMetadataExtensions.ToHandlebarsParameterTypeMetadata(System.Type) at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner.SetComplexTypeDefinition(Microsoft.SemanticKernel.KernelParameterMetadata, System.Collections.Generic.HashSetd8.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner+d 8, Microsoft.SemanticKernel.Planners.Handlebars, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3]](d8 ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner+d8, Microsoft.SemanticKernel.Planners.Handlebars, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3]](d 8 ByRef)
at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner.CreatePlanCoreAsync(Microsoft.SemanticKernel.Kernel, System.String, System.Threading.CancellationToken)
at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner+<>c.b__2_0(Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner, Microsoft.SemanticKernel.Kernel, System.String, System.Threading.CancellationToken)
at Microsoft.SemanticKernel.Planning.PlannerInstrumentation+d4`2[[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.SemanticKernel.Planning.PlannerInstrumentation+d 4d4`2<System.Canon,System.Canon> ByRef)
at Microsoft.SemanticKernel.Planning.PlannerInstrumentation.CreatePlanAsync[[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Func`5<System.Canon,Microsoft.SemanticKernel.Kernel,System.String,System.Threading.CancellationToken,System.Threading.Tasks.Task`1>, System.Canon, Microsoft.SemanticKernel.Kernel, System.String, Microsoft.Extensions.Logging.ILogger, System.Threading.CancellationToken)
at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner.CreatePlanAsync(Microsoft.SemanticKernel.Kernel, System.String, System.Threading.CancellationToken)
at ConsoleChatMSSKV2.Program+d 0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Canon ByRef)
1<Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsParameterTypeMetadata>, System.Collections.Generic.Dictionary
2<System.String,System.String>) at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner.GetAvailableFunctionsManual(Microsoft.SemanticKernel.Kernel, System.Collections.Generic.HashSet1<Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsParameterTypeMetadata> ByRef, System.Collections.Generic.Dictionary
2<System.String,System.String> ByRef) at Microsoft.SemanticKernel.Planning.Handlebars.HandlebarsPlanner+2[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.SemanticKernel.Planners.Handlebars, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3]](<CreatePlanAsync>d__4
2<System.Canon,System.Canon> ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Microsoft.SemanticKernel.Planning.PlannerInstrumentation+<CreatePlanAsync>d__4
2[[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.SemanticKernel.Planners.Handlebars, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3]](Screenshots
Platform