The creative story
Your prompt determines what the AI says. Parameters determine how it says it. Temperature controls randomness, top_p controls vocabulary diversity, and max_tokens caps the response length. Getting these right is the difference between a creative story and a repetitive one.
LLM parameter effects
How temperature and max_tokens affect the output.
# These parameters are passed to the LLM provider
response = await llm_provider.generate(
prompt,
temperature=0.8, # 0.0 = deterministic, 1.0+ = creative
max_tokens=800 # Limits story length
)Temperature 0.8 is a good default for creative tasks. Lower it for factual queries (0.2) or raise it for brainstorming (1.0+). max_tokens prevents runaway responses. The same parameters work with generate_stream, the streaming call you learn next.
Matching exercise: Match parameters to their effects
Loading practice…