Skip to main content

Intelligent Transcript Processing and Question Answering Library

Project description

EchoGem ๐ŸŽฏ

Intelligent Transcript Processing and Question Answering Library

EchoGem is a powerful Python library that transforms transcripts into intelligent, searchable knowledge bases. Using advanced AI techniques, it chunks transcripts semantically, stores them in vector databases, and provides accurate answers to questions through retrieval-augmented generation.

โœจ Features

  • ๐Ÿง  Intelligent Chunking: Uses LLM-based semantic analysis to create meaningful transcript segments
  • ๐Ÿ” Vector Search: Pinecone-powered similarity search with intelligent scoring (similarity + entropy + recency)
  • ๐Ÿค– AI-Powered Q&A: Gemini-powered question answering grounded in retrieved chunks
  • ๐Ÿ“Š Usage Analytics: Tracks chunk usage patterns for continuous improvement
  • ๐Ÿ’พ Persistent Storage: Stores both chunks and Q&A pairs for future reference
  • ๐Ÿ› ๏ธ Easy CLI: Simple command-line interface for quick transcript processing and questioning
  • โš™๏ธ Configurable: Customizable scoring weights, chunk sizes, and model parameters

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install echogem

# Or install from source
git clone https://github.com/yourusername/echogem.git
cd echogem
pip install -e .

# For graph visualization (optional)
pip install pygame

Setup

  1. Get API Keys:

  2. Set Environment Variables:

    export GOOGLE_API_KEY="your-google-api-key"
    export PINECONE_API_KEY="your-pinecone-api-key"
    
  3. Install Optional Dependencies:

    # For better NLP analysis
    python -m spacy download en_core_web_sm
    

Basic Usage

Process a Transcript

# Process a transcript file
py -m echogem.cli process transcript.txt

# Process and show chunk details
py -m echogem.cli process transcript.txt --show-chunks

Ask Questions

# Ask a single question
py -m echogem.cli ask "What is the main topic discussed?"

# Ask with detailed chunk information
py -m echogem.cli ask "What is the main topic discussed?" --show-chunks --show-metadata

Interactive Mode

# Start interactive questioning session
py -m echogem.cli interactive

#### Graph Visualization

```bash
# Launch interactive graph visualization
py -m echogem.cli graph

# Customize display
py -m echogem.cli graph --width 1600 --height 1000

# Export graph data to JSON
py -m echogem.cli graph --export graph_data.json

Features:

  • Interactive Nodes: Click and drag nodes to explore
  • Multiple Layouts: Force-directed, circular, and hierarchical layouts
  • Relationship Visualization: Edges show similarity and relevance between chunks
  • Usage Analytics: Color-coded nodes based on usage frequency
  • Real-time Updates: Dynamic layout adjustments
  • Export Capability: Save graph data for external analysis

Controls:

  • Space: Cycle through layout modes
  • L: Toggle node labels
  • E: Toggle edge display
  • U: Toggle usage statistics
  • Mouse: Drag nodes, click to select
  • ESC: Exit visualization

## ๐Ÿ“š Python API

### Basic Workflow

```python
from echogem import Processor

# Initialize processor
processor = Processor()

# Process transcript
processor.chunk_and_process("transcript.txt", output_chunks=True)

# Ask questions
result = processor.answer_question(
    "What is the main topic discussed?",
    show_chunks=True
)

print(f"Answer: {result.answer}")
print(f"Confidence: {result.confidence}")
print(f"Chunks used: {len(result.chunks_used)}")

Advanced Usage

from echogem import Processor, ChunkingOptions, QueryOptions

# Custom configuration
processor = Processor(
    chunk_index_name="my-chunks",
    pa_index_name="my-qa-pairs"
)

# Process with custom options
processor.chunk_and_process("transcript.txt")

# Query with custom parameters
chunks = processor.pick_chunks(
    "What are the key points?",
    k=10,
    entropy_weight=0.3,
    recency_weight=0.2
)

# Get similar Q&A pairs
similar_qa = processor.get_similar_qa_pairs(
    "What is the main topic?",
    k=5,
    sim_weight=0.7,
    entropy_weight=0.2,
    recency_weight=0.1
)

