推理再推理
你已經嘗試過不同的模型了,現在來動手試試影片中介紹的另外兩個參數:reasoning 與 max_output_tokens。
挑戰如下:
- 使用 LLM 找出這個問題的正確答案:在這句話 'Mississippi are possessive over their successes?' 中,字母 's' 出現了幾次? 提醒一下:答案是
12。 - 程式碼必須在 8 秒內執行完成!
你可以使用以下任一模型:gpt-5.4-nano、gpt-5.4-mini、gpt-5.5。
本練習屬於課程
使用 OpenAI Responses API
練習說明
- 請在 8 秒內 依據題目的提示正確找出答案,完成這個挑戰!
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
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")