You can build a RAG assistant using a Chroma database.
To create a Chroma database:
- Add the data you want to use to a folder, i.e.
./data, Word and PDF files are currently supported. - Open
create_chroma_db.pyfile and set the folder_path variable to the path to your data i.e../data. - You can change the database name, chunk size and overlap size.
- Assuming you have already followed the Quickstart and activated the virtual environment, to create the database run:
python scripts/create_chroma_db.py- If successful, a Chroma db will be created in the repository root directory.
To create a RAG assistant:
- Open
tools.pyfile and make sure the persist_directory is pointing to the database you created previously. - Modify the amount of documents returned, currently set to 5.
- Update the
database_search_funcfunction description to accurately describe what the purpose and contents of your database is. - Open
rag_assistant.pyfile and update the agent's instuctions to describe what the assistant's speciality is and what knowledge it has access to, for example:
instructions = f"""
You are a helpful HR assistant with the ability to search a database containing information on our company's policies, benefits and handbook.
Today's date is {current_date}.
NOTE: THE USER CAN'T SEE THE TOOL RESPONSE.
A few things to remember:
- If you have access to multiple databases, gather information from a diverse range of sources before crafting your response.
- Please include the source of the information used in your response.
- Use a friendly but professional tone when replying.
- Only use information from the database. Do not use information from outside sources.
"""- Open
streamlit_app.pyfile and update the agent's welcome message:
WELCOME = """Hello! I'm your AI-powered HR assistant, here to help you navigate company policies, the employee handbook, and benefits. Ask me anything!""- Run the application and test your RAG assistant.