-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Description
When apiKey and baseUrl parameters are passed to the OpenAIHandler, an error is thrown by the underlying OpenAI JavaScript library. This issue arises because these parameters, along with others, are directly passed to the completion function using the spread operator, which causes conflicts.
Steps to Reproduce
- Call
OpenAIHandlerwithapiKeyandbaseUrlparameters. - Observe that the library throws an error.
Expected Behavior
The OpenAIHandler should correctly separate the parameters for creating a new OpenAI object and the subset of parameters needed for the completions API call.
Actual Behavior
An error is thrown due to parameter conflicts when apiKey and baseUrl are provided.
Proposed Solution
Modify OpenAIHandler to separate the initialization parameters (apiKey, baseUrl) from the completion call parameters. This can be achieved by explicitly passing only the necessary parameters to the completions API call.
I will be submitting a pull request shortly to address this issue.