Skip to content

Commit

Permalink
feat: add product support plugin using fast-graphrag
Browse files Browse the repository at this point in the history
  • Loading branch information
luandro committed Dec 15, 2024
1 parent c540a59 commit b3d0f97
Show file tree
Hide file tree
Showing 11 changed files with 9,555 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/product_support_plugin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.venv
docs
.env
1 change: 1 addition & 0 deletions plugins/product_support_plugin/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TELEGRAM_BOT_TOKEN=
1 change: 1 addition & 0 deletions plugins/product_support_plugin/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
17 changes: 17 additions & 0 deletions plugins/product_support_plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10.1-slim

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app

# Copy project files
COPY pyproject.toml .
COPY . .
RUN uv venv
RUN uv sync --frozen
# Run the application
CMD ["uv", "run", "telegram_bot.py"]
41 changes: 41 additions & 0 deletions plugins/product_support_plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Product Support Plugin

A RAG (Retrieval Augmented Generation) plugin for analyzing product support based on given documentation to identify key features, user interactions, data collection methods, and how different components of the platform work together.

## Overview

This plugin processes documentation from Mapeo, an offline-first mapping and monitoring platform, to provide insights about:

- Key features and functionality
- User interaction patterns
- Data collection methodologies
- Component integrations
- System architecture

## Requirements

- Python 3.10.1 or higher
- uv package manager (recommended)
- Dependencies listed in pyproject.toml

## Installation

1. Clone the repository:

## Usage

The plugin can be used in three ways:

- As a CLI tool for direct queries
- Through the Telegram bot interface
- By importing and calling from your Python code

To install dependencies with uv (recommended):

### Docker

To run the Awana Telegram Bot using Docker, you can use the following command:

```bash
docker run -v ./bot:/app/mapeo_docs -e TELEGRAM_BOT_TOKEN=xxx:xxx-xxx -e OPENAI_API_KEY=sk-proj-xxx communityfirst/awana_telegram_bot
```
28 changes: 28 additions & 0 deletions plugins/product_support_plugin/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from main import initialize_grag, query

def main():
print("Welcome to Product Support Assistant!")
print("Ask questions about the product. Type 'exit' or 'quit' to end the session.")

# Initialize the GraphRAG once
grag = initialize_grag()

while True:
question = input("\nYour question: ").strip()

if question.lower() in ['exit', 'quit']:
print("Goodbye!")
break

if not question:
print("Please enter a valid question.")
continue

try:
response = query(question, grag)
print("\nAnswer:", response)
except Exception as e:
print(f"An error occurred: {str(e)}")

if __name__ == "__main__":
main()
Loading

0 comments on commit b3d0f97

Please sign in to comment.