Reasoning About Reasoning
Now you've experimented with the different models available, let's try out the two other parameters introduced in the video: reasoning and max_output_tokens.
Here's the challenge:
- Find the correct answer to the question: How many of the letter 's' are in the sentence, 'Mississippi are possessive over their successes?' using an LLM. Spoiler: the answer is
12. - The code must run in under 8 seconds!
You can use any model out of the options: gpt-5-nano, gpt-5-mini, and gpt-5.
This exercise is part of the course
Working with the OpenAI Responses API
Exercise instructions
- Complete the challenge by correctly finding the answer to the prompt provided, and in under 8 seconds!
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
start_time = time.time()
prompt = "How many of the letter 's' are in the sentence, 'Mississippi are possessive over their successes?'"
# Complete the challenge!
response = client.responses.create(
____
)
runtime = time.time() - start_time
print(response.output_text)
print(f"\nRuntime: {runtime:.2f} seconds")