import streamlit as st
import pycafe
import anthropic
reason = """
Get your API key at the [Anthroptic console](https://console.anthropic.com/settings/keys)
"""
ANTHROPIC_API_KEY = pycafe.get_secret("ANTHROPIC_API_KEY", reason)
client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1000,
temperature=0,
system="You are a world-class poet. Respond only with short poems.",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Why is the ocean salty?"
}
]
}
]
)
st.write(message.content)