Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error in OpenAIHandler when apiKey and baseUrl are Specified #12

@enricobellato

Description

@enricobellato

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

  1. Call OpenAIHandler with apiKey and baseUrl parameters.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions