weaviate / Verba

Retrieval Augmented Generation (RAG) chatbot powered by Weaviate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instruction: How to add Anthropic's Claude models

bakongi opened this issue · comments

Hi everyone. As you know some latest Anthropic's Claude models is better and chaeper than OpenaAI models. So I create a new generator file to use Anthropic's models. and made changes to manager.py file in goldenverba/components/generation

generation.zip

Install Anthropic library:
pip install anthropic

and you should add this variables to your environment (or .env file):

ANTHROPIC_API_KEY=sk-ant-api03-.....pAAA

ANTHROPIC_MODEL=claude-3-haiku-20240307

You will need API key from Anthropic at https://console.anthropic.com/

Available models:

Claude 3 Opus claude-3-opus-20240229
Claude 3 Sonnet claude-3-sonnet-20240229
Claude 3 Haiku claude-3-haiku-20240307

P.S.
The generator's code made with help of Claude and GPT-3.5/4

Great work! Thanks 🚀 We'll implement it in the coming next update

I'd forgotten...

in "verba_manager.py" add:

        # Check Anthropic ENV KEY
        try:
            import anthropic

            anthropic_key = os.environ.get("ANTHROPIC_API_KEY", "")

            if anthropic_key != "":
                self.environment_variables["ANTHROPIC_API_KEY"] = True
                anthropic.api_key = anthropic_key

        except Exception:
            self.environment_variables["ANTHROPIC_API_KEY"] = False

and

        try:
            import anthropic

            self.installed_libraries["anthropic"] = True
        except Exception:
            self.installed_libraries["anthropic"] = False

Do we need to rebuild something or it's enough to add the modification and restart Verba ?

it's enough to add the modification and restart Verba

ok, strange. Nothing changed in my case after the modification...

It depends on how did you installed Verba. If you installed from sources you should change in the souce folder, if you installed via pip you should make changes in the python lib folder where Verba was installed

Indeed I installed from the source. What do you mean by "change in the source folder" ? Sorry for this novice question... I put the manager.py into goldenverba/components/generation and modified the .py files. Anything else to change?

Try to rebuild. Change in sources, rebuild

We added anthropic to the newest release