-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Additional parameters for openai client #385
Additional parameters for openai client #385
Conversation
@touseefahmed96 normally you shouldn't need a PR fort these parameters to work, they should work as kwargs. Tell me if it's not the case! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aymeric-roucher I was just looking at the base code because I thought the same.
And I think the kwargs are not passed to the client instantiation, but to the client call only.
-
Client instantiation is not passed the self.kwargs:
smolagents/src/smolagents/models.py
Lines 725 to 728 in 3b5c99e
self.client = openai.OpenAI( base_url=api_base, api_key=api_key, ) -
The self.kwargs are only passed to the client call (through the completion_kwargs):
smolagents/src/smolagents/models.py
Lines 739 to 750 in 3b5c99e
completion_kwargs = self._prepare_completion_kwargs( messages=messages, stop_sequences=stop_sequences, grammar=grammar, tools_to_call_from=tools_to_call_from, model=self.model_id, custom_role_conversions=self.custom_role_conversions, convert_images_to_image_urls=True, **kwargs, ) response = self.client.chat.completions.create(**completion_kwargs)
So, @albertvillanova in order to use the organization or project parameter isn't it necessary to pass kwargs to client ?
|
Thanks for looking into it @albertvillanova ! |
I agree @aymeric-roucher. If in the future we see more client args are requested by users, maybe we could define a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @touseefahmed96.
I will look into it and let's see if I can find any better solution. The |
fix #381