ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Introduction to Claude Models

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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(____)
Editar y ejecutar código