1. 学ぶ
  2. /
  3. コース
  4. /
  5. Working with DeepSeek in Python

Connected

演習

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.

V4-Pro reasons by default, so all you need to do is loop the conversation and append the right field to the history.

指示

100 XP
  • Loop over the user questions.
  • Send each user question, q, to the deepseek-ai/DeepSeek-V4-Pro model.
  • Append the assistant's final answer (the .content, not the reasoning) to messages so the conversation history stays lean.