Taming the generative AI back end
Briefly

Taming the generative AI back end
AI systems can interpret intent, but app developers must constrain what users can do to what the backend can actually support. Unrestricted LLM endpoints would allow requests beyond available functions, such as generating fictional items while the system only processes real business data. A mediation layer bridges the gap between user goals and app capabilities, ranging from lightweight inline mappings to retrieval-augmented generation with vector databases. The response schema is a primary control mechanism, often by forcing outputs into a well-defined JSON structure. Earlier approaches relied on prompt instructions and could fail due to extra text, while newer models use built-in mechanisms to follow response structure indicators more reliably, even for complex prompts.
"The novel power of today's AI is in its ability to deal with intent. This is a superpower, no doubt, but it creates a huge imperative for app developers: the need to map between the anything-is-possible large language model (LLM) and the strict capabilities of code. Unrestrained, LLM endpoints will let your user create unicorns and leprechauns while your back end can handle only purchase orders and customer profiles."
"You must harness the LLM's ability to understand intent to what the app is logically capable of, meanwhile keeping context (and therefore spend) under control. Between what the user wants to do and what your app is capable of is you. Or, more specifically, the mediation layer you build. This layer can sit anywhere on a broad spectrum, from using incredibly lightweight inline strings to using a massive retrieval-augmented generation (RAG) system backed by a vector database."
"Somewhere in there is the sweet spot for your particular project. It turns out there is a great deal you can do without resorting to the extra infrastructure of a vector database, and indeed, one should avoid that until it is really, truly needed. The first step in keeping your AI API's manageable is the response schema. Probably the single most potent weapon in your arsenal, the essential first move, is forcing the responses from the AI model into a well-defined structure, often JSON."
"Not long ago, this was a hit-or-miss affair. The developer essentially begged the model for a structured response, by adding Respond with structured JSON like this: { name : string } to the prompt. And this would kind of work, but sometimes the AI would add a helpful Here is your JSON: and the response handler would break. Recent models are much better about this."
Read at www.infoworld.com
Unable to calculate read time
[
|
]