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

OpenAITextGenerator.__init__() got an unexpected keyword argument 'api_base' #122

Open
pxzbest opened this issue Jun 8, 2024 · 3 comments

Comments

@pxzbest
Copy link

pxzbest commented Jun 8, 2024

When I use an OpenAI Compatible Endpoint, I get an error 'OpenAITextGenerator.init() got an unexpected keyword argument 'api_base''
How should I handle this error
{1F9E54EF-7A6A-473e-99CD-AC64397471BB}

@vishaljeet828
Copy link

I am also getting the same error . I checked there code 'api_base' have been removed from the class OpenAITextGenerator(TextGenerator)

@benayat
Copy link

benayat commented Sep 28, 2024

It was removed, yet the README.md file shows the api_base as a usable option. I think it should be removed from the README.md file as well.

@ghucaduk
Copy link

Same error trying to use offline model (LM Studio at http://localhost:1234). Two workarounds:

Really Bad Way: Edit OpenAI class definition (_client.py) to change base_url default value
FROM base_url = f"https://api.openai.com/v1"
TO base_url = f"http://localhost:1234/v1"

Less Bad Way: Edit OpenAITextGenerator class definition (openai_textgen.py) as follows:

In def init()
ADD base_url: str = None,
In self.client_args ={}
ADD "base_url": base_url,

The Really Bad Way got past the initial error but created new problems. The Less Bad Way worked with no errors. I am not a professional and welcome feedback/instruction on how to craft a more appropriate comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants