Introducing RAG Assistant Support in Sirji

We’ve recently added new features to the Sirji framework, allowing you to create, sync, and infer from a RAG (Retrieval-Augmented Generation) assistant. At the backend, the OpenAI assistants API is being used. Here’s a brief overview of these enhancements.

Creating a RAG Assistant

To create a RAG assistant, include this step in your agent's pseudocode:

Create an assistant with the following instructions:
{{Write the instructions here}}

This will create the assistant and a vector store attached to it.

Following is an example pseudocode for creating an assistant to provide semantic search in project files:

Create an assistant with the following instructions:
        Your job is to search the project files as requested and respond with a list of the project file paths. If there are no matches, simply convey that there are no matches.

Syncing Project Files with the Assistant

Next, sync your project files with the assistant, by including the below step in your agent’s pseudocode:

Sync project files with the assistant.

This uploads all project files to the assistant's vector store, excluding:

  • Files listed in .gitignore
  • Media files based on file extensions

Querying the Assistant

Once the assistant is created and the project files are synced, you can query the assistant by adding this step in your agent’s pseudocode:

Infer from the assistant with the following query:
{{Write the query here}}

You can perform complex queries like this example:

Infer from the assistant with the following query:
Search files which have usages of button_to method as well as constantize method. Return the list of file paths.

Auto Cleanup of the Assistant

The assistant is auto-cleaned at the end of its task or in case of crashes, ensuring no leftover data. The cleanup process includes:

  • Deleting all uploaded files from the vector store
  • Removing the vector store
  • Deleting the assistant

New Powers Added to Sirji

Here are some use cases we have tried for inferences:

  • Embeddings-based search in the code files: Allows efficient searching within code files using vector embeddings.
  • Shortlisting files needing changes: Identifies which files need modifications and describes the necessary changes.
  • Knowledge extraction: Extracts relevant information from codebases and documentation for quick reference.

As we continue developing new agents, even more use cases will emerge.

Happy coding with Sirji!.

Kedar Chandrayan

Kedar Chandrayan

I focus on understanding the WHY of each requirement. Once this is clear, then HOW becomes easy. In my blogs too, I try to take the same approach.