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
-
Get API Keys:
- Google AI API Key for Gemini
- Pinecone API Key for vector database
-
Set Environment Variables:
export GOOGLE_API_KEY="your-google-api-key" export PINECONE_API_KEY="your-pinecone-api-key"
-
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 modesL: Toggle node labelsE: Toggle edge displayU: Toggle usage statisticsMouse: Drag nodes, click to selectESC: 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
- Chunker: LLM-based semantic transcript segmentation
- Vector Store: Pinecone-powered chunk storage and retrieval
- Usage Cache: CSV-based usage tracking and analytics
- Prompt-Answer Store: Vector storage for Q&A pairs
- 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),overfetchmultiplier - 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 commandsstats- Display system statisticsclear- Clear all datachunks <k>- Show top k chunks for a questionquit/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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Google Gemini for powerful language models
- Pinecone for vector database infrastructure
- LangChain for LLM integration framework
- Sentence Transformers for text embeddings
๐ Support
- ๐ง Email: your.email@example.com
- ๐ Issues: GitHub Issues
- ๐ Documentation: GitHub Wiki
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d5b8435d9205b52b275e50a5e44f05af1ebcb8f7256515c3d8fe2e3030a49b9
|
|
| MD5 |
0828559b8824b96e6107edbf113f532f
|
|
| BLAKE2b-256 |
4e52e7f2aebdf8121f01ac46b1bfde379fdff9eb4cf7b801b2d31fc6f01d53a9
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42023f8ff83c5eb0bb43c76db4453624489261c4318511961f3dd9cd948ba91b
|
|
| MD5 |
7c56aa18c4be5d1cb583835827d9d263
|
|
| BLAKE2b-256 |
4d09c51aadc7cde4921043a4665d97af291ae0cf6785949d651911d39e8d4cc5
|