開始使用免費開始

試試你的第一個 Claude 提示吧!

為了先預覽接下來要做的事,我們已為你準備好用 Python 向 Anthropic API 發送請求的程式碼。

把任何問題或指令傳入 prompt 參數,看看 Claude 會如何回應!

如果一時沒有靈感,可以先試試這兩個提示:

  • What capabilities make Claude well-suited for enterprise applications?
  • Give me two examples of how I could use Claude in a Python app.

本練習屬於課程

Claude 模型入門

檢視課程

練習說明

  • 將你的提示內容取代 "INSERT YOUR PROMPT HERE",多做幾次嘗試,準備好後再送出你的答案!

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

from anthropic import Anthropic

client = Anthropic(api_key="datacamp-token", base_url=url)

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=100,
    # Enter your prompt
    messages=[{"role": "user", "content": "INSERT YOUR PROMPT HERE"}]
)

print(response.content[0].text)
編輯並執行程式碼