Get startedGet started for free

End-to-end Claude prompting

As part of a company hackathon, your team is prototyping QuickAid, a help-desk bot for event attendees. Step one is to prove you can hit the Claude API from Python, get a live response, and print it to the console. Nail this, and the judges will green-light the rest of your prototype.

This exercise is part of the course

Introduction to Claude Models

View Course

Exercise instructions

  • Initialize the Anthropic client.
  • Set the parameter to specify the Claude Sonnet model.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

from anthropic import Anthropic
# Initialize the Anthropic client
client = ____(api_key="datacamp-token", base_url=url)

response = client.messages.create(
  	# Set the Claude Sonnet Model
    ____="claude-3-7-sonnet-latest",
    max_tokens=150,
    messages=[
        {"role": "user", "content": "What can you help me with today?"}
    ])

print(____)
Edit and Run Code