semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: exception on using AssistantBuilder to create IAssistant

Open deepinderdeol opened this issue 2 years ago • 3 comments

I have the latest packages.

With this code: var assistant = await new AssistantBuilder() .WithOpenAIChatCompletion(openAIModel, openAI_Key) .FromTemplate(assistant_definition) .BuildAsync();

I am seeing the following exception: Could not load file or assembly 'Microsoft.SemanticKernel.Connectors.OpenAI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3'. The system cannot find the file specified.

I get the exception only if creating an Assistant is the first thing I do in my solution.

If I first run some other non-Assistants workflow, like chat/function-calling etc. and then choose to use Assistants then no exception is thrown. Maybe at this time the assembly is already loaded so creating an assistant works??

Possibly some assembly mismatch between the Experimental.Assistants and other v1 packages?

deepinderdeol avatar Dec 20 '23 20:12 deepinderdeol

@deepinderdeol Can you switch to using this package https://www.nuget.org/packages/Microsoft.SemanticKernel.Experimental.Agents/1.0.1-alpha

We re-renamed the assistants package to agents.

See: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/Experimental/Agents/AgentBuilder.cs

markwallace-microsoft avatar Dec 21 '23 08:12 markwallace-microsoft

@alliscode Can we remove the old assistants code now?

markwallace-microsoft avatar Dec 21 '23 08:12 markwallace-microsoft

Issue is fixed after switching to Agents package. Thanks @markwallace-microsoft

Unrelated to this issue - maybe this is already possible or is being considered, I think it would be good if chat-history could be passed in when invoking the agent thread, something like this so the manager can consider past interactions when invoking workers: var agentMessages = thread.InvokeAsync(manager_agent, userQuery, chatHistory);

deepinderdeol avatar Dec 21 '23 15:12 deepinderdeol