Close

AI Basics - Combining Intent And Entity Extraction

[Last Updated: Jan 11, 2026]

In a real-world production environment, you don't want to make two separate API calls to find the Intent and then the Entities. Instead, you use a System Prompt to force the AI to act as a structured data generator. This turns a messy human sentence into a clean JSON object that your code can read instantly.

The System Prompt: The Developer's Configuration

To get structured data, you provide the AI with a "schema" or a set of instructions. This is the "code" of the AI era. You define the categories and the pieces of information you need the AI to "pluck" out of the conversation.

Example: The Order App

Imagine your Java or Python backend sends the following "System Instructions" to the LLM behind the scenes:

Identify the intent and extract entities from the user's request.
Intents: [CHECK_ORDER, CANCEL_ORDER, REFUND_REQUEST, UNKNOWN] 
Entities to find: [order_id, item_name, reason] 
Return the result ONLY as a JSON object. 

User Input

"I need a refund for the soggy fries in my order #9921."

The AI "Reasoning Engine" performs the following steps:

  1. Classify: It recognizes "need a refund" as REFUND_REQUEST.
  2. Extract: It identifies "soggy" as the reason, "fries" as the item_name, and "9921" as the order_id.
  3. Format: It wraps everything into a JSON string.

The Output Your Code Receives

Your application doesn't get a "chat" response; it receives this clean data structure:

{   "intent": "REFUND_REQUEST",   "entities": {     "order_id": "9921",     "item_name": "fries",     "reason": "soggy"   } }

Following is a screenshot from ChatGPT:

Why This is a Game Changer for Developers

By combining these concepts, you have created a Natural Language Interface for your existing functions. Instead of building a complex UI with dozens of buttons and dropdowns, the user can simply state their problem, and your AI provides the exact "arguments" your code needs to solve it.

  • Predictability: Because the AI returns JSON, your code won't crash trying to read a "chatty" response.
  • Efficiency: One API call handles both understanding the "What" and the "Who/Which."
  • Scalability: Adding a new feature is as simple as adding a new "Intent" to your prompt and writing the corresponding function in your backend.

See Also

Join