How to use Anthropic claude-3.5-sonnet with Streamlit
It time to use Claude LLMs.
Lets have a look to Anthropic API
and its models.
Claude API + Streamlit
https://github.com/jw782cn/Claude-Streamlit This one helped me a lot
Get your API keys: https://console.anthropic.com/settings/keys
Thanks to this project for inspiration: https://github.com/jw782cn/Claude-Streamlit
python -m venv chatbot #create it
chatbot\Scripts\activate #activate venv (windows)
source chatbot/bin/activate #(linux)
pip install -r requirements.txt #all at once
streamlit run claude.py
that project also supports OpenAI Models
Getting Access to Anthropic API
The Power of Claude 3 API: Building a Generative AI App with Anthropic Claude AI
You need to take into consideration the Name as described at the Column ‘Latest 1P API model name’ in their web: https://docs.anthropic.com/en/docs/about-claude/models
- claude-3-opus-20240229
- claude-3-sonnet-20240229
- claude-3.5-sonnet-20240620
Conclusions
I am building a multi LLM provider chat right here: https://github.com/JAlcocerT/Streamlit-MultiChat
Thanks to the learnings on how to use Claude with Python.
The way to call the API is a little bit different than the OpenAI one.
Its a good complement to the GROQ API for LLMs.
FAQ
Thanks to Fireship and the video: