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

[Bug fix]: Fix issue of OPENAI_API_BASE env variable being mandatory #1305

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

deshraj
Copy link
Collaborator

@deshraj deshraj commented Mar 5, 2024

Description

User reported on slack that the new version has a regression resulting into the following error:

>>> from embedchain import App
>>> app = App()
>>> app.add("http://deshraj.xyz")
Doc content has not changed. Skipping creating chunks and embeddings
'0d8813f767d2cf9bf728bcc44fc55ff0'
>>> app.chat("Who is Deshraj?")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/deshrajyadav/Projects/embedchain/embedchain/embedchain.py", line 576, in chat
    answer = self.llm.chat(
             ^^^^^^^^^^^^^^
  File "/Users/deshrajyadav/Projects/embedchain/embedchain/llm/base.py", line 278, in chat
    answer = self.get_answer_from_llm(prompt)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/deshrajyadav/Projects/embedchain/embedchain/llm/base.py", line 143, in get_answer_from_llm
    return self.get_llm_model_answer(prompt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/deshrajyadav/Projects/embedchain/embedchain/llm/openai.py", line 27, in get_llm_model_answer
    response = self._get_answer(prompt, self.config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/deshrajyadav/Projects/embedchain/embedchain/llm/openai.py", line 42, in _get_answer
    base_url = config.base_url or os.environ["OPENAI_API_BASE"]
                                  ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'OPENAI_API_BASE'

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit Test

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 5, 2024
@deshraj deshraj merged commit 4dc5c73 into main Mar 5, 2024
3 checks passed
@deshraj deshraj deleted the user/dyadav/fix-package branch August 24, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant