OpenAITextGenerator.__init__() got an unexpected keyword argument 'api_base'
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
I am also getting the same error . I checked there code 'api_base' have been removed from the class OpenAITextGenerator(TextGenerator)
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.
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.
I had a similar problem. I solved it by exporting the OPENAI_BASE_URL environment variable with my local environment, like this:
export OPENAI_BASE_URL="http://localhost:11434/v1"
This allows the openai Python library to automatically use the local endpoint. Hope this helps others!