Verba icon indicating copy to clipboard operation
Verba copied to clipboard

Instruction: How to add Anthropic's Claude models

Open bakongi opened this issue 1 year ago • 8 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

bakongi avatar Mar 30 '24 08:03 bakongi

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

thomashacker avatar Apr 11 '24 08:04 thomashacker

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

bakongi avatar Apr 21 '24 06:04 bakongi

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

unityforge avatar Jul 11 '24 15:07 unityforge

it's enough to add the modification and restart Verba

bakongi avatar Jul 11 '24 15:07 bakongi

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

unityforge avatar Jul 11 '24 16:07 unityforge

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

bakongi avatar Jul 11 '24 17:07 bakongi

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?

unityforge avatar Jul 12 '24 07:07 unityforge

Try to rebuild. Change in sources, rebuild

bakongi avatar Jul 20 '24 16:07 bakongi

We added anthropic to the newest release

thomashacker avatar Sep 03 '24 12:09 thomashacker