Skip to main content

Framework adapters for routing LLM requests through Majordomo Gateway

Project description

majordomo-frameworks

Framework adapters for routing LLM requests through Majordomo Gateway with centralized logging and cost tracking.

Installation

# Core package (no framework dependencies)
pip install majordomo-frameworks

# With Agno support
pip install majordomo-frameworks[agno]

# With Pydantic AI support
pip install majordomo-frameworks[pydantic-ai]

Quick Start

Shared utilities (zero dependencies)

from majordomo_frameworks import build_headers, check_environment, Provider

# Check required env vars are set
missing = check_environment("openai")

# Build gateway headers
headers = build_headers(feature="my-feature", step="inference", user_id="alice")

Agno

from majordomo_frameworks.agno import create_model

model = create_model("openai", feature="support-agent", user_id="alice")

Pydantic AI

from majordomo_frameworks.pydantic_ai import create_model, build_extra_headers
from pydantic_ai.settings import AnthropicModelSettings

# Create model routed through the gateway
model = create_model("anthropic")

# Build headers for model settings
headers = build_extra_headers(feature="research-agent", step="synthesis")

# Use with Pydantic AI model settings
settings = AnthropicModelSettings(
    extra_headers=headers,
    # ... other settings like anthropic_thinking, etc.
)

Supported Providers

Provider Agno Pydantic AI
OpenAI OpenAIChat OpenAIModel
Anthropic OpenAILike AnthropicModel
Gemini OpenAILike OpenAIModel

Environment Variables

Variable Required Description
MAJORDOMO_GATEWAY_URL No Gateway URL (default: http://localhost:7680)
MAJORDOMO_API_KEY Yes Your Majordomo API key
OPENAI_API_KEY Per provider OpenAI API key
ANTHROPIC_API_KEY Per provider Anthropic API key
GEMINI_API_KEY Per provider Gemini API key

Documentation

  • Pydantic AI Guide - Complete guide with migration instructions, advanced usage, and examples

Examples

License

MIT

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

majordomo_frameworks-0.1.0.tar.gz (338.0 kB view details)

Uploaded Source

Built Distribution

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

majordomo_frameworks-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file majordomo_frameworks-0.1.0.tar.gz.

File metadata

  • Download URL: majordomo_frameworks-0.1.0.tar.gz
  • Upload date:
  • Size: 338.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for majordomo_frameworks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54a7fa052e4df8b6a7d6689d264aedd92a3a1f8e22b75336f0508ddc1b30cbc0
MD5 d3a47145b0b94ab5c55c4e8a3c7ad46c
BLAKE2b-256 4ecf82f2a57438422def70c511a763ab312d4045e22defbe5f2c5ea6c8cef443

See more details on using hashes here.

File details

Details for the file majordomo_frameworks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for majordomo_frameworks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddedbe8e5389b44b3dc98d6da9b1a15b9743b3c1cf1657f2f5347446f98f324e
MD5 7818cef02b50dd6410f6126a5923ec60
BLAKE2b-256 be8e408a8564bc5f50acdea7e8e3f0d8848b053adf1e774c7d7df64bf2939168

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