AskBatfish allows you to interact with Batfish through natural language Q&A using Large Language Models (LLMs). It provides a Chatbot UI built with Chainlit and integrates LLMs via LangChain, with persistence handled by Neo4j.
-
Create a
.env
File: Generate this file based on theenv.example
template.Note: The chatbot uses
gpt-4o
. You need to generate an OpenAI API key and configure it in the.env
file. -
Environment Variables:
Variable Name Default Value Description OPENAI_API_KEY None REQUIRED - Your OpenAI API key NEO4J_URI neo4j://neo4j:7687 REQUIRED - URL to Neo4j database NEO4J_USERNAME neo4j REQUIRED - Username for Neo4j database NEO4J_PASSWORD 12345-password REQUIRED - Password for Neo4j database
-
Build and Start (If first time or changes have been made):
cd chatbot/ docker compose up --build
-
Start:
cd chatbot/ docker compose up
-
Watch Mode (Auto-rebuild on file changes):
- First, start everything.
- Then, in a new terminal:
cd chatbot/ docker compose watch
The chatbot UI will prompt you to upload a snapshot of your network in .zip
format. If you are unfamiliar with Batfish, refer to this page to learn how to package your network snapshot configuration files.
Example network snapshots are available in the /networks
directory for you to experiment with.
AskBatfish offers two modes:
- Agent Mode: This mode includes an agent that can interpret results and provide detailed explanations.
- Basic Mode: This mode returns raw results directly from Batfish, preferred by engineers who need to see direct results.
In Basic Mode, users can prefix their queries with /ask
to get help formulating their questions. This feature guides users in providing the necessary details for accurate responses.
If health checks fail or containers do not start as expected, shut down completely before starting up again:
docker compose down
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE.md file for details.
For any questions or concerns regarding this project, please feel free to contact us at: amaroxmo <at> gmail <dot> com
.