Skip to main content

This is a openapi helper library for the ZMP AI Platform

Project description

zmp-openapi-helper

Platform Badge Component Badge CI Badge License Badge PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Wheel PyPI - Download

Introduction

This is a openapi helper library for the ZMP AI Platform

Key Features

  • Support the OpenAPI Specification(>3.0.0)
  • Generate the Arguments Schema for the LLM

Installation

Install using pip:

pip install zmp-openapi-helper

Install using poetry:

poetry add zmp-openapi-helper

Usage

Basic example:

import logging
import logging.config
from typing import List

from zmp_openapi_toolkit import (
    MixedAPISpecConfig,
    ZmpAPIWrapper,
    ZmpTool,
    ZmpToolkit,
)

logging.getLogger("zmp_openapi_toolkit.openapi.zmpapi_models").setLevel(logging.INFO)
logging.getLogger("zmp_openapi_toolkit.toolkits.toolkit").setLevel(logging.INFO)

if __name__ == "__main__":
    mixed_api_spec_config = MixedAPISpecConfig.from_mixed_spec_file(
        file_path="runner/openapi/zmp_mixed_api_spec.json"
    )

    zmp_api_wrapper = ZmpAPIWrapper(
        "https://api.zmp.vn", mixed_api_spec_config=mixed_api_spec_config
    )

    operations = zmp_api_wrapper.get_operations()
    for operation in operations:
        print("-" * 100)
        print(operation.args_schema)
        for field_name, field_info in operation.args_schema.model_fields.items():
            print(
                f"\t{field_name}: {field_info.annotation}, {field_info.default}, {field_info.description}"
            )

For more detailed usage instructions, please refer to our documentation.

Development Setup

  1. Clone the repository
git clone https://github.com/yourusername/zmp-openapi-helper.git
cd zmp-openapi-helper
  1. Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # Windows: venv\Scripts\activate
  1. Install development dependencies
poetry install

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

Contact

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

zmp_openapi_helper-0.2.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

zmp_openapi_helper-0.2.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file zmp_openapi_helper-0.2.0.tar.gz.

File metadata

  • Download URL: zmp_openapi_helper-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.10 Darwin/24.3.0

File hashes

Hashes for zmp_openapi_helper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4ba8732929e3bac55ff283319247e78dbdcd66b0ecad413567e644c11d2f751f
MD5 dc8d187ee09f962e3984a83312ebd727
BLAKE2b-256 48ade412258f1e61355cd05833d623b4f31cfbebbd244b9c7383e2783ffc4b6a

See more details on using hashes here.

File details

Details for the file zmp_openapi_helper-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zmp_openapi_helper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.10 Darwin/24.3.0

File hashes

Hashes for zmp_openapi_helper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33d089bc772316d40794577351c67a8f1edce53b79fa1ad343450771a4e54a5a
MD5 29616639293ff4ba9bd862f9347359f4
BLAKE2b-256 a8742eb774d82cd467f1c195cafaa0c0ba86a834efd0fc23697cccdeb5206504

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