1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Llama 3

Connected

Exercise

Ensuring safe responses

You're configuring an internal chatbot for a medical team. To ensure consistent responses, you need to limit variability by setting a token limit and restricting token selection.

You have been provided the Llama class instance in the llm variable and the code to call the completion. You are also given a sample prompt to test with.

Instructions

100 XP
  • Set the model parameters so that the maximum number of tokens is limited to ten tokens, and the model only ever chooses between the two most likely words at each completion step.