Skip to main content

LiteLLM Router integration for Kamiwaza AI

Project description

LiteLLM Router Integration for Kamiwaza AI

This package provides a custom router for LiteLLM that integrates with Kamiwaza AI model deployments. The KamiwazaRouter extends LiteLLM's Router class to enable efficient routing of requests to Kamiwaza-deployed models.

Features

  • Dynamic Model Discovery: Automatically discovers available models from Kamiwaza deployments
  • Caching: Efficient caching of model lists with configurable TTL
  • Model Pattern Filtering: Filter models based on name patterns (e.g., only use "72b" models)
  • Static Model Configuration: Support for static model configurations alongside Kamiwaza models
  • Fallback Routing: Automatic fallback between models in case of failures

Installation

pip install litellm-kamiwaza

Requirements

  • Python 3.7+
  • litellm>=1.0.0
  • kamiwaza-client>=0.1.0

Usage

Basic Usage

from litellm_kamiwaza import KamiwazaRouter

# Initialize router with automatic Kamiwaza discovery
router = KamiwazaRouter()

# Use the router like a standard litellm Router
response = router.completion(
    model="deployed-model-name",
    messages=[{"role": "user", "content": "Hello, world!"}]
)

Configuration Options

Environment Variables

  • KAMIWAZA_API_URL: URL for the Kamiwaza API
  • KAMIWAZA_URL_LIST: Comma-separated list of Kamiwaza URLs
  • KAMIWAZA_VERIFY_SSL: Set to "true" to enable SSL verification (default: "false")

Router Configuration

# Initialize with specific Kamiwaza URL
router = KamiwazaRouter(
    kamiwaza_api_url="http://my-kamiwaza-server.com",
    cache_ttl_seconds=600,  # Cache model list for 10 minutes
    model_pattern="72b",    # Only use models with "72b" in their name
)

# Initialize with static model list alongside Kamiwaza models
router = KamiwazaRouter(
    model_list=[
        {
            "model_name": "my-static-model",
            "litellm_params": {
                "model": "openai/gpt-4",
                "api_key": "sk-your-api-key"
            }
        }
    ]
)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

litellm_kamiwaza-0.1.2.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

litellm_kamiwaza-0.1.2-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file litellm_kamiwaza-0.1.2.tar.gz.

File metadata

  • Download URL: litellm_kamiwaza-0.1.2.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for litellm_kamiwaza-0.1.2.tar.gz
Algorithm Hash digest
SHA256 435d98fcb4c62ca518c412b721eeb7cece3da2e3dea35dbfbfdb9773fab71fa2
MD5 3c9b6eca641f31ac46b94701cd73e748
BLAKE2b-256 158d3a9a6d27ddf7110cd9309c3ac605085c6856e19cdef3dbcf6482f9594ff5

See more details on using hashes here.

File details

Details for the file litellm_kamiwaza-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for litellm_kamiwaza-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6ecc1fffbb4dddcb642be2f563bc6e625e46502ac27701f7f22e8f89a8b34aa
MD5 f5385e46c00fea15f9b6572c859bcb24
BLAKE2b-256 e975c0f67927397e43f21f657ba50d810adec7e5c504a6a5a4ab3655ddb9da0f

See more details on using hashes here.

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