Skip to main content

Agent Plugins: Reference Starters

Document Lookup (RAG)

diagram-rag.png

RAG stands for retrieval-augmented generation - which means it uses data to help guide and ground the model in its answers.

The Document Lookup (RAG) plugin enhances your AI assistant's capabilities by integrating relevant information from your uploaded documents.

It breaks down these documents into smaller chunks, analyzes their content, and matches them against your queries. When you ask a question, the plugin intelligently selects the most relevant document excerpts and presents them to the AI model, enabling more accurate and informed responses.

Additionally, it identifies and presents citations, allowing you to trace the origins of the information within your documents.

This agent plugin is backed by LiteLLM for request generalization to LLM services, so any of the LiteLLM providers should be compatible with the plugin.

We also recommend having a look at our Document Summary plugin for another methdaology for looking up parsing your documents and extracting facts.

Setting up your agent

  • After setting up your system, navigate to the "Add Panel" section and select your Document Lookup (RAG) plugin.
  • Choose your desired Model from the list of available options.
  • Choose a Simple Model - this one can use a cheaper model and will be used for things like titling your threads.
  • Choose a Embedding model - for embedding the chunks of your documents as well as the incoming question context.
  • Set the overall Context Size for the model which you are connecting to.
  • Set how much of the overall Context Size you'd like to use for document context for grounding (using Document Context Size).
  • Set a System Message, this will help guide your model if you'd like it to behave a certain way or do something specific.
  • Set your LLM Model API Key for your model's API key, and Embedding API Key for your embedding model.
  • If you need to set a specific URL Base, this is available in the settings area.

Once you've added your API key, your agent will be ready to use!

Making requests using /lookup command

To activate the lookup action on one of your documents:

  • Use the /lookup command in your chat
  • Followed by your document(s) filename(s) /file filename.pdf
  • And then any additional questions you have to add the documents to your context when chatting.

An example prompt with the command would look like:

/lookup /file filename.pdf What was the cause for the miss in Q2 earnings?

Review the code

Want to review how this model is made, or use it as the base to creating a new agent plugin?

You can find the code that powers this plugin available here:
https://github.com/promptpanel/promptpanel/tree/main/plugins/rag_lookup