ricklamers/shell-ai

RuntimeError when starting `shai`

Closed this issue ยท 2 comments

anpr commented

I installed shai using pip, as suggested. I am using Python 3.10 and macOS Ventura.
I have the OPENAI_API_KEY environment variable setup correctly (as far as I can tell). I also tried to set the config.json, but the outcome is the same.

Here is the output when I try to execute shai:

$ shai
Traceback (most recent call last):
  File "/Users/anpr/.pyenv/versions/3.10.0/bin/shai", line 5, in <module>
    from shell_ai.main import main
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/shell_ai/main.py", line 9, in <module>
    from langchain.chat_models import AzureChatOpenAI, ChatOpenAI
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/__init__.py", line 6, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/__init__.py", line 40, in <module>
    from langchain.agents.agent_toolkits import (
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/agent_toolkits/__init__.py", line 12, in <module>
    from langchain.agents.agent_toolkits.csv.base import create_csv_agent
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/agent_toolkits/csv/base.py", line 4, in <module>
    from langchain.agents.agent_toolkits.pandas.base import create_pandas_dataframe_agent
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/agent_toolkits/pandas/base.py", line 18, in <module>
    from langchain.agents.types import AgentType
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/types.py", line 5, in <module>
    from langchain.agents.chat.base import ChatAgent
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/chat/base.py", line 4, in <module>
    from langchain.agents.chat.output_parser import ChatOutputParser
  File "/Users/anpr/.pyenv/versions/3.10.0/lib/python3.10/site-packages/langchain/agents/chat/output_parser.py", line 12, in <module>
    class ChatOutputParser(AgentOutputParser):
  File "pydantic/main.py", line 229, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 491, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 421, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 542, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 804, in pydantic.fields.ModelField.populate_validators
  File "pydantic/validators.py", line 723, in find_validators
RuntimeError: no validator found for <class 're.Pattern'>, see `arbitrary_types_allowed` in Config

I recall this was an issue with LangChain <> Pydantic interaction. Could you run pip install langchain pydantic -U and try again?

anpr commented

It works now with the pip command you suggested, thank you ๐Ÿ™