Skip to content

A simple ReAct agent that has access to LlamaIndex docs and to the internet to provide you with insights on LlamaIndex itself.

License

Notifications You must be signed in to change notification settings

AstraBert/llamaindex-docs-agent

Repository files navigation

LlamaIndex Docs Agent

A useful companion when developing with LlamaIndex

If you find LlamaIndex Docs Agent useful, please consider to support us through donation:

GitHub Sponsors Badge

LlamaIndex Docs Agent Logo

Install and launch🚀

The first step, common to both the Docker and the source code setup approaches, is to clone the repository and access it:

git clone https://github.com/AstraBert/llamaindex-docs-agent.git
cd llamaindex-docs-agent

Once there, you can choose one of the two following approaches:

Docker (recommended)🐋

Required: Docker and docker compose

mv .env.example .env
  • Launch the Docker application:
# If you are on Linux/macOS
bash start_services.sh
# If you are on Windows
.\start_services.ps1

You will see the application running on http://localhost:8000/gradio and you will be able to use it. Depending on your connection and on your hardware, the set up might take some time (up to 30 mins to set up) - but this is only for the first time your run it!

Source code🗎

Required: Docker, docker compose and conda

mv .env.example .env
  • Set up LlamaIndex Docs Agent using the dedicated script:
# For MacOs/Linux users
bash setup.sh
# For Windows users
.\setup.ps1
  • Or you can do it manually, if you prefer:
docker compose up vector_db -d

conda env create -f environment.yml
conda activate llamaindex-docs

python3 scripts/loadData.py

cd scripts/
uvicorn main:app --host 0.0.0.0 --port 8000

conda deactivate

You will see the application running on http://localhost:8000/gradio and you will be able to use it.

How it works

LlamaIndex Docs Agent workflow

Whenever the user asks a question from the Gradio chat interface running on http://localhost:8000/gradio, this question is processed by the /message endpoint of the FastAPI-managed API to which the Gradio app is attached. The /message endpoint passes the user message to the ReAct agent, which:

  • Uses the query router to select an index (summary or vector database) from which to retrieve relevant information to the user's prompt. The vector database uses hybrid search.
  • Once the retrieved information is sent to the agent, it thinks whether the context is sufficient or not: if yes, it formulates a solution and returns it to the user, if no it activates the Tavily search tool
  • The Tavily search tool searches the web for a solution and returns an answer to the agent, which then decides if the answer is sufficient and, in that case, returns a solution to the user

Contributing

Contributions are always welcome! Follow the contributions guidelines reported here.

License and rights of usage

The software is provided under MIT license.

About

A simple ReAct agent that has access to LlamaIndex docs and to the internet to provide you with insights on LlamaIndex itself.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published