Recipes
Generate training examples from your documents with a model endpoint and a recipe.
A recipe tells a model what kind of examples to write from your documents: factual questions, troubleshooting steps, JSON extraction and more. When you generate, each selected document is cut into passages and each passage is sent to a model endpoint with the recipe. The examples come back to Review as pending, each with exact quotes from its passage as evidence.
You only need recipes for documents. Imported question and answer pairs are already examples. Recipes generate ordinary conversations for SFT; they do not generate chosen/rejected preference pairs. For DPO, import pairs with both candidates.
Recipes aren't in the sidebar. Open them with Customize recipes in the Generate examples sheet, which keeps the sources you selected, or with Go to Recipes in the command menu (⌘K or Ctrl K).
Before you start
- You are a member or an owner.
- The project has documents in Sources.
- Your organization has a model endpoint that speaks the OpenAI chat completions format, or a ready deployment set up as Use a deployment describes. Without either, the Generate examples sheet says "Generation needs a chat model: an endpoint you add, or a model you deploy here." and offers Add an external model endpoint and Deploy a model to generate with.
- You are happy for that endpoint's provider to see your documents. See What is sent to the endpoint.
Starter recipes
| Starter recipe | What it writes |
|---|---|
| Factual Q&A | One specific question, answered only from the source |
| Troubleshooting | A realistic problem with diagnostic steps and a fix from the source |
| Multi-turn conversation | 2 to 4 user and assistant exchanges with natural follow-ups (needs at least two assistant turns) |
| Structured JSON | An extraction request answered with JSON that matches your schema |
| Clarification question | An ambiguous request, answered with a targeted clarifying question |
| Insufficient information | A question the source can't answer, answered by saying what is unknown |
The project's use case decides which starter the Generate examples sheet offers first. You can generate with a starter directly, or save your own recipe from one.
Save a recipe
- Open Recipes, and choose a starter under Starter recipes (or New recipe for Factual Q&A).
- Enter a Recipe name.
- Edit the Generation instructions, which start as the starter's. Left empty, the starter's instructions are used.
- Choose whether to include the Source passage in each question. See Training context.
- For Structured JSON, enter the Response JSON schema. See Structured JSON.
- Optionally tick up to five Approved references. See Reference examples.
- Choose Save recipe.
To change a saved recipe, choose it under Saved recipes, edit it and choose Save new revision. Each save adds a numbered revision (Version N in the list, vN elsewhere), and generations and versions keep the revision they used. Saved recipes cannot be deleted.
Generate with this recipe opens the Generate examples sheet on Sources with the recipe chosen. Save your changes first.
Training context
Source passage in each question decides whether each generated example carries the passage it was written from.
- Include the source passage (recommended). The passage is put at the start of the example's first user message, before the question, so the model learns to answer from text it is given. Choose this if your application will send relevant text with each question, in the same form.
- Leave the passage out (closed book). Examples hold only questions that stand on their own and their answers, so the model learns to answer from memory.
With the source passage, a first user message looks like this (length is the passage's length in characters):
<source length="55">
Refunds reach the original card within 5 business days.
</source>
How long do refunds take?The passage stays part of the example in training, evaluation and downloaded versions. Leave it unchanged: editing it, by hand or with redaction, makes the example fail Schema compliance, and it can't be approved.
Reference examples
References show the endpoint the style you want: tone, length, format. Tick up to five approved examples under Approved references. The list shows 100 at a time; search with Search approved examples… to find others. Clear references unticks them all.
References are copied into the recipe and sent with every passage, and the endpoint is told to copy their style, not their facts. If a reference is a text preference pair, only its shared prompt and chosen answer are included; its rejected answer is not a generation reference.
- References must be approved training examples of this project, without images, and 20,000 characters together, counting each whole conversation with any source passage.
- When you save the recipe, each reference, and anything sharing its source or question, is reserved for training, so you are never tested on an example the generator was shown. See Split reservations.
Structured JSON
A Structured JSON recipe needs a Response JSON schema (draft 2020-12, inline; no $ref, pattern or format). The starter asks for one text field:
{
"type": "object",
"properties": {"answer": {"type": "string"}},
"required": ["answer"],
"additionalProperties": false
}Replace it with the fields you extract. In Review every answer must match the schema before it can be approved.
Generate examples
- In Sources, tick whole imports or single sources. With nothing ticked, the sheet starts with every import of documents for training selected, leaving out imported examples and test data.
- Choose Generate examples.
- Choose the Model that writes the examples. With only one, it's chosen already.
- Choose the Recipe: a starter or a saved recipe. Customize recipes opens Recipes and keeps your selection.
- Set Examples per passage (1 to 10, default 3): the most the model may write for each passage of about 6,000 characters.
- Check what the selection amounts to, such as "≈150 passages → up to 450 examples · 150 model calls".
- Optionally open Advanced settings:
- Quality judge (optional): a model that also rates factual support, completeness and contradictions, one call per example. Rule checks only, the default, adds no call.
- Source passage in each question, for a starter. A saved recipe uses its own. See Training context.
- Choose Generate up to N examples.
A notice says "Generation started", and Sources and Review show its progress, such as "12 of 42 passages · 36 examples so far". Follow it in Activity too.
If the project has no version yet, the sheet warns when the selection has examples from fewer than 10 documents: "Your first version needs examples from at least 10 different documents, or a separate test file…". See The first version.
How generation runs
- Each source is cut into 6,000-character passages, and one request goes to the endpoint per passage.
- New examples arrive in Review as pending, with their source's category. Exact duplicates are not added.
- Every assistant turn needs an exact quote from the passage. A generated example can't be approved until each turn has one. A quote shows where support should be, not that the answer is right, so read the answer too, or add a judge.
- The model writes at most Examples per passage examples for a passage, or none. Quotes it writes that aren't well formed are left out, so the example waits in Review for evidence instead of being lost.
- If the model's reply for a passage can't be used, for example because it isn't a JSON array of examples, the passage is asked again twice, telling the model its reply couldn't be read. After the third try, the passage is skipped and generation goes on with the next one. The reply itself is never shown, only which passage it was for.
- If the endpoint can't be reached, the passage is tried again; after three failures the job fails. Retry in Activity continues from that passage, and examples from earlier passages stay.
- With a quality judge, one Check example quality job judges the generation's examples as they arrive. See Quality checks.
- Every organization's projects hold at most 2,000,000 examples, whatever their status. Generation into a full project is refused, and a generation stops at the passage that would take the project past the limit; the examples of earlier passages stay. See What a plan limits.
Skipped passages
When a generation skipped passages, Activity says how many, such as "40 / 42 passages · 2 skipped", and Sources says which, with the reason: "The last generation skipped passages 14, 27. The model's reply for passage 27 of 42 was not a JSON array of examples. Use a stronger model or fewer examples per passage."
Choose Retry skipped passages to generate them again, with the model and recipe the generation used. The passages keep their numbers. Each generation's skipped passages can be retried once from there; a retry that skips some again offers its own Retry skipped passages.
Use a deployment
A ready deployment of your organization is listed under Model that writes the examples, Quality judge (optional) and, in Review, Check again with, by its name and model. Messages name it by its name, such as "Deployment 1 · base model".
- Its Context length (tokens), under Advanced settings when you deploy it, must be longer than the answer asked for: 8,192 tokens for generation, 2,048 for a judge. The default, 4,096, is too small for generation: requests fail with "deployment returned HTTP 400". Leave room for the request too: an answer that does not fit after it stops at the end of the context.
- It must stay Ready until the generation and the judge's checks finish. Set its Maximum runtime (hours) (1 by default) long enough: it stops then, even in use. A stopped deployment can't be started again: choose Start another session in its ... menu on Models, then generate again with the new one. Examples already generated stay.
What is sent to the endpoint
For each passage, the endpoint receives the passage (up to 6,000 characters), the project's Goal and Generation instructions, the recipe with its full reference examples and their source names and locations, and fixed instructions to treat all of it as data and quote the passage exactly. With a judge, there is one more request per example; see What the judge receives.
Note
The endpoint's provider sees the full text of every selected passage and bills you for the requests. Choose a provider you trust with your content, or a model you run yourself.
Tips
- Start small. Generate from a few sources, read the results in Review, adjust the instructions or references, then generate for the rest.
- Use a capable generator. Each answer must be a JSON list of examples with exact quotes. If passages keep being skipped, switch to a more capable model or lower Examples per passage.
- Mix recipes. A few Insufficient information examples alongside factual ones teach the model to say when the source doesn't cover a question.
- Check lengths before training. A source passage adds up to 6,000 characters to each example. Dataset readiness shows whether examples fit your training sequence length.
Limits
| Limit | Value |
|---|---|
| Examples per passage | 1 to 10; 3 by default |
| Examples per project | 2,000,000, generated ones included. See Limits on every organization. |
| Passage | 6,000 characters |
| Sources in one generation | 2,000, and 25 MB of text |
| Selection in one generation | 500 whole imports and 500 single sources |
| Endpoint reply | Starts within 90 seconds, ends within 3 minutes |
| Answer length asked for | 8,192 tokens; 2,048 for a judge |
| Endpoint response | 2 MiB |
| Reference examples | 5 per recipe, 20,000 characters together |
| Recipe name | 160 characters |
| Recipe instructions | 10,000 characters |
| Response JSON schema | 20,000 characters, 20 levels of nesting |
When something goes wrong
| Message | What to do |
|---|---|
| "Nothing is selected." or "Select sources or imports to generate from" | Choose Select all documents, or tick imports or sources in Sources first. |
| "There are no documents to generate from yet. Add PDFs, Word or text files in Add sources." | Add documents in Sources. Imported examples and test data aren't selected for generation. |
| "Generation needs a chat model: an endpoint you add, or a model you deploy here." | Your organization has no model endpoint or ready deployment. Choose Add an external model endpoint or Deploy a model to generate with. |
| "The selected documents have no text" | Choose other sources. |
| "Select at most 2,000 sources at a time…" or "…more than 25 MB of text…" | Select fewer sources and generate in rounds. |
| "Your first version needs examples from at least 10 different documents, or a separate test file…" | Generate from more documents, or import a separate test set. See The first version. |
| "The model's reply for passage N of M was not a JSON array of examples…" or "…had no usable examples (reason)…" | The passage was skipped. Use a more capable model, or lower Examples per passage, then choose Retry skipped passages. See Skipped passages. |
| "Your plan (Plan) allows N examples per project…" | The project is full, or the generation stopped at the passage that would have gone past the limit. Delete examples you don't need, or use another project. Examples already generated stay. |
| "This generation has no skipped passages to retry" | Its skipped passages were already retried. Reload the page. |
| "Recipe references must be approved examples from this project" | A reference was edited, rejected or removed since you ticked it. Choose Clear references and tick approved examples again. |
| "A reference overlaps held-out validation/test data…" or "Test (held out) examples can't be recipe references…" | That example, or one sharing its source or question, is held out. Choose a reference in training. |
| "Reference examples must total at most 20,000 characters…" | Choose fewer or shorter references. A generated reference counts its source passage too. |
| "Examples with images can't be used as recipe references" | Choose examples without images. |
| "Response schema must be…", "Response schema nesting exceeds 20 levels" or "Invalid response schema: …" | Fix Response JSON schema as the message says: valid JSON, an object of at most 20,000 characters, at most 20 levels deep. |
| "Use an inline schema without references or regex patterns", "Format assertions are not supported…" or "Only JSON Schema draft 2020-12 is supported" | Remove $ref, pattern, patternProperties and format. Remove $schema, or set it to https://json-schema.org/draft/2020-12/schema. |
| "Endpoint name returned HTTP code" | Use Check connection in Connections. For a deployment, HTTP 400 usually means its Context length (tokens) is too small; see Use a deployment. |
| "Endpoint name did not answer in time" or "Endpoint name: response unavailable or invalid (reason)" | No usable answer: the endpoint couldn't be reached, sent nothing for 90 seconds, took over 3 minutes, or didn't send a chat completion. Use Check connection, or a faster model or fewer examples per passage, then Retry. |
| "Endpoint name: response exceeds the 2 MiB limit" | Lower Examples per passage, or use another endpoint. |
| "Endpoint configuration changed; restore its saved configuration or create a new evaluation" | The endpoint was changed in Connections after the job started. Restore it and Retry, or generate again. |
| "deployment is not running. Deploy it again on the Models page." or "This deployment no longer exists. Deploy the model again on the Models page." | The deployment stopped. Choose Start another session in its ... menu on Models, then generate again with the new one. See Use a deployment. |
| "Kind: an unexpected error stopped this…" | Choose Retry. If it fails again, check the storage connection, then contact support. |
Need a hand? Visit troubleshooting