Skip to main content

TOXO Python Library - Smart Layer Platform that converts ANY black-box LLM (GPT, Gemini, Claude) into Context Augmented Language Models (CALM). No LLM retraining needed - just attach .toxo layers for instant domain expertise. Revolutionary AI enhancement technology.

Project description

TOXO Python Library - Smart Layer Platform for LLM Enhancement

PyPI version Downloads Python versions License

v2.0.0 – Full Power: Loads prompt_config, memory_state, quality scoring, response depth, and query-type instructions. See RELEASE_NOTES_v2.0.0.md.

Convert ANY Black-Box LLM into Context Augmented Language Models (CALM)

TOXO Python Library is the revolutionary smart layer platform that transforms any black-box LLM (GPT, Gemini, Claude, etc.) into Context Augmented Language Models (CALM). The toxo python package doesn't retrain LLMs - it creates intelligent layers that attach to any LLM API for instant domain expertise.

🚀 Why Choose TOXO Python Library?

The TOXO Python Library revolutionizes AI enhancement through smart layer technology:

🧠 Smart Layer Training

  • Train intelligent layers, not entire LLMs
  • Works with any black-box LLM API
  • No expensive GPU infrastructure needed
  • Result: Domain expertise without LLM retraining costs

🗃️ Advanced Memory Systems

  • Persistent knowledge storage and retrieval
  • Context-aware learning and adaptation
  • Conversation history and domain expertise
  • Result: LLMs gain long-term memory capabilities

🎯 Quality Enhancement

  • Intelligent response optimization
  • Continuous improvement from feedback
  • Domain-specific output refinement
  • Result: Consistently superior performance

Why TOXO Python Library vs Traditional Approaches?

Feature Traditional Fine-Tuning TOXO Python Library
Training Cost $10,000-$100,000+ $5-$500
Training Time Days to weeks Minutes to hours
Infrastructure GPU clusters required API-based (no GPUs)
LLM Compatibility Model-specific Works with ANY LLM
Reversibility Permanent changes Instant layer removal
Multi-Domain One model per domain Unlimited layers

Quick Start with TOXO Python Library

Install the TOXO Python Package

pip install toxo

The toxo python library provides everything you need to create Context Augmented Language Models (CALM).

Basic Usage: Transform Any LLM

from toxo import ToxoLayer

# Load your trained smart layer (created on toxotune.com)
layer = ToxoLayer.load("financial_expert.toxo")

# Connect to ANY LLM with specific model selection
# Gemini (default)
layer.setup_api_key("your_gemini_key", "gemini-2.0-flash-exp", "gemini")

# OpenAI GPT
layer.setup_api_key("your_openai_key", "gpt-4", "openai")

# Claude
layer.setup_api_key("your_claude_key", "claude-3.5-sonnet", "claude")

# Your LLM is now a financial domain expert!
response = layer.query("Should I invest in tech stocks during volatility?")
print(response)
# Output: Expert financial analysis with domain knowledge

# v2.0: Control response verbosity (concise | balanced | detailed)
response = layer.query("Compare A vs B", response_depth="concise")  # Auto-detects comparison
response = layer.query("How to brew?", response_depth="balanced")   # Auto-detects procedural

Async Support for Production Applications

import asyncio
from toxo import ToxoLayer

async def main():
    layer = ToxoLayer.load("legal_expert.toxo")
    layer.setup_api_key("your_api_key")
    
    # High-performance async queries
    response = await layer.query_async("Analyze this contract for risks")
    print(response)

asyncio.run(main())

TOXO Python Library Features

🎨 No-Code Smart Layer Creation

Create domain experts through toxotune.com:

  • Upload domain-specific examples
  • Automatic smart layer optimization
  • Advanced training algorithms
  • Download trained .toxo layer file

Universal LLM Compatibility

The toxo python package works with any LLM provider:

  • Google Gemini (Recommended - optimized integration)
  • OpenAI GPT (GPT-3.5, GPT-4, GPT-4o)
  • Anthropic Claude (Claude-3, Claude-3.5)
  • Local Models (Ollama, LM Studio, etc.)
  • Custom APIs (Any OpenAI-compatible endpoint)

