We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

User Input

We've hard-coded the prompt that goes to the LLM, which is... not very useful. Let's update our code to accept the prompt as a command-line argument.

We don't want our users to have to edit the code to change the prompt!

Assignment

  1. parser = argparse.ArgumentParser(description="Chatbot")
    parser.add_argument("user_prompt", type=str, help="User prompt")
    args = parser.parse_args()
    # Now we can access `args.user_prompt`
    
  2. uv run main.py "Why are episodes 7-9 so much worse than 1-6? Use one paragraph."
    

The remainder of the script can remain unchanged for now.

If things seem to be working correctly, submit the CLI tests.