You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had .env file in my folder and tried to load_dotenv() and added OPENAI_API_KEY to the env as well but still getting below error
from paperqa import Docs
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/init.py", line 1, in
from .docs import Answer, Docs, PromptCollection, Doc, Text
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/docs.py", line 35, in
class Docs(BaseModel, arbitrary_types_allowed=True, smart_union=True):
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/docs.py", line 43, in Docs
llm: Union[str, BaseLanguageModel] = ChatOpenAI(
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/load/serializable.py", line 64, in init
super().init(**kwargs)
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for ChatOpenAI root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I had .env file in my folder and tried to load_dotenv() and added OPENAI_API_KEY to the env as well but still getting below error
from paperqa import Docs
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/init.py", line 1, in
from .docs import Answer, Docs, PromptCollection, Doc, Text
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/docs.py", line 35, in
class Docs(BaseModel, arbitrary_types_allowed=True, smart_union=True):
File "/opt/homebrew/lib/python3.11/site-packages/paperqa/docs.py", line 43, in Docs
llm: Union[str, BaseLanguageModel] = ChatOpenAI(
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/langchain/load/serializable.py", line 64, in init
super().init(**kwargs)
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for ChatOpenAI
root
Did not find openai_api_key, please add an environment variable
OPENAI_API_KEY
which contains it, or passopenai_api_key
as a named parameter. (type=value_error)Beta Was this translation helpful? Give feedback.
All reactions