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

RAG with Anthropic as provider generates error; others work fine. #2106

Open
DrDavidL opened this issue Dec 22, 2024 · 0 comments
Open

RAG with Anthropic as provider generates error; others work fine. #2106

DrDavidL opened this issue Dec 22, 2024 · 0 comments

Comments

@DrDavidL
Copy link

🐛 Describe the bug

All works well using embedchain with Gemini and OpenAI models for RAG. However, when Anthropic is used, the following error arises:

ConfigError: duplicate validator function "langchain_anthropic.chat_models.ChatAnthropic.build_extra"; if this is intended, set `allow_reuse=True`


Traceback:
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)
File "/Users/david/Documents/GitHub/consensus/basic.py", line 1857, in <module>
    main()
File "/Users/david/Documents/GitHub/consensus/basic.py", line 950, in main
    app = App.from_config(
          ^^^^^^^^^^^^^^^^
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/embedchain/app.py", line 393, in from_config
    llm = LlmFactory.create(llm_provider, llm_config_data.get("config", {}))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/embedchain/factory.py", line 44, in create
    llm_class = load_class(class_type)
                ^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/embedchain/factory.py", line 6, in load_class
    module = importlib.import_module(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/embedchain/llm/anthropic.py", line 6, in <module>
    from langchain_anthropic import ChatAnthropic
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/langchain_anthropic/__init__.py", line 1, in <module>
    from langchain_anthropic.chat_models import ChatAnthropic, ChatAnthropicMessages
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/langchain_anthropic/chat_models.py", line 238, in <module>
    class ChatAnthropic(BaseChatModel):
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/langchain_anthropic/chat_models.py", line 597, in ChatAnthropic
    @root_validator(pre=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/pydantic/v1/class_validators.py", line 134, in dec
    f_cls = _prepare_validator(f, allow_reuse)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/david/Documents/GitHub/consensus/.venv/lib/python3.11/site-packages/pydantic/v1/class_validators.py", line 156, in _prepare_validator
    raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')

I'm not doing anything fancy, just allowing users to switch providers at their option, and other models work. Thoughts?

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

1 participant