Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: python:3.10-slim
image: python:3.13-slim

steps:
- uses: actions/checkout@v4
Expand All @@ -23,6 +23,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
# Install the package in development mode
pip install -e .
- name: Lint with flake8
Expand Down
19 changes: 13 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

InnieMe is a Discord bot that provides AI-powered Q&A capabilities using document knowledge bases. The bot scans and vectorizes documents from specified directories, connects to Discord channels, and responds to user mentions with context-aware responses using OpenAI's GPT models.
InnieMe is a Discord bot that provides AI-powered Q&A capabilities using document knowledge bases. The bot scans and vectorizes documents from specified directories, connects to Discord channels, and responds to user mentions with context-aware responses using configurable LLM providers via PydanticAI.

## Common Development Commands

Expand All @@ -16,7 +16,7 @@ pip install -r requirements-dev.txt

# Create configuration from example
cp config.example.yaml config.yaml
# Edit config.yaml with your Discord token, OpenAI API key, and channel settings
# Edit config.yaml with your Discord token, API keys, LLM model, and channel settings
```

### Running the Bot
Expand Down Expand Up @@ -61,9 +61,9 @@ The application follows a modular architecture with clear separation of concerns
1. **DiscordBot** (`src/innieme/discord_bot.py`): Main bot interface that handles Discord events, commands, and message routing
2. **Innie** (`src/innieme/innie.py`): Container class that manages multiple topics and their configurations
3. **Topic** (`src/innieme/innie.py`): Represents a single topic with its own document store, channels, and conversation engine
4. **ConversationEngine** (`src/innieme/conversation_engine.py`): Handles query processing and response generation using OpenAI
4. **ConversationEngine** (`src/innieme/conversation_engine.py`): Handles query processing and response generation using a PydanticAI `Agent`
5. **DocumentProcessor** (`src/innieme/document_processor.py`): Manages document scanning, vectorization, and similarity search
6. **KnowledgeManager** (`src/innieme/knowledge_manager.py`): Handles conversation summarization and knowledge base storage
6. **KnowledgeManager** (`src/innieme/knowledge_manager.py`): Handles conversation summarization (via a PydanticAI `Agent` with structured `SummaryOutput`) and knowledge base storage

### Factory Pattern Components

Expand All @@ -78,6 +78,12 @@ The bot uses YAML configuration (`config.yaml`) with the following structure:
- Each topic has its own role/system prompt, document directory, and Discord channels
- Configuration is loaded via `DiscordBotConfig` class

Key top-level config fields:
- `embedding_model`: `"openai"`, `"huggingface"`, or `"fake"`
- `embeddings_api_key`: API key for the embedding model (required when `embedding_model` is `"openai"`)
- `llm_model`: PydanticAI model string, e.g. `"openai:gpt-4o"` or `"anthropic:claude-sonnet-4-6"`
- `llm_api_key`: API key for the LLM provider

### Bot Behavior

- Bot responds when mentioned in Discord channels
Expand All @@ -99,8 +105,9 @@ The bot uses YAML configuration (`config.yaml`) with the following structure:
- Document search provides context for LLM responses

### Response Generation
- Uses OpenAI GPT-3.5-turbo model by default
- Combines document context with conversation history
- Uses PydanticAI `Agent` with a configurable LLM (default: `openai:gpt-3.5-turbo`)
- LLM provider and model are set via `llm_model` in `config.yaml` (e.g. `"openai:gpt-4o"`, `"anthropic:claude-sonnet-4-6"`)
- Combines document context with conversation history via `ConversationDependencies`
- Handles responses longer than Discord's 2000 character limit by sending as files

### Error Handling
Expand Down
28 changes: 17 additions & 11 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
# 6. Paste your token below (keep it secret!)
discord_token: discord_bot_token

# OpenAI API (for embeddings)
# To get your OpenAI API key:
# 1. Go to OpenAI's website (https://platform.openai.com)
# 2. Sign in or create an account
# 3. Click on your profile icon and select "View API keys"
# 4. Click "Create new secret key"
# 5. Copy your API key (you won't be able to see it again!)
# 6. Paste your key below (keep it secret!)
openai_api_key: openai_api_key
embedding_model: "openai" # Options: "openai", "huggingface"
# Embedding model to use for document vectorisation
# Options: "openai", "huggingface", "fake"
embedding_model: "openai"

# API key for the embedding model (only required when embedding_model is "openai")
embeddings_api_key: openai_api_key

# LLM to use for conversation and summarisation
# Format: "<provider>:<model>", e.g. "openai:gpt-4o", "anthropic:claude-sonnet-4-6"
llm_model: "openai:gpt-3.5-turbo"

# API key for the LLM provider
# For OpenAI: https://platform.openai.com/api-keys
# For Anthropic: https://console.anthropic.com/settings/keys
llm_api_key: llm_api_key

outies:
# To get your Discord admin user ID:
# 1. Go to Discord and go to User Settings (gear icon)
Expand Down Expand Up @@ -54,4 +60,4 @@ outies:
docs_dir: "./data/documents2"
channels:
- guild_id: discord_server_id
channel_id: discord_channel_id
channel_id: discord_channel_id
24 changes: 21 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,33 @@ build-backend = "setuptools.build_meta"
name = "innieme"
version = "0.1.0"
description = "Your bot description"
requires-python = ">=3.9"
requires-python = ">=3.13"
dependencies = [
# Your dependencies here
"discord.py",
"python-dotenv",
"chromadb",
"langchain>=0.1.0,<1.0.0",
"langchain-community",
"langchain-chroma",
"langchain-huggingface",
"langchain-openai",
"pypdf",
"python-docx",
"faiss-cpu",
"numpy",
"openai>=1.0.0",
"pydantic-ai>=1.0.0",
"audioop-lts==0.2.1; python_version >= '3.13'",
]

[project.optional-dependencies]
dev = [
"pytest",
# Other development dependencies
"pytest-asyncio",
"pytest-cov",
"black",
"flake8",
"isort",
]

[project.scripts]
Expand Down
Loading
Loading