1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Claude Models

Connected

Exercise

Controlling response length with tokens

To better control responses from QuickAid, users can now click either "Quick Answer", for a tweet-sized blurb, or "Deep Dive", for a fuller explanation.
Implement both calls and print the side-by-side results so the hackathon panel can see the difference at a glance.

The anthropic library has been pre-imported and the client has been pre-defined.

Instructions

100 XP
  • Set max_tokens as 25 for the short response to get a very concise answer (about 15-20 words).
  • Set max_tokens as 200 for the long response to get a detailed explanation (about 150 words).