Lightweight framework for AI-powered document analysis and search workflows with multi-provider support
Project description
AI Search Match Framework (ASMF)
Lightweight Python framework for building AI-powered document analysis applications.
Clean abstractions for AI providers, document parsing, and custom analyzers. Build domain-specific tools like patent analyzers, grant finders, or contract reviewers.
Quick Start
pip install ai-search-match-framework
from asmf.providers import AIProviderFactory
from asmf.parsers import PDFPatentParser
from asmf.analyzers import BaseAnalyzer
# AI Provider with automatic fallback (Gemini → Ollama)
provider = AIProviderFactory.create_provider()
response = provider.analyze_text("Analyze this document...")
# Parse documents
parser = PDFPatentParser()
doc = parser.parse("document.pdf")
# Create custom analyzer
class MyAnalyzer(BaseAnalyzer):
def analyze(self, data):
return self.provider.analyze_text(f"Evaluate: {data}")
analyzer = MyAnalyzer(provider)
results = analyzer.batch_analyze([doc1, doc2])
Features
- 🤖 Multi-provider AI - Unified interface for Gemini, Ollama with automatic fallback
- 📄 Document parsing - Extract structured data from PDFs and other formats
- 🔧 Extensible analyzers - Base classes for custom domain logic
- 🔍 PR Review Webhook - Automated code review using Ollama with anti-pattern detection
- 🎯 Type-safe - Full type hints for excellent IDE support
- ✅ Well-tested - 78%+ coverage, production-ready
- 🐳 Docker support - Containerized testing and deployment
Core Components
| Component | Purpose |
|---|---|
providers |
AI provider interface (Gemini, Ollama) with failover |
parsers |
Document parsing (PDF, etc.) with structured output |
analyzers |
Base classes for domain-specific analysis logic |
llm |
Task-specific model selection with VRAM detection |
utils |
Configuration, logging, common utilities |
Configuration
Quick Start with Ollama (Local, Free)
# 1. Install Ollama: https://ollama.ai/download
# 2. Pull a model
ollama pull qwen2.5:14b-q4
# 3. Configure ASMF
echo "OLLAMA_BASE_URL=http://localhost:11434" >> .env
echo "PREFER_LOCAL=true" >> .env
Or use the automated setup:
python scripts/setup_ollama.py
Cloud Provider Setup
Set environment variables:
GEMINI_API_KEY=your_key_here # For Gemini
PREFER_LOCAL=false # Cloud-first (default)
Advanced Configuration
# Local-first with fallback
from asmf.providers import AIProviderFactory
provider = AIProviderFactory.create_provider(prefer_local=True)
# Direct provider usage
from asmf.providers import GeminiProvider, OllamaProvider
gemini = GeminiProvider(api_key="...", model="gemini-1.5-pro")
ollama = OllamaProvider(model="qwen2.5:14b-q4", base_url="http://localhost:11434")
# Task-specific model selection (NEW!)
from asmf.llm import ModelSelector, TaskType
selector = ModelSelector() # Auto-detects GPU
model = selector.select_model(TaskType.CODE_REVIEW) # Best model for code review
ollama = OllamaProvider(model=model)
See docs/OLLAMA_SETUP.md for comprehensive Ollama setup guide and task-specific model recommendations.
Use Cases
Not a general LLM framework - Use LangChain/LlamaIndex for RAG/chatbots.
ASMF is for linear document analysis workflows:
- ✅ Patent analysis and prior art search
- ✅ Grant/RFP matching and evaluation
- ✅ Contract review and risk assessment
- ✅ Resume screening and candidate matching
- ✅ Research paper analysis and summarization
Examples
See examples/job_finder/ for a complete application.
Documentation
- Full Documentation - Complete guide
- API Reference - Detailed docs
- Configuration - Setup guide
- Usage Patterns - Best practices
- Ollama Setup - Local LLM setup
- Webhook Server - Automated PR review with Ollama
Requirements
- Python 3.10+
- Dependencies:
requests,beautifulsoup4,google-generativeai,httpx,pypdf,pdfplumber
License
MIT License - See LICENSE
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
AI Contributions: We track AI-generated commits with [AI] prefix for accessibility advocacy and productivity metrics. See commit conventions for details.
Why ASMF vs others?
| Framework | Focus | Best For |
|---|---|---|
| ASMF | Linear document analysis | Domain-specific evaluation tools |
| LangChain | RAG, agents, chains | Chatbots, conversational AI |
| LlamaIndex | Data indexing, retrieval | Knowledge base search |
Built with ❤️ using AI assistance (GitHub Copilot, Gemini, Ollama)
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 ai_search_match_framework-0.5.0.tar.gz.
File metadata
- Download URL: ai_search_match_framework-0.5.0.tar.gz
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b19861a50530160edf82350876f73b69c309659042936a40b33b30a3a7f02de
|
|
| MD5 |
b19da454a348be25d5063852727b65e8
|
|
| BLAKE2b-256 |
aced600dbec8ee388245c80d4fe2a8f884db1489f5a31e04a4f37517a9ea346e
|
Provenance
The following attestation bundles were made for ai_search_match_framework-0.5.0.tar.gz:
Publisher:
publish.yml on vcaboara/ai-search-match-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_search_match_framework-0.5.0.tar.gz -
Subject digest:
5b19861a50530160edf82350876f73b69c309659042936a40b33b30a3a7f02de - Sigstore transparency entry: 771697354
- Sigstore integration time:
-
Permalink:
vcaboara/ai-search-match-framework@dd6649ab4f9d15cd41d92e16d60c1cb60f59fd39 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcaboara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd6649ab4f9d15cd41d92e16d60c1cb60f59fd39 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ai_search_match_framework-0.5.0-py3-none-any.whl.
File metadata
- Download URL: ai_search_match_framework-0.5.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c824911fd1db8363eff5b2390ab9e51f01809a59885ad180ee421b490cf25b4
|
|
| MD5 |
5441e90228e83dde5603b27f73561fb3
|
|
| BLAKE2b-256 |
e2cebcdf81ab26df2d501cc11a1f108c405ced23c5a48e85c0126f942889e117
|
Provenance
The following attestation bundles were made for ai_search_match_framework-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on vcaboara/ai-search-match-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_search_match_framework-0.5.0-py3-none-any.whl -
Subject digest:
6c824911fd1db8363eff5b2390ab9e51f01809a59885ad180ee421b490cf25b4 - Sigstore transparency entry: 771697356
- Sigstore integration time:
-
Permalink:
vcaboara/ai-search-match-framework@dd6649ab4f9d15cd41d92e16d60c1cb60f59fd39 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcaboara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd6649ab4f9d15cd41d92e16d60c1cb60f59fd39 -
Trigger Event:
workflow_dispatch
-
Statement type: