Skip to content

A knowledge base constructed based on Langchain+RAG+LLM

Notifications You must be signed in to change notification settings

BinZoom/VecLLM-KB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VecLLM-KB

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.

Features

  • 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

  1. Install dependencies:

require: python >= 3.9

pip install -r requirements.txt
  1. 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
  1. Install Milvus

  2. starting the Application:

python src/main.py

API usage

1. Upload document

curl -X POST "http://localhost:8000/api/upload" \
     -H "accept: application/json" \
     -H "Content-Type: multipart/form-data" \
     -F "file=@/path/to/your/document"

2. Search the knowledge base

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"
         }'

3. Clear session memory

curl -X POST "http://localhost:8000/api/clear_memory/session_123" \
     -H "accept: application/json"

Other

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.