๐Ÿ—๏ธ Architecture

Core Components

  1. Chunker: LLM-based semantic transcript segmentation
  2. Vector Store: Pinecone-powered chunk storage and retrieval
  3. Usage Cache: CSV-based usage tracking and analytics
  4. Prompt-Answer Store: Vector storage for Q&A pairs
  5. Processor: Main orchestrator class

Data Flow

Transcript โ†’ Chunker โ†’ Chunks โ†’ Vector Store
                                    โ†“
User Question โ†’ Vector Search โ†’ Relevant Chunks โ†’ LLM โ†’ Answer
                                    โ†“
                              Usage Cache โ† Prompt-Answer Store

โš™๏ธ Configuration

Environment Variables

Variable Description Required
GOOGLE_API_KEY Google AI API key for Gemini Yes
PINECONE_API_KEY Pinecone API key for vector DB Yes

Customization Options

  • Chunking: Adjust max_tokens, similarity_threshold, coherence_threshold
  • Scoring: Customize entropy_weight, recency_weight, similarity_weight
  • Retrieval: Set k (number of chunks), overfetch multiplier
  • Index Names: Customize Pinecone index names for different projects

๐Ÿ“Š CLI Commands

Command Description Options
process <file> Process transcript file --show-chunks
ask <question> Ask a single question --show-chunks, --show-metadata
interactive Start interactive mode None
stats Show system statistics None
clear Clear all stored data None

Interactive Mode Commands

  • help - Show available commands
  • stats - Display system statistics
  • clear - Clear all data
  • chunks <k> - Show top k chunks for a question
  • quit / exit - Exit interactive mode

๐Ÿ”ง Development

Installation for Development

git clone https://github.com/yourusername/echogem.git
cd echogem
pip install -e .[dev]

Running Tests

pytest
pytest --cov=echogem

Code Quality

# Format code
black echogem/
isort echogem/

# Lint code
flake8 echogem/
mypy echogem/

๐Ÿ“ Project Structure

echogem/
โ”œโ”€โ”€ echogem/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package exports
โ”‚   โ”œโ”€โ”€ models.py            # Data models
โ”‚   โ”œโ”€โ”€ chunker.py           # Transcript chunking
โ”‚   โ”œโ”€โ”€ vector_store.py      # Vector database operations
โ”‚   โ”œโ”€โ”€ usage_cache.py       # Usage tracking
โ”‚   โ”œโ”€โ”€ prompt_answer_store.py # Q&A storage
โ”‚   โ”œโ”€โ”€ processor.py         # Main orchestrator
โ”‚   โ””โ”€โ”€ cli.py              # Command-line interface
โ”œโ”€โ”€ setup.py                 # Package configuration
โ”œโ”€โ”€ requirements.txt         # Dependencies
โ”œโ”€โ”€ README.md               # This file
โ””โ”€โ”€ examples/               # Usage examples

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support


Made with โค๏ธ for the AI community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echogem-0.1.2.tar.gz (79.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echogem-0.1.2-py3-none-any.whl (81.8 kB view details)

Uploaded Python 3

File details

Details for the file echogem-0.1.2.tar.gz.

File metadata

  • Download URL: echogem-0.1.2.tar.gz
  • Upload date:
  • Size: 79.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for echogem-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3d5b8435d9205b52b275e50a5e44f05af1ebcb8f7256515c3d8fe2e3030a49b9
MD5 0828559b8824b96e6107edbf113f532f
BLAKE2b-256 4e52e7f2aebdf8121f01ac46b1bfde379fdff9eb4cf7b801b2d31fc6f01d53a9

See more details on using hashes here.

File details

Details for the file echogem-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: echogem-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 81.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for echogem-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42023f8ff83c5eb0bb43c76db4453624489261c4318511961f3dd9cd948ba91b
MD5 7c56aa18c4be5d1cb583835827d9d263
BLAKE2b-256 4d09c51aadc7cde4921043a4665d97af291ae0cf6785949d651911d39e8d4cc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page