Prose Writing Example
This example demonstrates how to use an AI model to write prose.
Task
Write a prose piece based on a given topic and requirements.
Prompt
Please write a prose piece according to the following requirements:
1. Topic: [user-provided topic]
2. Word count: [specific count]
3. Writing requirements:
- Detailed and vivid descriptions
- Sincere and natural emotions
- Complete and coherent structure
- Beautiful and flowing language
Example
User Input
Write a 750-word prose piece titled "The Lonely Night Walker", describing the feelings and observations of a person walking aimlessly through the city at night, and the unique insights given by the silence of the night.
Assistant Response
At the edge of the city, night falls and stars are sparse. I, a lonely night walker, tread with heavy steps through the quiet corners of this sleepless city. Along the streets, the lights of skyscrapers twinkle like stars, yet they cannot illuminate my inner confusion.
[... full English text continues ...]
Code Implementation
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepseek.com/",
api_key="<YOUR_API_KEY>"
)
completion = client.chat.completions.create(
model="deepseek-chat",
messages=[
{
"role": "user",
"content": "Write a 750-word prose piece titled 'The Lonely Night Walker'..."
}
]
)
print(completion.choices[0].message.content)