microsoft / kernel-memory

RAG architecture: index and query any data using LLM and natural language, track sources, show citations, asynchronous memory patterns.
https://microsoft.github.io/kernel-memory
MIT License
1.6k stars 308 forks source link

.Net: With RC1 WithAzureOpenAIEmbeddingGeneration errors at runtime #184

Closed johnnyreilly closed 11 months ago

johnnyreilly commented 11 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Using code like this:

            .WithAzureOpenAIEmbeddingGeneration(new AzureOpenAIConfig
            {
                APIType = AzureOpenAIConfig.APITypes.EmbeddingGeneration,
                Auth = AzureOpenAIConfig.AuthTypes.AzureIdentity,
                Endpoint = _appSettings.OpenAiServiceUrl ?? string.Empty,
                Deployment = _appSettings.DeploymentNameEmbedding ?? string.Empty
            })

Worked with beta8. With RC1, it compiles, but at runtime an error like this is thrown:

      Error processing document
      System.MissingMethodException: Method not found: 'Void Microsoft.SemanticKernel.Connectors.AI.OpenAI.TextEmbedding.AzureOpenAITextEmbeddingGeneration..ctor(System.String, System.String, Azure.Core.TokenCredential, System.String, System.Net.Http.HttpClient, Microsoft.Extensions.Logging.ILoggerFactory)'.
         at Microsoft.KernelMemory.KernelMemoryBuilderExtensions.WithAzureOpenAIEmbeddingGeneration(IKernelMemoryBuilder builder, AzureOpenAIConfig config, Boolean onlyForRetrieval)

Expected behavior Compiling code runs as it did with beta8

Screenshots n/a

Platform

    <PackageReference Include="Microsoft.KernelMemory.Core" Version="0.15.231204.1-preview" />
    <PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-rc1" />
    <PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch" Version="1.0.0-rc1" />
    <PackageReference Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.0.0-rc1" />
    <PackageReference Include="Azure.AI.OpenAI" Version="1.0.0-beta.9" />

Additional context

According to @stephentoub in https://github.com/microsoft/semantic-kernel/issues/3970:

There were breaking changes between bet8 and rc1. It looks like you're referencing a library from the kernel memory project that was built against beta8. That will need to rebuild against rc1 and then you'll need to update to use that version. It's expecting an API signature that's not exactly the same as it was in beta8, hence the missing member exception.

@dluc, @markwallace-microsoft

Is a release planned to cover this please?

dluc commented 11 months ago

hi @johnnyreilly latest KM nuget (0.16.x released few hours ago) is integrated with SK RC2, does that solve this issue?

johnnyreilly commented 11 months ago

Thanks! I'll check tomorrow!

johnnyreilly commented 11 months ago

two steps forward and one step back!

[BE]       System.MissingMethodException: Method not found: 'System.Collections.Generic.IList`1<Azure.AI.OpenAI.ChatMessage> Azure.AI.OpenAI.ChatCompletionsOptions.get_Messages()'.
[BE]          at Microsoft.SemanticKernel.Connectors.AI.OpenAI.ClientCore.GetStreamingChatMessageContentsAsync(ChatHistory chat, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+MoveNext()
[BE]          at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
[BE]          at Microsoft.SemanticKernel.Connectors.AI.OpenAI.ClientCore.GetStreamingChatMessageContentsAsync(ChatHistory chat, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+System.IAsyncDisposable.DisposeAsync()

But I think this is a different issue

johnnyreilly commented 11 months ago

I think this works as expected - thank you! Will close this. There's different issues - see https://github.com/microsoft/semantic-kernel/issues/4071 - but I'll close this and carry those on where it's more relevant