# pip install -U 'anthropic[vertex]'
import os
# Replace with the path to your service account JSON key file
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "C:/dev/gcpkey/radiant-oven-440907-u7-b59deb49881e.json"
from anthropic import AnthropicVertex
LOCATION= "us-central1" #"europe-west1" #or us-east5" # or
client = AnthropicVertex(region=LOCATION, project_id="radiant-oven-440907-u7")
message = client.messages.create(
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Send me a recipe for banana bread.",
}
],
model="claude-3-5-sonnet-v2@20241022",
)
print(message.model_dump_json(indent=2))