{"id":21880478,"url":"https://github.com/brucewind/knowledgebase-chat","last_synced_at":"2026-04-09T16:39:00.543Z","repository":{"id":255469205,"uuid":"852010740","full_name":"BruceWind/Knowledgebase-Chat","owner":"BruceWind","description":"RAG + openai to chat with a knowledgebase.","archived":false,"fork":false,"pushed_at":"2024-09-05T12:18:34.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-26T18:47:02.494Z","etag":null,"topics":["ai","ai-support","customer-support","customer-support-ai","openai","product-recommendation-with-ai","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BruceWind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T04:20:31.000Z","updated_at":"2024-09-05T12:18:38.000Z","dependencies_parsed_at":"2024-09-05T15:37:34.018Z","dependency_job_id":"bd156fc3-a335-409a-b126-74a0359c1bc9","html_url":"https://github.com/BruceWind/Knowledgebase-Chat","commit_stats":null,"previous_names":["brucewind/ai-customerservice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceWind%2FKnowledgebase-Chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceWind%2FKnowledgebase-Chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceWind%2FKnowledgebase-Chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceWind%2FKnowledgebase-Chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BruceWind","download_url":"https://codeload.github.com/BruceWind/Knowledgebase-Chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890099,"owners_count":20527031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-support","customer-support","customer-support-ai","openai","product-recommendation-with-ai","rag"],"created_at":"2024-11-28T09:14:05.286Z","updated_at":"2026-04-09T16:39:00.495Z","avatar_url":"https://github.com/BruceWind.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG-Powered Chat Application\n\nThis project implements a Retrieval-Augmented Generation (RAG) system with OpenAI integration, featuring document upload capabilities and a streaming chat API.\n\n## Features\n\n- Document upload and processing for RAG\n- Streaming chat API with OpenAI integration\n- FastAPI-based web server\n\n## Installation\n\n1.  Install **tesseract-ocr** and Clone the repository.\n\n- For macOS, use Homebrew: `brew install tesseract`\n- For ubuntu: `sudo apt-get update \u0026\u0026 sudo apt-get install tesseract-ocr`\n\n\n2. Create a virtual environment and activate it:\n```\npython -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\npip install --no-build-isolation faiss-cpu==1.7.2\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\n Click to expend: If you suffer an error: `Failed to build faiss-cpu` from this step:\n\u003c/summary\u003e\n   The error is related to building the faiss-cpu package, which requires SWIG. Here's a quick guide to resolve this issue:\n1. Install SWIG:\n\n   - For macOS, use Homebrew: `brew install swig`\n   - For ubuntu: `sudo apt-get update \u0026\u0026 sudo apt-get install build-essential swig libopenblas-dev`\n\n 2. or, SWIG does not work\n   - you can try using Anaconda/Miniconda. However, I dont want to put much tutorial here.\n   \n\n\n2. After installing SWIG, try installing the requirements again:\n   ```\n   pip install -r requirements.txt\n   ```\n\n3. If issues persist with faiss-cpu, try using a pre-built wheel:\n   - In requirements.txt, replace `faiss-cpu==1.7.2` with `faiss-cpu==1.7.2 --only-binary :all:`\n\n4. Alternatively, use faiss-cpu from conda:\n   - Install Miniconda or Anaconda\n   - Create a new conda environment: `conda create -n your_env_name python=3.8`\n   - Install faiss-cpu: `conda install -c conda-forge faiss-cpu`\n   - Install other requirements: `pip install -r requirements.txt`\n\u003c/details\u003e\n\n\n3. Start the server:\n\n    \u003e Create a .env file:\n   Create a file named `.env` in the root directory of the project and add the following content:\n   ```\n   OPENAI_API_BASE=https://XXXXX/v1\n   OPENAI_API_KEY=your_api_key_here\n   ```\n\nFollowing that, run this command:\n\n```\npython -m venv venv\nsource venv/bin/activate\nuvicorn app:app --host 0.0.0.0 --port 8000\n```\n\nThe server will run on `http://localhost:8000`\n\n## API Endpoints:\n   - POST `/upload`: Upload a document for processing\n     - Parameters:\n       - `file`: The document file to upload\n       - `doc_type`: (Optional) The type of the document\n     - Returns:\n       - `lib_id`: A unique identifier for the uploaded document's RAG instance\n   - POST `/chat`: Send a chat message and receive a streaming response\n     - Parameters:\n       - `message`: The chat message to process\n       - `lib_id`: The unique identifier of the RAG instance to use for this chat\n\n## Usage Example:\n1. Upload a document:\n   ```\n   curl -X POST -F \"file=@your_document.pdf\" -F \"doc_type=pdf\" http://localhost:8000/upload\n   ```\n   This will return a `lib_id` in the response.\n\n2. Chat using the uploaded document:\n   ```\n   curl -X POST -F \"message=Your question here\" -F \"lib_id=the_lib_id_from_upload\" http://localhost:8000/chat\n   ```\n   Replace `the_lib_id_from_upload` with the actual `lib_id` received from the upload response.\n\n## Acknowledgements\n\n- [FastAPI](https://fastapi.tiangolo.com/)\n- [OpenAI](https://openai.com/)\n- [Uvicorn](https://www.uvicorn.org/)\n- [RAG (Retrieval-Augmented Generation)](https://arxiv.org/abs/2005.11401)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucewind%2Fknowledgebase-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrucewind%2Fknowledgebase-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucewind%2Fknowledgebase-chat/lists"}