Since there are multiple approaches and multiple implementations per each
(including in PHP), we decided to not reinvent the wheel. For more info check
RAG section in Guides.
Prompt method of an Agent
The best place to inject your RAG solution is theprompt
method of Agent class,
which initially looks like this:
respond
method is going through prompt method at first,
so here you can mutate/enhance the user message as well as query the database for extra context.
Let’s imagine we have (any type of) RAG implemented as RetrivalService
with Search
method.