Aan de slagGa gratis aan de slag

Getting models to think

Time to make the switch from chat models to reasoning models! These are great for deeper reasoning tasks like data analysis, code debugging, math, or research.

In this exercise, you'll use reasoning models to solve a typical math problem that might be presented to high-school math students.

> math_problem

Calculate the area of a house in m^2 comprised of two rooms of sizes 3mx2m and 4mx5m.

Deze oefening maakt deel uit van de cursus

Working with DeepSeek in Python

Cursus bekijken

Oefeninstructies

  • Create a request to send the math_problem prompt to the "deepseek-ai/DeepSeek-R1" model via the Chat Completions endpoint.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")

# Create a request to the chat model
response = client.chat.completions.____(
    model="deepseek-ai/____",
    max_tokens=400,
    messages=[
        {"role": "user", 
         "content": ____}]
)

print(response.choices[0].message.content)
Code bewerken en uitvoeren