LiyaEngine Docs

Create and run the intent

A typed intent that classifies a dispute, and how to read what comes back.

Dashboard

The snippets on this page reuse the client from the setup.

Step 3: Create the intent

An intent is one named, typed capability: a prompt, an input contract, an output contract, and the knowledge it may use. Callers send fields; they get back JSON in a shape you defined, validated before you see it. This is what makes a model call safe to put behind application code.

The intent below has four parts that matter:

  • inputSchema names what a caller must send. message is required. transaction and today are optional context.
  • outputSchema is the contract. category and urgency are enums, so the model cannot invent a new category, and confidence is a number between 0 and 1.
  • retrievalConfig.source_types names the collection to retrieve from. Naming it explicitly is the safe habit: the intent reads the dispute policy and nothing else the workspace knows.
  • executionConfig.structured_output turns on validation with up to two automatic retries, so an answer that breaks the schema is repaired before it reaches you.
  1. Open Build → Intents and add an intent to Dispute Desk.
  2. Under Basics, set the key to classify_dispute, the name to Classify a dispute, and the one-sentence description.
  3. Under Instructions, paste the prompt shown in the API tab. The {{message}}, {{transaction}} and {{today}} placeholders appear as Variables.
  4. Under Contract, define the input and output fields to match the schemas. category and urgency take only the listed values.
  5. Under Grounding and guardrails, choose the Card dispute policy collection.
  6. Under Runtime and safety, turn on Retry when the output is invalid.
  7. Use Preview to try a message, then save.

Step 4: Run it

Every call needs input.user_id, a string from your own system that identifies the end user. LiyaEngine uses it to keep conversations apart and to attribute usage. It is required by design: a call without it is rejected.

  1. Open Playground → Playground and choose the Classify a dispute intent.
  2. Enter the message and transaction from the API tab.
  3. Run it. The answer shows the category, urgency, confidence and rationale, and the sources it used.
  4. To see the full record of the call, open Observe → Traces and choose the newest one.

Read the response from the top:

  • structured is your output, already checked against the schema. This is the field your application reads.
  • sources lists the passages the answer was built from, with a relevance score. Both policy files were used, which is why the rationale cites DSP-130 and DSP-110.
  • grounding_verified: true means a check confirmed the answer is supported by those sources. flags is empty because nothing was wrong.
  • metadata reports the model, cost and latency of the call. model_used shows whichever model your workspace is set to use.

Try a second dispute, where the cardholder did not make the purchase:

{
  "category": "unauthorized",
  "urgency": "high",
  "confidence": 0.92,
  "rationale": "The cardholder states they did not make the purchase and had the card in their possession, matching the unauthorized category in DSP-130 (a charge they did not make), with no indication a known person used the card. Urgency is high per DSP-110 because the cardholder reports not making the purchase, meaning the card details may be in someone else's hands."
}

How much evidence an answer needs

Retrieval only returns passages that clear a similarity floor, 0.15 by default. The relevance values above are well over it, so the policy was found. A question that has nothing to do with disputes finds no passages, and the intent says it has no sourced answer instead of inventing one. To make an intent stricter or looser, set similarity_threshold and top_k in its retrievalConfig. See Retrieval and memory.


Next: Protect it with a guardrail template

On this page