-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
KeyError with OpenAI MODEL_CAPABILITIES #4785
Comments
Does setting model capabilities directly in the model client constructor works? It's documented in the API docs. In the prior versions, countless issues come from developers plugging in local models without necessary capabilities and expect it to "just work". So we want to have more validation. Perhaps as a first step is to produce a clean error message suggesting capabilities to be added in the constructor? |
I see. Ok if you encountered issues with this in the past then it's probably best not to ignore the model capabilities. I think it could be good to produce an error message for it. |
What happened?
Location: https://github.com/microsoft/autogen/blob/main/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py
Line 131 in the above location raises a KeyError when you provide a model that is not in the MODEL_CAPABILITIES dict (eg. 'llama3-8b-8192').
This is a big problem because the OpenAIChatCompletionClient should be usable with other providers.
A couple changes of are required:
However, I suggest ignoring model capabilities entirely and let developers make sure that models that they use have the capabilities that are required. From there, you could just let the AsyncOpenAI client raise an exception.
What did you expect to happen?
I expected the client to be unaware of the model that is set, like in the official openai sdk.
How can we reproduce it (as minimally and precisely as possible)?
`
from autogen_ext.models.openai import OpenAIChatCompletionClient
groq_model_client = OpenAIChatCompletionClient(
model='llama3-groq-70b-8192-tool-use-preview',
base_url='https://api.groq.com/openai/v1',
api_key='<GROQ_API_KEY>'
)
KeyError: 'llama3-groq-70b-8192-tool-use-preview'
`
AutoGen version
0.4.0.dev9
Which package was this bug in
Extensions
Model used
llama3-groq-70b-8192-tool-use-preview (Groq)
Python version
3.12.5
Operating system
Windows 11
Any additional info you think would be helpful for fixing this bug
A couple changes of are required:
However, I suggest ignoring model capabilities entirely and let developers make sure that models that they use have the capabilities that are required. From there, you could just let the AsyncOpenAI client raise an exception.
The text was updated successfully, but these errors were encountered: