DEV Community

Ramya Perumal
Ramya Perumal

Posted on

RAG - Mastering Prompt Frameworks for Better AI Responses

Prompting techniques such as zero-shot, one-shot, few-shot, system prompting, role prompting, contextual prompting, Chain of Thought, Tree of Thoughts, and self-consistent prompting are primarily sources of inspiration.

There are also structured frameworks that can be followed to generate better outputs from LLMs.

How do we know these frameworks are effective?

They have been developed and refined through extensive trial-and-error by practitioners and researchers who have experimented with different prompting approaches.

CRISP Framework

C (Context/Capacity)
Define the expertise or capability the AI should assume.

R (Role/Request)
Clearly specify the task to be performed.

I (Instructions/Insight)
Provide relevant context and information needed to complete the task.

S (Style/Specification)
Define constraints, requirements, and formatting expectations.

This can be closely associated with system prompting.

P (Purpose/Presentation)
Control the output format and explain the intended purpose of the response.

Context vs Purpose

Context and Purpose may appear similar, but they are different.

Example

Context:
I have an exam tomorrow, so I am asking this question.

Purpose:
If you provide a good answer, I will be able to perform well in the exam.

The context explains the background, while the purpose explains the reason or intended outcome.

Example :

When to Use CRISP

  • Creating content
  • Generating documents
  • Writing blogs

RICE Framework

R (Role)
Assign a specific role to the AI.

I (Instructions)
Clearly define what needs to be done.

C (Context)
Provide background information and relevant details.

E (Expectations)
Specify the desired outcome, format, and quality expectations.

Example :

When to Use RICE

  • Planning
  • Requirement gathering
  • Product roadmap creation

Top comments (0)