🔄 Continuous Learning

Smart layers improve automatically:

# Provide feedback to enhance performance
layer.add_feedback(
    question="Investment strategy question",
    response="Generated response...",
    rating=8.5,  # Quality score 0-10
    suggestions=["More risk analysis", "Include market timing"]
)

🤖 Multi-Agent Systems

Orchestrate multiple specialized layers:

# Multiple domain experts working together
research_agent = ToxoLayer.load("research_expert.toxo")
writing_agent = ToxoLayer.load("writing_expert.toxo")

# Collaborative AI workflow
research = await research_agent.query_async("Research quantum computing")
report = await writing_agent.query_async(f"Write report: {research}")

🎯 TOXO v2.0 Full Power – Quality Scoring & Query Intelligence

from toxo import ToxoLayer
from toxo.core import classify_query, analyze_response, compute_domain_confidence, should_use_layer, compute_info_density, QUALITY_WEIGHTS

# Classify query type (factual, procedural, comparison, technical, vague)
qtype = classify_query("how to dial in espresso", "coffee")  # -> "procedural"
qtype = classify_query("compare aeropress vs v60", "coffee")  # -> "comparison"

# Should you use the layer for this query? (domain confidence)
use_layer, confidence = should_use_layer("random trivia question", "finance", threshold=0.6)

# Analyze response quality with expert-weighted scoring
scores = analyze_response(response_text, query, domain="linkedin")

# Domain confidence and info density
conf = compute_domain_confidence("espresso ratio", "coffee")
density = compute_info_density(response_text, query, domain="finance")

# Layer automatically uses: response depth, query-type instructions, compression
response = layer.query("Compare A vs B", response_depth="concise")  # Auto-formats comparison

TOXO Python Library API Reference

Core Methods

ToxoLayer.load(path)

Load a trained smart layer from .toxo file.

layer = ToxoLayer.load("path/to/domain_expert.toxo")

layer.setup_api_key(api_key, model, provider)

Connect smart layer to any LLM API with model selection.

# Gemini (default)
layer.setup_api_key("your_gemini_key", "gemini-2.0-flash-exp", "gemini")

# OpenAI GPT
layer.setup_api_key("your_openai_key", "gpt-4", "openai")

# Claude
layer.setup_api_key("your_claude_key", "claude-3.5-sonnet", "claude")

layer.query(question, context=None, response_depth=None, **kwargs)

Enhanced query with smart layer processing.

response = layer.query("Domain-specific question")

# With additional context
response = layer.query(
    "Analyze this data", 
    context={"user_role": "analyst", "priority": "high"}
)

# v2.0: Response depth - concise, balanced, or detailed
response = layer.query("Quick tip?", response_depth="concise")    # 1-3 sentences
response = layer.query("Compare X vs Y", response_depth="balanced")  # Auto-escalates for comparisons
response = layer.query("Full guide please", response_depth="detailed")

layer.query_async(question, context=None)

Asynchronous query for high-performance applications.

response = await layer.query_async("Your question")

Information & Analytics

layer.get_info()

Get comprehensive layer information.

info = layer.get_info()
print(f"Domain: {info['domain']}")
print(f"Performance Score: {info['performance_score']}")

layer.get_capabilities()

Discover layer capabilities.

capabilities = layer.get_capabilities()
print(capabilities)

layer.get_performance_metrics()

Monitor smart layer performance.

metrics = layer.get_performance_metrics()
print(f"Response Quality: {metrics['avg_quality_score']}")

Creating Smart Layers

Training Process on ToxoTune Platform

  1. 🎯 Domain Selection: Choose your area of expertise
  2. 📚 Data Upload: Provide domain-specific examples
  3. 🏋️ Smart Layer Training: Advanced algorithms create your layer
  4. 📦 Download: Get your trained .toxo file
  5. 🚀 Deploy: Use with any LLM via this Python library

