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

Method not found: '!!0 Microsoft.Extensions.AI.IChatClient.GetService(System.Object)' #685

Closed
jcmag opened this issue Dec 3, 2024 · 5 comments · Fixed by #686
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jcmag
Copy link

jcmag commented Dec 3, 2024

Hi,

I want to use the Microsoft.Extensions.AI.IChatClient interface in my code (to be able to call ChatGPT, Anthropic, Mistral etc.).
The problem is that as soon as I add this line of code:

client = new OpenAIService(new OpenAIOptions { ApiKey = key });

I get this error at runtime :

System.MissingMethodException: Method not found: '!!0 Microsoft.Extensions.AI.IChatClient.GetService(System.Object)'.

Any idea why?

Betalgo.Ranul.OpenAI v9.0.0
.NET 9.0

@kayhantolga
Copy link
Member

Thanks for reporting. Let me check. If you can share a sample project, it would help a lot.

@jcmag
Copy link
Author

jcmag commented Dec 3, 2024

Hi,

Here is a sample project that reproduces the exception.
Bug.zip

Actually, the error only occurs when I reference the other packages (Anthropic.SDK and Mistral.SDK), so it might be a conflict between the three packages. I have also contacted the owners of the other packages, as the issue may not be with your package.

@jcmag
Copy link
Author

jcmag commented Dec 3, 2024

from the Mistral.SDK author:

"I noted when I removed Betalgo.Ranul.OpenAI, the app seems to run fine. This does appear to be some sort of version conflict and I note that there are some dependency mismatches between my libraries and theirs, but not related to IChatClient...it just has a LOT of dependencies so it's a little tough to tell where exactly the conflict is coming from"

@kayhantolga
Copy link
Member

I think this is because Microsoft.Extensions.AI.Abstractions is still in preview, and we are using a different version of the preview model. I may need to update it to the latest version and fix the missing implementation.

@kayhantolga kayhantolga self-assigned this Dec 3, 2024
@kayhantolga kayhantolga added the bug Something isn't working label Dec 3, 2024
@kayhantolga kayhantolga linked a pull request Dec 4, 2024 that will close this issue
@kayhantolga kayhantolga added this to the 9.0.1 milestone Dec 4, 2024
@kayhantolga
Copy link
Member

resolved
https://github.com/betalgo/openai/releases/tag/v9.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants