Comprehensive testing framework and dashboard for LangChain integration compatibility
Project description
LangChain Integration Health Dashboard & Testing Framework
A comprehensive testing framework and dashboard for monitoring LangChain integration compatibility, addressing critical pain points in the LangChain ecosystem.
Problem Statement
LangChain has major integration compatibility issues:
- Missing
.bind_tools()methods in integrations like MLXPipeline - Inconsistent API support across different model providers
- Poor integration testing leading to breaking changes
- No visibility into which integrations support which features
- Developers waste time discovering integration limitations at runtime
Solution
This framework provides:
- Integration Compatibility Testing Framework - Automated testing suite that validates LangChain integrations
- Real-time Integration Health Dashboard - Web-based dashboard showing integration compatibility status
- Integration Template Generator - Standardized templates for new integrations
Quick Start
Installation
From PyPI (Recommended)
pip install langchain-integration-health
From Source
git clone https://github.com/sadiqkhzn/langchain-integration-health.git
cd langchain-integration-health
pip install -e .
Run the Dashboard
langchain-health dashboard
Or run Streamlit directly:
streamlit run -m langchain_integration_health.dashboard.app
CLI Usage
# Discover available integrations
langchain-health discover
# Run integration tests
langchain-health test
# Launch the dashboard
langchain-health dashboard
# Generate compatibility report
langchain-health report
# Clean old test results
langchain-health clean
Programmatic Usage
import asyncio
from langchain_integration_health.testers import LLMIntegrationTester
from langchain_integration_health.utils.config import Config
# Test a specific integration
async def test_integration():
config = Config.from_env()
# Example: Test OpenAI integration
from langchain_openai import ChatOpenAI
tester = LLMIntegrationTester(ChatOpenAI, config.get_integration_config("ChatOpenAI"))
result = await tester.run_all_tests()
print(f"Compatibility Score: {result.compatibility_score}")
print(f"bind_tools Support: {result.bind_tools_support}")
print(f"Streaming Support: {result.streaming_support}")
asyncio.run(test_integration())
Features
Comprehensive Testing
- Tests for required methods:
bind_tools(),stream(),with_structured_output(), etc. - Compatibility matrix generation
- Performance benchmarking
- Error handling validation
Real-time Dashboard
- Visual compatibility matrix with color-coded status indicators
- Detailed test results and error reporting
- Performance metrics and benchmarking data
- Historical trend analysis
- Export capabilities (JSON, CSV, Markdown)
Automatic Discovery
- Scans installed packages for LangChain integrations
- Supports main langchain, langchain-community, and third-party packages
- Parallel testing for faster results
Integration Fixes
- Example implementations for common issues (e.g., MLXPipeline bind_tools fix)
- Wrapper patterns for adding missing functionality
- Best practices for LangChain compatibility
Architecture
langchain-integration-health/
├── src/
│ ├── testers/ # Testing framework
│ │ ├── base_tester.py
│ │ ├── llm_tester.py
│ │ ├── chat_model_tester.py
│ │ └── embeddings_tester.py
│ ├── dashboard/ # Streamlit dashboard
│ │ ├── app.py
│ │ ├── components.py
│ │ └── data_loader.py
│ ├── utils/ # Utilities
│ │ ├── config.py
│ │ ├── reporters.py
│ │ └── discovery.py
│ └── examples/ # Example implementations
│ └── mlx_pipeline_fix.py
├── .github/workflows/ # CI/CD integration
└── tests/ # Test suite
Testing Framework
Base Classes
BaseIntegrationTester: Abstract base for all integration testersLLMIntegrationTester: Specialized for LLM integrationsChatModelTester: Specialized for chat modelsEmbeddingsTester: Specialized for embedding models
Test Types
- Method Existence Tests: Verify required methods are present
- Functionality Tests: Test actual method execution
- Error Handling Tests: Validate proper error handling
- Performance Tests: Measure latency and throughput
- Compatibility Tests: Check version compatibility
Dashboard Features
Compatibility Matrix
Color-coded grid showing which integrations support which features:
- Green: High compatibility (>=0.8)
- Yellow: Medium compatibility (0.5-0.8)
- Red: Low compatibility (<0.5)
Integration Details
Expandable sections showing:
- Full test results
- Error and warning details
- Performance metrics
- Historical data
Export Options
- JSON: Structured data for programmatic use
- CSV: Spreadsheet-compatible format
- Markdown: Human-readable reports
Configuration
Environment Variables
# Database
LIH_DATABASE_URL=sqlite:///integration_health.db
# Testing
LIH_TEST_TIMEOUT=30
LIH_PARALLEL_TESTS=true
LIH_MOCK_MODE=false
# Dashboard
LIH_DASHBOARD_HOST=localhost
LIH_DASHBOARD_PORT=8501
# API Keys (optional, for real testing)
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
GOOGLE_API_KEY=your_key_here
Configuration File
{
"database_url": "sqlite:///integration_health.db",
"test_timeout": 30,
"parallel_tests": true,
"mock_mode": false,
"api_keys": {
"openai": "your_key_here",
"anthropic": "your_key_here"
}
}
CI/CD Integration
The framework includes GitHub Actions workflow for automated testing:
# .github/workflows/integration-tests.yml
# Runs daily and on PRs to test all integrations
Features:
- Automatic integration discovery
- Parallel testing across integrations
- Report generation and artifact upload
- PR comment integration
MLXPipeline Fix Example
The framework includes a complete example of how to fix the MLXPipeline bind_tools issue:
from langchain_integration_health.examples.mlx_pipeline_fix import create_mlx_wrapper
# Original MLXPipeline (missing bind_tools)
mlx = MLXPipeline(model_name="mlx-community/Llama-3.2-1B-Instruct-4bit")
# Wrap for LangChain compatibility
langchain_mlx = create_mlx_wrapper(mlx)
# Now you can use bind_tools!
from langchain.tools import tool
@tool
def calculator(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
mlx_with_tools = langchain_mlx.bind_tools([calculator])
response = mlx_with_tools.invoke("What is 5 + 3?")
API Reference
Testing Classes
BaseIntegrationTester
Base class for all integration testers.
class BaseIntegrationTester:
def __init__(self, integration_class: Type, config: Optional[Dict] = None)
async def run_all_tests(self) -> IntegrationTestResult
def _test_required_methods(self) -> Dict[str, bool]
LLMIntegrationTester
Specialized tester for LLM integrations.
class LLMIntegrationTester(BaseIntegrationTester):
REQUIRED_METHODS = ['invoke', 'ainvoke', 'stream', 'astream', 'bind_tools', 'with_structured_output']
async def _test_bind_tools_support(self) -> bool
async def _test_streaming_support(self) -> bool
Data Models
IntegrationTestResult
Stores test results for an integration.
@dataclass
class IntegrationTestResult:
integration_name: str
integration_version: str
test_timestamp: datetime
bind_tools_support: bool
streaming_support: bool
structured_output_support: bool
async_support: bool
errors: List[str]
warnings: List[str]
performance_metrics: Dict[str, float]
compatibility_score: float
Contributing
- Fork the repository
- Create a feature branch
- Add tests for your changes
- Ensure all tests pass
- Submit a pull request
Development Setup
git clone https://github.com/sadiqkhzn/langchain-integration-health.git
cd langchain-integration-health
pip install -e ".[dev]"
pytest tests/
License
MIT License - see LICENSE file for details.
Support
For issues and feature requests, please use the GitHub issue tracker.
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 langchain_integration_health-0.1.5.tar.gz.
File metadata
- Download URL: langchain_integration_health-0.1.5.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3798397b4274e9879c2d8e8071fba4cf34c7099ee088bebfe0c5b43a435b0b09
|
|
| MD5 |
1b947c6ec9b6d6428a32bd8f4df6e095
|
|
| BLAKE2b-256 |
a5bb20e96bee518b7f4ea2d7d324c2b570a6a0ce94481453cb194cc5bfaa63b1
|
File details
Details for the file langchain_integration_health-0.1.5-py3-none-any.whl.
File metadata
- Download URL: langchain_integration_health-0.1.5-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca2fe10efb1f26c1c9636931e19da60edda19fc0d221206252af51b9d2e81f54
|
|
| MD5 |
fa6ea30b47a0e843231c083438d78e6c
|
|
| BLAKE2b-256 |
73546e4e2da925dc7cdd2486c7523c7a973f7208ab1b881ca2db1fe9ffc8800f
|