Example Training Data

Financial Advisory Layer:

  • "Should I diversify my portfolio?" → Expert diversification advice
  • "Impact of inflation on investments?" → Inflation-hedging strategies
  • "Best retirement planning approach?" → Comprehensive retirement guidance

Legal Expert Layer:

  • "Contract risk analysis needed" → Detailed legal risk assessment
  • "Compliance requirements review" → Regulatory compliance guidance
  • "Intellectual property questions" → IP law expert consultation

Domain Expert Examples

🏦 Financial Expert with Different Models

finance_layer = ToxoLayer.load("financial_advisor.toxo")

# Using Gemini (recommended)
finance_layer.setup_api_key("your_gemini_key", "gemini-2.0-flash-exp", "gemini")
advice = finance_layer.query("Portfolio allocation for retirement")

# Using GPT-4
finance_layer.setup_api_key("your_openai_key", "gpt-4", "openai")
advice = finance_layer.query("Portfolio allocation for retirement")

# Using Claude
finance_layer.setup_api_key("your_claude_key", "claude-3.5-sonnet", "claude")
advice = finance_layer.query("Portfolio allocation for retirement")
# Output: Expert financial planning with risk assessment

⚖️ Legal Expert with Model Selection

legal_layer = ToxoLayer.load("legal_advisor.toxo")

# Choose the best model for legal analysis
legal_layer.setup_api_key("your_api_key", "gpt-4", "openai")
analysis = legal_layer.query("Review this contract for issues")
# Output: Comprehensive legal analysis with risk identification

🔬 Research Assistant with Multiple Models

research_layer = ToxoLayer.load("research_assistant.toxo")

# Use Claude for research (excellent at analysis)
research_layer.setup_api_key("your_claude_key", "claude-3.5-sonnet", "claude")
review = research_layer.query("Latest developments in quantum computing")
# Output: Detailed research summary with current insights

💻 Code Expert with Model Flexibility

code_layer = ToxoLayer.load("python_expert.toxo")

# Use GPT-4 for code analysis (excellent at programming)
code_layer.setup_api_key("your_openai_key", "gpt-4", "openai")
review = code_layer.query("Optimize this function for performance")
# Output: Expert code analysis with optimization recommendations

Advanced Usage Patterns

Context-Aware Processing

# Rich context for enhanced responses
context = {
    "user_profile": {
        "role": "portfolio_manager",
        "experience": "senior"
    },
    "session_data": {
        "previous_topics": ["risk_assessment", "market_analysis"]
    }
}

response = layer.query("Investment recommendation", context=context)

Batch Processing

# Process multiple queries efficiently
queries = [
    "Analyze AAPL performance",
    "Tech sector risk assessment", 
    "Q4 2024 market outlook"
]

results = []
for query in queries:
    result = await layer.query_async(query)
    results.append(result)

Installation & Requirements

Standard Installation

pip install toxo

Installation with Specific LLM Providers

# For OpenAI GPT models
pip install toxo[openai]

# For Claude models
pip install toxo[claude]

# For all providers
pip install toxo[full]

Development Installation

pip install toxo[dev]

System Requirements

  • Python: 3.9+ (3.10+ recommended)
  • Memory: 4GB RAM minimum
  • Internet: Required for LLM API calls
  • API Keys: Supported LLM provider account

Supported LLM Providers

  • Google Gemini (Recommended - included by default)
    • gemini-2.0-flash-exp, gemini-1.5-pro, gemini-1.5-flash
  • OpenAI GPT (Install with pip install toxo[openai])
    • gpt-4, gpt-4o, gpt-3.5-turbo
  • Anthropic Claude (Install with pip install toxo[claude])
    • claude-3.5-sonnet, claude-3-opus, claude-3-haiku
  • 🔄 Local Models (Coming soon)

Performance Benefits

Cost Comparison

  • Traditional Fine-tuning: $10,000-$100,000+ per domain
  • TOXO Smart Layers: $5-$500 per domain
  • Savings: Up to 1000x cost reduction

