DEV Community

Kevin Naidoo
Kevin Naidoo

Posted on

What is intent prompting?

When you need to build more complex applications using LLMs, you often need to determine a course of action based on various scenarios.

For example: if you are building an insurance application, the user may be interested in one of these insurance types: car, household, pets, etc...

Based on their request, you need to route your AI to the correct workflow since each of these types will require a different set of questions.

How to achieve this?

Intent prompting

Intent prompting allows you to instruct the LLM to return a structured response so that you can better understand the user's request and route your workflow accordingly. Here's an example:

Given the following question from the human, 
please determine which action the human wants to take:

- The human is interested in car insurance. 
  Respond with only the following tag: <car insurance />.
- The human is interested in pet insurance. 
  Respond with only the following tag: <pet insurance />.
- The human is asking a general question.
  Respond with a relevant answer from the context 
  data below wrapped in a <answer> tag.

<context>
SOME CONTEXT DATA HERE.
</context>
Enter fullscreen mode Exit fullscreen mode

You can then use some Python logic to check which tag was returned and take the next steps in your process flow.

Try Ragable: https://github.com/plexcorp-pty-ltd/ragable . Ragable is a RAG toolkit that will simplify your agent workflow and help you build complex AI powered apps with ease.

Top comments (0)