Prompt engineering
celeris-1 is optimized for short, structured output. Prompts should define the task, allowed output format, and an appropriate token limit.
Specify the output format exactly
State the required output format explicitly:
- ✅ "Reply with one word: positive, negative, or neutral."
- ✅ "Reply with JSON only:
{name, company, intent}." - ✅ "Reply with the number only."
- ❌ "What do you think the sentiment is?"
Constrained outputs are easier to validate and generally require fewer completion tokens. Avoid open-ended wording when the caller expects a fixed schema or label.
Enumerate the answer space
When the output is a label, list the valid labels and close the set:
{
"model": "celeris-1",
"messages": [
{"role": "system", "content": "Route the user message to exactly one tool: search, calculator, email, none. Reply with the tool name only."},
{"role": "user", "content": "what is 14% of 2,300,000?"}
],
"max_tokens": 8,
"temperature": 0
}
- Include an escape hatch (
none,unknown,other) so the model has a valid answer for inputs outside the set. Otherwise, it may choose the closest label. - Specify the number of labels when the response must contain exactly one value.
Put the task in the system message
Use the system message for the standing instruction and the user message
for input data. This keeps the instruction stable and makes it easier to
version and evaluate independently from the payload:
{
"messages": [
{"role": "system", "content": "Score how well the passage answers the question, 0-10. Reply with the number only."},
{"role": "user", "content": "Question: ...\nPassage: ..."}
]
}
Message roles help distinguish instructions from data, but they do not by themselves prevent prompt injection. Treat untrusted input as untrusted data, constrain available actions, and validate model output before using it.
Set an explicit token budget
- Set
max_tokensfor the expected answer. A label may need 4 tokens, a score 3, and a small JSON object 64. Completion length affects both latency and cost. - Keep prompts concise. Prompt plus
max_tokensmust fit the 4,096-token context window. Prompt tokens are billed on every call, and shorter instructions leave more room for input data. - Use
stopsequences when the format has a clear delimiter, such as a newline.
Make it deterministic
For classification, extraction, and scoring, use temperature: 0. Add a
seed when you need more reproducible sampling:
{"temperature": 0, "seed": 7}
Lower variation makes evaluations and caches more useful. Increase
temperature only for tasks that benefit from varied output, such as
generating alternative phrasings.
Add examples when needed
For unusual JSON shapes or domain-specific labels, add one or two compact examples to the system message:
Extract fields as JSON only: {items: [{name, qty}], pickup_time}.
Example: "two flat whites for 8am" -> {"items": [{"name": "flat white", "qty": 2}], "pickup_time": "8:00am"}
Keep examples minimal because they count toward the context window and are billed on every request. Omit them when the instruction is sufficient.
Validate the output, and retry with feedback
Validate every structured response:
- Validate the response against your schema (JSON parse, enum check, range check).
- On failure, retry once with the error appended — e.g. a second
usermessage:Your last reply was not valid JSON. Reply with JSON only. - On a second failure, fall back — route to your default branch rather than looping.
Bound retries and define a deterministic fallback for invalid output.
Iterate in the Playground first
Use the Console Playground to test prompts and response formats against the live model. The Use it from code panel provides an equivalent API example.
Next steps
- Agentic workloads — worked request patterns for classify, extract, judge, and rewrite.
- Making requests — the full parameter guidance.
- Going to production — hardening the calls around the prompt.