Time Comparison

  • Traditional Fine-tuning: Days to weeks
  • TOXO Smart Layers: Minutes to hours
  • Speed: Up to 500x faster deployment

Quality Results

  • Performance: 95-98% of fine-tuned model quality
  • Consistency: Superior response reliability
  • Adaptability: Continuous improvement from feedback

Community & Support

📚 Resources

💬 Community

🏢 Enterprise

  • Enterprise Support: enterprise@toxotune.com
  • Custom Solutions: Large-scale deployments
  • Priority Support: 24/7 technical assistance

Frequently Asked Questions

What is the TOXO Python Library?

The TOXO Python Library is a smart layer platform that enhances any black-box LLM with domain expertise, memory, and continuous learning capabilities without expensive retraining.

How does TOXO differ from fine-tuning?

TOXO creates intelligent layers that attach to existing LLMs, achieving 95-98% of fine-tuned performance with 1000x cost reduction and universal LLM compatibility.

Can I use TOXO with any LLM?

Yes! The toxo python package works with any LLM API including GPT, Gemini, Claude, and local models. Smart layers are completely LLM-agnostic.

What's inside a .toxo file?

.toxo files contain trained smart layer components, memory systems, and configuration - everything needed to transform any LLM into a domain expert.

Is TOXO production-ready?

Absolutely! The TOXO Python Library includes enterprise features like monitoring, scaling, security, and professional support options.

How much training data do I need?

TOXO's smart layer training is extremely efficient - most domains need only 10-100 examples compared to thousands required for traditional approaches.

Getting Started Checklist

  • Install: pip install toxo
  • Sign Up: Create account at toxotune.com
  • Choose Domain: Select your expertise area
  • Upload Examples: Provide domain-specific data
  • Train Layer: Create your smart layer
  • Download: Get your .toxo file
  • Test: Load and test with this Python library
  • Deploy: Integrate into your application
  • Optimize: Provide feedback for improvement

License

The TOXO Python Library is proprietary software. See LICENSE file for details.


TOXO Python Library - Revolutionizing AI with Smart Layers 🧠⚡

Transform any LLM into a domain expert with the power of smart layer technology

Ready to experience revolutionary LLM enhancement? Start with pip install toxo and join the smart layer revolution!


Keywords: toxo python library, smart layer training, context augmented language models, calm, black-box llm enhancement, llm conversion, domain expert ai, toxo layer, python library, ai augmentation, llm enhancement, no llm retraining, toxo python package, ai layer training, toxo ai, toxo library

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

toxo-2.0.1.tar.gz (337.2 kB view details)

Uploaded Source

Built Distribution

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

toxo-2.0.1-py3-none-any.whl (362.3 kB view details)

Uploaded Python 3

File details

Details for the file toxo-2.0.1.tar.gz.

File metadata

  • Download URL: toxo-2.0.1.tar.gz
  • Upload date:
  • Size: 337.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toxo-2.0.1.tar.gz
Algorithm Hash digest
SHA256 aea86a606e1a67af71455745366a095cd0562c6cd4ab9109aa0c8ef9f4b790fa
MD5 6e09ab1792530a0ea72585aff83f5c89
BLAKE2b-256 e78aec9ecd6a2732e4246302cb7aa170b3fa9b8f82ccbe9dc26b3f089e16f91a

See more details on using hashes here.

Provenance

The following attestation bundles were made for toxo-2.0.1.tar.gz:

Publisher: publish-to-pypi.yml on spiderdev27/toxo_public_python_package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file toxo-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: toxo-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 362.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toxo-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79ece09e966d4b82c5ad8f464726113225590ecff501ab01ca7576989ce2af88
MD5 a51a18cef5e86faf974cc53780657afc
BLAKE2b-256 2bb8846f4187db93a6b610fd10e737e6cc05b4f2a2aaa1fa993af3823f900467

See more details on using hashes here.

Provenance

The following attestation bundles were made for toxo-2.0.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on spiderdev27/toxo_public_python_package

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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