Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr AI→ original

Jmix taught its RAG assistant not to make up APIs: 71 of 74 questions passed without changing the model

On a trick question, the Jmix assistant produced ready-made XML with a repeatCount attribute that the timer does not have, and that kind of code is tempting to copy. The model was not changed. The team split the documentation into complete examples, added a reference built from Javadoc, and rewrote the prompt. On 74 control questions, the new version passed 71, or about 96%. If a RAG system makes up APIs, fix the index, not the LLM.

AI-processed from Habr AI; edited by Hamidun News
Jmix taught its RAG assistant not to make up APIs: 71 of 74 questions passed without changing the model
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Code in examples is checked verbatim against the source page, and anything that doesn't match is discarded
Key metric #2Javadoc cards are built by a parser without a model, so signatures can't be invented
Key metric #3Search retrieves up to 12 candidates, and 6 remain in the context instead of 3

The most dangerous mistake an AI assistant for developers can make is not refusing to answer, but giving a confident answer with a made-up API. The Jmix team, which develops Jmix, an open-source platform for enterprise Java applications, ran into this with its own assistant, which has been running since late 2023. It was asked a trick question: "Which repeatCount value will make the timer fire five times?"

The assistant produced ready-made XML without hesitation, even though Jmix 2.8 has no such attribute for the timer. After the search was reworked and tested on a set of 74 control questions, the new configuration passed 71 of them, meaning the answers were accepted for about 96% of the questions.

The chat model stayed the same: only the search that feeds it material changed.

Why made-up code is worse than a refusal

The correct solution for the timer is different: set repeating="true", count the firings in the TimerActionEvent handler, and call stop() after the fifth. The assistant, however, suggested an attribute that does not exist. A ready-made snippet is tempting to copy, which makes it more dangerous than an honest "I couldn't find it." The second question showed the opposite problem: the assistant could not list the overloads of FetchPlanBuilder.add and refused to improvise. The answer was honest, but the developer still had to go to the Javadoc for the signatures.

The team was unhappy with three things: the assistant mixed up API names, the search pulled entire pages of tens of thousands of tokens into the context, and there was no way to measure the changes. Quality had been checked by hand: they asked questions, read the answers, and clicked like or dislike. After each change the text sounded convincing, and it was impossible to tell whether things had improved.

What was rebuilt in the search

The assistant is built on a RAG scheme: before answering, the model searches for relevant fragments of documentation and relies on them. Texts are turned into vectors by an embedding model and stored in pgvector, a PostgreSQL extension, and a small reranker (gpt-5.4-nano) re-sorts the results by how useful they are for the question. Previously there were two corpora: documentation and interface examples. Pages were cut by length rather than by meaning, so an annotation could stay in one chunk while the method body ended up in another. There was no search over the Java API at all, and the assistant simply could not see the FetchPlanBuilder.add signatures.

What changed:

  • The model finds complete examples on a page, briefly describes them, and carries the code over verbatim. These fragments are called snippets. Alongside them sits the full page text, split into 8000-character chunks as a safety net.
  • Each code block from a snippet is searched for as a substring on the original page. If it isn't found, the model has "improved" the code, and the snippet is discarded. In the experiment, one mismatch discarded all of a page's snippets; now only the corrupted one is dropped.
  • A parser walks the published Javadoc and collects class cards with declarations as they are. The model takes no part in this step, so there is no one to invent a method. For a separate javaapi-enriched corpus, the model adds a description and an example to the cards so that a live question like "how do I load an order together with its line items" finds the right class.
  • Search retrieves up to 12 candidates instead of 10 or 5, and after the reranker six fragments remain in the context instead of three. The prompt now requires shorter answers and checking API names and the premises of the question.

Honest limitations

All the changes were introduced at once, so the contribution of each one on its own is unknown. The number of passes for the old configuration is not given in the text: it is only said that it passed less often. Some of the new version's drops turned out to be errors of the judge model, and one reference answer contradicted the official documentation. The output of the new MCP server for external AI agents was not measured: it was only shown to an agent, which liked the new one better, a subjective result.

Checking code against its source also has a limit. It confirms that the code was taken from the page, but not that it is correct or safe. If the error is on the page itself, the check will let it through. That is why this pipeline only suits trusted sources such as the company's own documentation and Javadoc.

What to do in practice

If you are building RAG over technical documentation, start with a set of control questions with reference answers, including trap questions about non-existent methods. Without one, any change to the search is guesswork. Then split documents by meaning rather than by length, add a separate search over the API reference, and verify that the code in the index matches the source verbatim. You don't necessarily have to change the model: for Jmix, the biggest gain came from reworking what gets fed into it.

Story

Key Questions Answered

Why made-up code is worse than a refusal?

The correct solution for the timer is different: set repeating="true", count the firings in the TimerActionEvent handler, and call stop() after the fifth. The assistant, however, suggested an attribute that does not exist. A ready-made snippet is tempting to copy, which makes it more dangerous than an honest "I couldn't find it." The second question showed the opposite problem: the assistant could not list the overloads of FetchPlanBuilder.add and refused to improvise.

What was rebuilt in the search?

The assistant is built on a RAG scheme: before answering, the model searches for relevant fragments of documentation and relies on them. Texts are turned into vectors by an embedding model and stored in pgvector, a PostgreSQL extension, and a small reranker (gpt-5.4-nano) re-sorts the results by how useful they are for the question. Previously there were two corpora: documentation and interface examples.

What are the key details on Honest limitations?

All the changes were introduced at once, so the contribution of each one on its own is unknown. The number of passes for the old configuration is not given in the text: it is only said that it passed less often. Some of the new version's drops turned out to be errors of the judge model, and one reference answer contradicted the official documentation. The output of the new MCP server for external AI agents was not measured: it was only shown to an agent, which liked the new one better, a subjective result.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Jmix taught its RAG assistant not to make up APIs: 71 of 74 questions passed without changing the model https://news.hamidun.com/en/news/16646/jmix-taught-its-rag-assistant-not-to-make-up-apis-71-of-74-q

What do you think?
Loading comments…