How to make AI writing sound more human
ChatGPT prompts. Adjust temperature and model parameters such as temperature and top_p to increase creativity and naturalness.PREREQUISITES
Python 3.8+OpenAI API key (free tier works)pip install openai>=1.0
Setup
Install the OpenAI Python SDK and set your API key as an environment variable to interact with ChatGPT models.
pip install openai>=1.0 Step by step
Use prompt design and model parameters to generate more human-like text. Add instructions for tone and style, and set temperature to around 0.7 for creativity.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
prompt = (
"Write a friendly and conversational email explaining a project delay. "
"Use natural language with empathy and casual tone."
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],
temperature=0.7,
top_p=0.9
)
print(response.choices[0].message.content) Hi there, I wanted to update you on the project timeline. We've hit a small snag that’s causing a delay, but we're working hard to get back on track. Thanks for your patience and understanding! Best, [Your Name]
Common variations
You can experiment with different models like gpt-4o-mini for faster responses or claude-3-5-sonnet-20241022 for more nuanced tone. Async calls and streaming completions are also options for interactive apps.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
async def generate_human_text():
response = await client.chat.completions.acreate(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Write a warm thank you note."}],
temperature=0.8
)
print(response.choices[0].message.content)
# To run async, use an async event loop like asyncio.run(generate_human_text()) Thank you so much for your kindness and support! It truly means a lot to me.
Troubleshooting
If the output sounds robotic or repetitive, increase temperature or add more detailed style instructions in the prompt. If responses are off-topic, clarify context or add examples.
Key Takeaways
- Use prompt instructions to specify tone, style, and personality for human-like writing.
- Adjust
temperatureandtop_pparameters to control creativity and naturalness. - Experiment with different models and async calls for varied response styles and performance.
- Clarify context and add examples in prompts to reduce robotic or irrelevant outputs.