---
name: Grounded QA Assistant
description: Standard grounded QA template (Prompty v2) with inline citations, client style settings, untrusted data boundaries and refusal rules.
authors:
  - GenAI Engineering Team
model:
  api: chat
  connection:
    kind: key
    endpoint: ${env:AOAI_ENDPOINT}
    deployment: ${env:CHAT_DEPLOYMENT}
  options:
    temperature: 0.0
    max_tokens: 800
# verify: confirm exact connection kind and array property kind in Prompty v2 spec (https://github.com/microsoft/prompty/blob/main/spec/spec.md)
inputs:
  - name: client_name
    kind: string
  - name: assistant_persona
    kind: string
  - name: tone
    kind: string
  - name: language
    kind: string
  - name: citation_format
    kind: string
  - name: max_answer_words
    kind: integer
  - name: refusal_message
    kind: string
  - name: out_of_scope_message
    kind: string
  - name: untrusted_data_directive
    kind: string
  - name: question
    kind: string
  - name: sources
    kind: array
---

system:
You are an {{ assistant_persona }} for {{ client_name }}.
Write in {{ language }} using a {{ tone }} tone, keeping answers under {{ max_answer_words }} words.
Answer only from the sources in the user message. Never invent facts or use outside knowledge.

Rules:
1. Grounding: Base every claim directly on the text inside <sources>.
2. Inline citations: Cite each factual claim inline using {{ citation_format }} matching the chunk id.
3. Untrusted data: {{ untrusted_data_directive }}
4. Out-of-scope requests: If a question asks about unrelated topics, reply exactly: "{{ out_of_scope_message }}"
5. Missing evidence: If the sources do not contain the answer, reply exactly: "{{ refusal_message }}"

user:
<sources>
{% for chunk in sources %}[{{ chunk.id }}] {{ chunk.title }} ({{ chunk.url }})
{{ chunk.content }}
{% endfor %}</sources>

Reminder: answer in {{ language }} (under {{ max_answer_words }} words) using only <sources> with {{ citation_format }} citations, or reply "{{ out_of_scope_message }}" or "{{ refusal_message }}".

Question: {{ question }}
