Skip to main content

Universal LLM service supporting OpenAI, Anthropic, and local models for code analysis and summarization

Project description

Universal LLM Service

Universal LLM service supporting OpenAI, Anthropic, and local models for code analysis and summarization.

Features

  • Multi-Provider Support: OpenAI, Anthropic, Azure OpenAI, Google, and local models
  • Async Operations: Full async/await support for all LLM operations
  • Smart Configuration: Automatic provider detection and configuration
  • Response Validation: Built-in response quality validation
  • Rate Limiting: Intelligent rate limiting and retry mechanisms
  • Type Safety: Complete type annotations with mypy support
  • Extensible Design: Easy to add new LLM providers

Installation

# Basic installation
pip install yeonjae-universal-llm-service

# With OpenAI support
pip install yeonjae-universal-llm-service[openai]

# With Anthropic support
pip install yeonjae-universal-llm-service[anthropic]

# With all providers
pip install yeonjae-universal-llm-service[all]

Quick Start

import asyncio
from yeonjae_universal_llm_service import LLMService, LLMInput, LLMProvider, ModelConfig

async def main():
    # Initialize service
    service = LLMService()
    
    # Create input
    input_data = LLMInput(
        prompt="Analyze this code and provide insights",
        llm_provider=LLMProvider.OPENAI,
        model_config=ModelConfig(model="gpt-4", temperature=0.3)
    )
    
    # Generate summary
    result = await service.generate_summary(input_data)
    print(f"Summary: {result.summary}")
    print(f"Confidence: {result.confidence_score}")
    print(f"Tokens used: {result.metadata.total_tokens}")

asyncio.run(main())

Configuration

Set your API keys as environment variables:

export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"

Supported Providers

  • OpenAI: GPT-3.5, GPT-4, and newer models
  • Anthropic: Claude 3 family (Haiku, Sonnet, Opus)
  • Azure OpenAI: Enterprise OpenAI deployment
  • Google: Gemini and PaLM models
  • Local: Custom local model integration

License

MIT License

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

yeonjae_universal_llm_service-1.0.5.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

yeonjae_universal_llm_service-1.0.5-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file yeonjae_universal_llm_service-1.0.5.tar.gz.

File metadata

File hashes

Hashes for yeonjae_universal_llm_service-1.0.5.tar.gz
Algorithm Hash digest
SHA256 81bd745f886851524ce30533eb72f576bece7a25238fd605746d90530ddaf5b8
MD5 1bc8b128d1255e70efbe26a96cf8b851
BLAKE2b-256 81537348961e92fd048c43d0343c75b454ab7f1eb2e1dfdc6421cdab6bfe54ac

See more details on using hashes here.

File details

Details for the file yeonjae_universal_llm_service-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for yeonjae_universal_llm_service-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 84777ae9f82f040b0dc049b38f03f20d11f7ed1ebbe22ba6dce82d471170ce58
MD5 c71bbcd3410c27d42bbe6af947d8d970
BLAKE2b-256 3db3d646eae1578852573699b005cdc25987498c3ee9cf28d8857da3dd0efd70

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