Documentation

# PromptEngineering

# What is a Prompt?

A prompt is an input text or query provided to guide the model's response or generate the desired output.

Even when an AI model is technically advanced, it can still miss the mark — often because of poor prompts. A vague, incomplete, or misleading prompt can lead to irrelevant or incorrect answers. If the prompt lacks clarity, structure, or context, the output will reflect that no matter how powerful the model is. In many cases, bad prompts are the root cause of AI failure, making prompt engineering one of the most critical parts of successful AI use.

A well-designed prompt provides clarity, reduces ambiguity, and gives the model context, direction, and sometimes even examples to follow. This leads to more relevant, consistent, and trustworthy results especially in high-stakes or domain-specific use cases.

# Understanding how to make Prompts Work

There are six different techniques that can be followed to make prompts work:

  1. Role Prompting - Assigns a specific roles or focused responses
  2. Few-Shot Prompting- Provides examples for guidance
  3. Contextual Prompting - Adds background info for clarity
  4. Chain of Thought - Instructs reasoning step-by-step
  5. Meta Prompting - Generates or critiques prompts
  6. ReAct Framework - Enables reasoning and actions

# Role Prompting

Role Prompting is a technique where you assign a specific role or identity to your Agent in the prompt to shape the style, expertise, or focus of its response. This helps get more tailored, accurate, and useful outputs.

For example,
Before prompting - Explain how compliance monitoring in banking works.
After Prompting - You are a Compliance Analyst explaining how AI monitors regulatory breaches to a newly joined audit officer. Keep it concise and emphasize risk reduction and audit trails.

# Few-Shot Prompting

In few-shot prompting, you give the AI a handful of examples (usually 2–5) of input-output pairs. These serve as patterns to follow, allowing the agent to better understand what kind of response you want—even for complex or subjective tasks.

For example,
Before Prompting - Write a product launch announcement email for our new AI-powered underwriting assistant.

After Prompting -
Write a product launch announcement email for our new AI-powered underwriting assistant.

Example 1:
Subject: Smarter lending starts now
Body: We’re excited to launch UnderwriteIQ — your intelligent co-pilot for risk-free credit decisions. Automate document checks, reduce defaults, and speed up processing. Try it today.

Example 2:
Subject: AI that thinks like your best analyst
Body: Introducing UnderwriteIQ — a game-changer in SME loan processing. With real-time scoring, document extraction, and compliance checks, it's underwriting reimagined.

# Contextual Prompting

Contextual prompting involves supplying background details or setting the stage before making a request. It helps the model understand your goals, constraints, or situation, leading to more relevant, personalized responses.

For example,
Before Prompting - Create a product description for a customer support chatbot.
After Prompting - Create a product description for a digital banking assistant tailored to mass affluent customers. Highlight proactive financial insights, 24/7 availability, multilingual support, and integration with lifestyle services.

# Chain of Thought

Chain-of-thought (CoT) prompting is a technique where you explicitly instruct the agent to reason step-by-step before reaching a final answer. It helps with tasks that require logical thinking, multi-step reasoning, or problem-solving.

For example,
Before Prompting - How can we improve turnaround time in operations?
After Prompting - How can we improve turnaround time in loan origination? Think step-by-step — from document intake, to credit analysis, to final approval. Highlight agent-driven steps.

# Meta Prompting

Meta prompting is when you ask the agent to generate, improve, critique, or analyze prompts — essentially prompting the AI about prompting.

For Example: Before Prompting - Describe this AI Product.
After Prompting - Here’s my prompt: “Describe this AI product.”
Can you suggest 3 better versions of this prompt that would give me a more useful and focused explanation?

# ReAct Framework

The ReAct (Reason + Act) framework is a prompting method that instructs the AI to interleave reasoning and actions to solve problems. It's especially useful for tasks that involve decision-making, tool use, or multi-step planning.

For example, Before Prompting - Is this financial transaction compliant?

After Prompting -
You are an AI compliance assistant.
Question: Is this international trade transaction compliant with anti-money laundering regulations?
Please answer using this format:
Thought:
Action:
Observation:
Final Answer:
----------------------------------------------------------------------------
Thought: Review transaction value and counterparty
Action: Cross-check with PEP/sanctions list
Observation: Counterparty is on a flagged list
Final Answer: Transaction is non-compliant. Flag for further review.

Thought: Can I approve this customer’s credit application?
Action: I need to check the customer’s credit history and income details.
Observation: Query internal credit data API.
Thought: API call failed due to timeout.

Action: Retrieve credit score using the fallback API.
Observation: Fallback score indicates medium credit risk.
Thought: For medium-risk applicants, policy requires manual review before approval.
Final Answer: Application is conditionally approved, pending manual override.

# Why Prompt Engineering Pays Off?

Prompt engineering is effective because it transforms raw AI potential into real, reliable results. A well-crafted prompt gives the AI clarity, structure, and context — helping it understand what’s truly needed. This reduces errors, improves consistency, and makes responses more aligned with business goals or user expectations. In practice, good prompt engineering saves time, reduces risk, and boosts the value of AI across tasks like summarization, content generation, data extraction, and decision support. It's the difference between mediocre output and mission-critical performance.

# Understanding the types of Purple Fabric Prompts

There are two main types of prompts Purple Fabric supports:

  • Conversational Prompt (or User Prompt) - The input or message a user types to start or continue a conversation with an AI system. It’s how a person tells the agent what they want — whether it’s asking a question, giving instructions, or requesting a task. Unlike rigid commands, conversational prompts are often written in natural, human-like language, which makes AI interactions feel more intuitive.
  • System Prompt - A special type of instruction given to an agent before the user interacts with it. It sets the overall behavior, tone, rules, and role the AI should follow throughout a session.
Aspects System Prompts User / Conversational Prompts
Audience Developers and product teams End users
Visibility Hidden from users Visible (user-generated)
Persistence Throughout session Point-in-time
Scope Global behavior Specific response
Authorship Product team Users