Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Bug: Method not found: 'System.ClientModel.ApiKeyCredential System.ClientModel.ApiKeyCredential.op_Implicit(System.String)' #9130

Open
paciox opened this issue Oct 7, 2024 · 9 comments
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@paciox
Copy link

paciox commented Oct 7, 2024

COPY OF:
#8956
which is NOT solved

Describe the bug
Upgraded to v1.21.0 and an integration test started failing with the following:

Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService
----> System.MissingMethodException : Method not found: 'System.ClientModel.ApiKeyCredential System.ClientModel.ApiKeyCredential.op_Implicit(System.String)'.
Looks like the implicit operator was available in System.ClientModel v1.1.0-beta.7 here but has been dropped in the v1.1.0 release here. Looks like the constraint for System.ClientModel >= 1.1.0-beta.7 in Microsoft.SemanticKernel.Connectors.OpenAI v1.20.0 isn't quite true as 2.0.0-beta.12 takes a dependency on System.ClientModel >= v1.1.0 - downgrading to 2.0.0-beta.11 fixes this.

To Reproduce

<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.20.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.OpenAI" Version="1.20.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Core" Version="1.20.0" />
<PackageVersion Include="OpenAI" Version="2.0.0-beta.12" />

[Test]
public async Task MissingImplicitOperator()
{
var services = new ServiceCollection();
services.AddKernel();
services.AddOpenAIChatCompletion
(
"gpt-4o",
Environment.GetEnvironmentVariable("OPENAI_API_KEY")!,
Environment.GetEnvironmentVariable("OPENAI_ORG_ID")!
);
await using var provider = services.BuildServiceProvider();
_ = provider.GetRequiredService();
}
Expected behavior
Resolves an instance of OpenAIChatCompletionService

Platform

OS: Windows
IDE: Visual studio 2022
Language: C#

image

This person suggests:
#8956 (comment)

I tried like shown here:
#8956 (comment)

and it doesn't do anything.
15 days passed, no solution.

What to do?

@paciox paciox added the bug Something isn't working label Oct 7, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Oct 7, 2024
@essenbee2
Copy link

I am also experiencing this issue in .NET upon updating Azure.AI.OpenAI to 2.0.0. Returning to 2.0.0-beta.5 removes the Method Not Found exception. How can I tell which version of Azure.AI.OpenAI a given version of SK supports?

@RegRom
Copy link

RegRom commented Oct 8, 2024

I am also encountering this issue. Tried using ApiKeyCredential instead of DefaultCredential as described in #8956 but it didn't solve anything. Had to downgrade Azure.AI.OpenAI to 2.0.0-beta.5 and it is quite problematic as I need Structured Outputs.

@paciox
Copy link
Author

paciox commented Oct 8, 2024

I am also encountering this issue. Tried using ApiKeyCredential instead of DefaultCredential as described in #8956 but it didn't solve anything. Had to downgrade Azure.AI.OpenAI to 2.0.0-beta.5 and it is quite problematic as I need Structured Outputs.

Same here, I need the structured outputs and only solution is to revert to beta 5

@YuriyMorozyuk95
Copy link

Please write when issue will be resolved in new version of SK/Azure Open AI packages, right now not possible to upgrade to Azure.AI.OpenAI 2 version, as IChatComplition

@paciox
Copy link
Author

paciox commented Oct 10, 2024

Some update:
I managed to find a way of work with SK and latest OpenAI library.

I don't know if you guys actually use and need specifically Azure.OpenAI, but removing it and doing everything through sk works for now

@RegRom
Copy link

RegRom commented Oct 15, 2024

Unfortunately I am using solely Azure OpenAI so for me the issue still persists

@essenbee2
Copy link

Updating to SK v1.22.0 and Azure.AI.OpenAI v2.1.0-beta.1 appears to fix this issue :-)

@RegRom
Copy link

RegRom commented Oct 17, 2024

@essenbee2 you are right, it does appear to solve the problem. Thanks for the update. @paciox you should try this too

@ystvan
Copy link

ystvan commented Oct 18, 2024

Updating to SK v1.22.0 and Azure.AI.OpenAI v2.1.0-beta.1 appears to fix this issue :-)

True. I have bumped packages even higher, should somebody thinking about the same remedy then watch out for this one #9313 while you're on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Bug
Development

No branches or pull requests

7 participants