1. Learn
  2. /
  3. Courses
  4. /
  5. Working with DeepSeek in Python

Connected

Exercise

Creating a reasoning chatbot for coding

Let's put everything together to build a reasoning chatbot for coding assistance!

You've been provided with two user messages: one to request Python code for a particular task, and a follow-up message requesting that it be written with a particular library.

Let's see how the reasoning model does!

Instructions

100 XP
  • Loop over the user questions.
  • Send each user question, q, to the deepseek-ai/DeepSeek-R1 model.
  • Extract the response content to strip it of thinking tokens before appending it to messages.