Skip to content

About

Developed a conversational AI assistant using Retrieval-Augmented Generation (RAG) to help visitors search and explore technical articles on a personal blog.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

GitHub Docs LINE Bot

A LINE chatbot that uses Retrieval-Augmented Generation (RAG) to answer questions based on documentation stored in GitHub repositories.

Users can ask questions through LINE, and the bot retrieves relevant documentation from GitHub before generating a response with Google Gemini.

Features

  • GitHub Integration: Loads documentation from GitHub repositories.
  • Document Retrieval: Retrieves relevant content based on user questions.
  • Question Answering: Uses Google Gemini to generate answers from retrieved documentation.
  • LINE Integration: Allows users to interact with the bot through LINE.
  • Conversation History: Keeps track of previous messages for follow-up questions.

Tech Stack

  • Language: Python
  • Backend: FastAPI
  • Chat Platform: LINE Messaging API
  • LLM: Google Gemini
  • Architecture: Retrieval-Augmented Generation (RAG)
  • Document Source: GitHub

Project Structure

github-docs-linebot/
├── app.py              # FastAPI application and LINE webhook
├── rag_engine.py       # RAG pipeline and LLM integration
├── github_loader.py    # Loads documentation from GitHub
├── requirements.txt    # Python dependencies
└── README.md

Getting Started

Prerequisites

  • Python 3.10 or later
  • A LINE Messaging API channel
  • A Google Gemini API key
  • A GitHub account and access token

1. Clone the Repository

git clone https://github.com/p0tat0ba11/github-docs-linebot.git
cd github-docs-linebot

2. Set Up a Virtual Environment

python -m venv venv

Activate the environment:

Windows

venv\Scripts\activate

Linux / macOS

source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the project root:

LINE_CHANNEL_ACCESS_TOKEN=your_line_channel_access_token
LINE_CHANNEL_SECRET=your_line_channel_secret
GOOGLE_API_KEY=your_google_api_key
GITHUB_OWNER=your_github_username
GITHUB_REPO=your_repository_name
GITHUB_TOKEN=your_github_token
GITHUB_DIR_PATH=your_documentation_directory

Replace the placeholder values with your own credentials and repository information.

Note: Do not commit your .env file or expose your API keys and access tokens.

5. Run the Application

uvicorn app:app --host 0.0.0.0 --port 8000

The application runs at:

http://localhost:8000

6. Configure the LINE Webhook

Set your LINE Messaging API webhook URL to:

https://your-domain.com/callback

Replace the domain with your application's public HTTPS URL.

Enable Use webhook in the LINE Developers Console and verify the connection.

For local development, use an HTTPS tunneling service to expose your local application.

Future Improvements

  • Deploy the bot to a public cloud hosting service.
  • Improve document retrieval and indexing.
  • Store conversation history persistently.
  • Improve webhook processing and message handling.
  • Add monitoring and usage statistics.

Attribution

If you use, modify, or redistribute this project, please acknowledge the original project:

Please retain the original copyright and license notice when redistributing this project.

If you build upon this project, a link to the original repository and credit to the original author are appreciated.

License

This project is licensed under the MIT License.

About

Developed a conversational AI assistant using Retrieval-Augmented Generation (RAG) to help visitors search and explore technical articles on a personal blog.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages