Knowledge-base AI is a FastAPI-based project designed to build an AI agent using LangGraph and PydanticAI. The application scrapes web URIs for information, answers queries based on the gathered data, and creates knowledge bases.
This project leverages FastAPI to provide a RESTful API for interacting with an AI agent. The agent is capable of:
- Scraping web pages for content.
- Summarizing the content and generating insights.
- Answering user queries based on the scraped data.
The application uses LangGraph and PydanticAI to structure and process data, making it a robust solution for building knowledge bases.
📌 Like this project? Give it a ⭐ on GitHub!
git clone https://github.com/yourusername/knowledge-base-ai.git
cd knowledge-base-aipip install -r requirements.txtCopy the sample environment file and edit it:
cp .env.sample .envUpdate the .env file with your API keys and configurations.
To run the application with auto-reload:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000The app will be available at: http://0.0.0.0:8000
- Endpoint:
/health - Method:
GET - Description: Returns the health status of the application.
- Endpoint:
/ - Method:
GET - Description: Provides metadata about the project (name, version, description).
- Endpoint:
/query - Method:
GET - Description: Accepts a query string and invokes the AI agent to scrape and process data.
- Query Parameter:
query(required): The query string describing what to scrape.
The application uses the following environment variables (see .env.sample):
OPENAI_API_KEY: The API key for accessing OpenAI services.MODEL: The AI model to use (default:gpt-4o-mini).TAVILY_API_KEY: The API key for accessing Tavily services.
Ensure these variables are set correctly in your .env file.
- Improved scraping for js based websites.
- scraping all links of a website.
- Chunked summarization.
- introduction of semantic search and creation of knowledge bases.
- Enhanced error handling and logging.
We welcome contributions from everyone! Please read our Contributing Guide to get started. ✨
This project is licensed under the MIT License. See the LICENSE file for details.