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 universal-llm-service

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

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

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

Quick Start

import asyncio
from 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.1.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.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for yeonjae_universal_llm_service-1.0.1.tar.gz
Algorithm Hash digest
SHA256 734fb8c699ac0eabbb4e92786a003310d3d8a260b683fc9248ed0ac6ea732d8b
MD5 b3a7d4f08daba06175bc18be117e8129
BLAKE2b-256 60a8b60582521d98f806d84c0b21a69670a30ce910ae44685c5e1533c630628e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yeonjae_universal_llm_service-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee981ffab36eabeac94d6122c65878a9e4e5779901c31f695ca5899800f3209e
MD5 06a38c3df5f50005c3f418262682e6a3
BLAKE2b-256 f4445b4a31f0806462a630828a734f67d56aaded839ce1fb30cd630e8a201dd7

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