Skip to main content

Add your description here

Project description

LMOS-openai-types

License API Docs OpenAI Compatible

Python type definitions generated from OpenAI's OpenAPI specification

Overview

LMOS-openai-types provides strongly-typed Python models generated from OpenAI's official OpenAPI specification. It serves as a foundational package in the LMOS ecosystem, ensuring type safety and consistency across all LMOS services that interact with OpenAI-compatible APIs.

Features

  • 🔄 Auto-generated Types: Automatically generates Python types from OpenAI's OpenAPI specification
  • 📦 Multiple Format Support: Generates both Pydantic and Msgspec models
  • 🔍 Type Safety: Provides full type hints and validation for OpenAI API objects
  • 🔄 CI/CD Integration: Automated builds via GitHub Actions

Generated Packages

This repository automatically generates two Python packages:

  1. Pydantic Models (branch: pydantic-gen)

    • Built using Pydantic v2
    • Full validation support
    • IDE-friendly with complete type hints
  2. Msgspec Models (branch: msgspec-gen)

    • High-performance serialization
    • Optimized for production deployments
    • Reduced overhead compared to Pydantic

Development

To set up the development environment:

  1. Open in Dev Container (recommended)

    # VSCode will automatically detect and open the dev container
    
  2. Install dependencies

    pip install -r builder/requirements.txt
    
  3. Generate types

    # Generate Pydantic models
    python builder/generate_package.py
    
    # Generate Msgspec models
    python builder/generate_package.py --modeltype MsgspecStruct
    

CI/CD Pipeline

The repository includes two GitHub Actions workflows:

  1. build-pydantic.yml: Generates Pydantic models
  2. build-msgspec.yml: Generates Msgspec models

Both workflows:

  • Trigger on pushes to main/master
  • Generate respective Python packages
  • Push to separate branches (pydantic-gen and msgspec-gen)

OpenAPI Validation

The repository includes validation for the OpenAPI specification:

  • Validates the OpenAPI definition using Swagger Editor
  • Runs on pull requests
  • Ensures specification compliance

Project Structure

├── builder/                 # Type generation scripts
│   ├── requirements.txt    # Python dependencies
│   └── generate_package.py # Main generation script
├── .devcontainer/          # Dev container configuration
├── .github/workflows/      # GitHub Actions workflows
└── openapi.yaml           # OpenAI API specification

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

Apache 2.0 - See LICENSE for details

Part of the LMOS Ecosystem

This package is part of the larger LMOS (Language Model Orchestration System) ecosystem. Visit LMOS.io to learn more about our other packages and services.

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

lmos_openai_types-0.1.0.tar.gz (148.1 kB view details)

Uploaded Source

Built Distribution

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

lmos_openai_types-0.1.0-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lmos_openai_types-0.1.0.tar.gz
  • Upload date:
  • Size: 148.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for lmos_openai_types-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a6ea2014e3646b8771d2a517dd9c1aacb7a2ec49393858d358b5f1ffe19d8df5
MD5 91bea0a09e87b108573fb08d3958036e
BLAKE2b-256 443f849352a2bbc2381a22c02b3d762357e5a17d955026e6bfe1cd18f6e8534c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lmos_openai_types-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2785f117afd133c4c285a87ce15c757afc9add405fb9f2c481d758d07a68291
MD5 7067cc4e115c5aff0ab3e03aa1c624ec
BLAKE2b-256 2ef71007c9b74f44395c6e6b24cb7383c2df811e2e12994b5e333816eeca19ad

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