Generating a product description
Imagine you're writing marketing copy for SonicPro headphones. Your goal is to generate a persuasive product description using DeepSeek.
Test how different prompting techniques, response lengths, and temperature settings influence the output. Since temperature only takes effect when reasoning is disabled, you'll disable reasoning via extra_body for this exercise.
この演習はコースの一部です
Working with DeepSeek in Python
演習の手順
- Create a detailed prompt to generate a product description for SonicPro headphones, including:
- Active noise cancellation (ANC)
- 40-hour battery life
- Foldable design
- Disable reasoning by passing
extra_body={"thinking": {"type": "disabled"}}. - Experiment with
max_tokensandtemperatureto see how they affect the output.
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
# Create a detailed prompt
prompt = """
____
"""
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro",
# Disable reasoning so temperature takes effect
extra_body=____,
messages=[{"role": "user", "content": prompt}],
# Experiment with max_tokens and temperature settings
max_tokens=____,
temperature=____
)
print(response.choices[0].message.content)