Skip to content

fix(ai): set the answer format by example - #684

Open
Reversean wants to merge 3 commits into
masterfrom
fix/ai-answer-template
Open

Reversean wants to merge 3 commits into
masterfrom
fix/ai-answer-template

Conversation

@Reversean

@Reversean Reversean commented Sep 21, 2026

Copy link
Copy Markdown
Member

The answer format was a template of bracketed placeholders, so the model copied it instead of filling it in..

Before and after, the first line of an answer:

[Краткое summary]
Страница корзины падает у всех, чья сессия истекла: сервер отвечает объектом ошибки, а код принимает ответ за список товаров и вызывает у него `map`.

The format is now one filled example in an <example> tag, with the markup rules in a <markup> tag beside it, both named from the instruction above them.

Reversean and others added 2 commits September 21, 2026 14:31
The system instruction gives the answer format as a template of bracketed placeholders, and the model copies them instead of filling them in: on four fabricated events the old instruction opened every answer with the literal "[Краткое summary]".

The format is now one filled example, kept inside a tag so it reads as a sample rather than as part of the conversation, and the rules say what the answer contains instead of what it must not do. Forbidding the copying was the alternative, but it leaves the placeholders in front of the model. On the same four events an example-based instruction opened every answer with a sentence about the error itself and kept all three section headings.

The example is written in the markup the rules ask for: identifiers in backticks, multi-line code in a fenced block between list items. The rules never mentioned inline code, and answers came back with identifiers as plain words and without code blocks.

Everything outside the example is in English, the language of the spotlighting rules it is concatenated with. The example carries the language of the answer.
Comment thread src/services/askAi/instructions/cto.ts Outdated
*
* The shape comes from a filled example.
*
* @see {@link https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices | Claude prompting best practices}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as i remember we've used OpenAI API, maybe there is peace of doc from them?

it would be more relevant

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, swapped to the OpenAI prompt engineering guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants