A knowledge base system based on LangChain, Milvus, HuggingFace Embeddings and Azure OpenAPI, utilizing Milvus for document vector storage and management. Using RAG technology, information is retrieved from the knowledge base in multi round dialogue and multi session management scenarios, and precise are generated by combining LLMs.
- HTTP interface based on FastAPI
- Support multi-round dialogue (context memory)
- Supports multi-session management (via thread_id)
- Support document uploading and automatic segmentation processing
- Install dependencies:
require: python >= 3.9
pip install -r requirements.txt
- Configure environment variables:
Create an
.env
file and set the following variables
AZURE_OPENAI_API_KEY=your_api_key_here
AZURE_OPENAI_ENDPOINT=your_api_endpoint_here
AZURE_OPENAI_API_VERSION=your_api_version_here
MILVUS_HOST=localhost
MILVUS_PORT=19530
LANGSMITH_API_KEY=your_langsmith_key_here
-
starting the Application:
python src/main.py
curl -X POST "http://localhost:8000/api/upload" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/document"
curl -X POST "http://localhost:8000/api/query" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"thread_id": "session_123",
"query": "Your question"
}'
curl -X POST "http://localhost:8000/api/clear_memory/session_123" \
-H "accept: application/json"
This project is a basic knowledge base system, on which you can expand and adjust according to actual needs. Such as replacing vector databases, LLMs models, embeddings models, etc.