Unified interface for multiple LLM providers with advanced features (routing, privacy, logging).
Project description
llama-integration
Llama Integration (llama-integration) is a toolkit providing components for integrating LlamaSearch AI functionalities with external systems and managing common infrastructure tasks. It includes modules for API gateway implementation, routing, external provider interaction (e.g., OpenAI), API key management, data masking (HIPAA), and model routing/conversion (MLX, CoreML).
Key Features
- API Gateway: Components for building or interacting with API gateways (
gateway-implementation.py). - Routing: Logic for routing requests, potentially based on model type or destination (
routing/,mlx-router.py). - External Provider Integration: Base classes and specific implementations for interacting with external AI providers like OpenAI (
base-provider.py,openai-provider.py). - API Key Management: Tools for managing API keys securely (
api-key-manager.py). - Data Masking: Utilities for masking sensitive data, specifically mentioning HIPAA compliance (
hipaa-masking.py). - Model Conversion/Integration: Support for CoreML conversion and Trusted Execution Environments (TEE) (
coreml-conversion.py,tee-integration.py). - Core Module: Orchestrates integration tasks (
core.py). - Configuration: Settings for endpoints, keys, routing rules, etc. (
config.py). - Utilities: Includes logging and other helper functions (
logging/,utils/).
Installation
pip install llama-integration
# Or install directly from GitHub for the latest version:
# pip install git+https://github.com/llamasearchai/llama-integration.git
Usage
(Usage examples demonstrating gateway configuration, provider interaction, data masking, etc., will be added here.)
# Placeholder for Python client usage
# from llama_integration import ApiGateway, DataMasker, OpenAIProvider
# # Example: Using the OpenAI Provider
# provider = OpenAIProvider(api_key="sk-...")
# response = provider.generate_completion(prompt="Translate to French: Hello World")
# print(response)
# # Example: Masking data
# masker = DataMasker(mode="hipaa")
# text = "Patient John Doe, DOB 01/01/1980, has diabetes."
# masked_text = masker.mask(text)
# print(masked_text) # Output: Patient [NAME], DOB [DATE], has diabetes.
Architecture Overview
graph TD
A[External Client / LlamaSearch Service] --> B{API Gateway / Router (gateway, routing, mlx-router)};
B -- Routes to --> C{External Provider (e.g., OpenAI)};
B -- Routes to --> D{Internal LlamaSearch Service};
B -- Routes to --> E{TEE Integration (tee-integration)};
subgraph Integration Components
F[API Key Manager]
G[Data Masker (HIPAA)]
H[CoreML Converter]
I[Logging]
J[Utilities]
end
B -- Uses --> F;
B -- Uses --> G; # Masking might happen at gateway
B -- Uses --> H; # Conversion might be needed for routing
B -- Uses --> I;
B -- Uses --> J;
K{Core Integration Module (core.py)} -- Manages --> B;
K -- Manages --> F; K -- Manages --> G; K -- Manages --> H;
L[Configuration (config.py)] -- Configures --> K;
L -- Configures --> B;
L -- Configures --> C;
L -- Configures --> F;
L -- Configures --> G;
style B fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#ccf,stroke:#333,stroke-width:1px
style D fill:#ccf,stroke:#333,stroke-width:1px
style E fill:#ccf,stroke:#333,stroke-width:1px
- Entry Point: Requests come from external clients or other LlamaSearch services.
- Gateway/Router: The central component handles incoming requests, potentially applying routing rules, authentication (using API Key Manager), data masking, model conversion, or TEE interactions.
- Backend Targets: Requests are routed to appropriate internal LlamaSearch services or external providers (like OpenAI).
- Supporting Modules: Key management, masking, conversion, logging, and utilities support the gateway/router functionality.
- Core/Config: The core module manages these components based on the provided configuration.
Configuration
(Details on configuring API endpoints, routing rules, provider API keys, masking rules, TEE settings, logging levels, etc., will be added here.)
Development
Setup
# Clone the repository
git clone https://github.com/llamasearchai/llama-integration.git
cd llama-integration
# Install in editable mode with development dependencies
pip install -e ".[dev]"
Testing
pytest tests/
Contributing
Contributions are welcome! Please refer to CONTRIBUTING.md and submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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 llama_integration-0.1.0.tar.gz.
File metadata
- Download URL: llama_integration-0.1.0.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8a9dbac1b2e4a7324109c12b5fcc33aa8fa989320c7517a38313302368b62e
|
|
| MD5 |
46c7ec2687edb8ade8a05538db9ea401
|
|
| BLAKE2b-256 |
43df30e8c373903b514c2d4df8916d8983477e39b71caf75fb4422699ce40b99
|
File details
Details for the file llama_integration-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_integration-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f708eded70f936a253efb59fd2727446d71089bd06795cf30e785de35abe477
|
|
| MD5 |
554ef109b09b201ac569f6323d04889a
|
|
| BLAKE2b-256 |
c5506ec3a808c2b54830ac1ad8cbbacb6627737100a33632674b973756fb0d5f
|