Skip to main content

Transform Python function docstrings into JSON schemas compliant with OpenAI function calling protocols.

Project description

OpenAI Function Parser

Transform Python function docstrings into JSON schemas compliant with OpenAI function calling protocols.

Installation

pip install openai-function-parser

Usage

from openai_function_parser import get_function_calling_schema


def my_function(a: int, b: str, c: float = 1.0) -> int:
    """
    My function description.

    Args:
        a: My first argument.
        b: My second argument.
        c: My third argument.

    Returns:
        My return value.
    """
    return 1

function_call_schema = get_function_calling_schema(my_function)
print(function_call_schema)

Authors

Xiaotian Duan (xduan7 at gmail dot com)

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

openai_func_parser-0.1.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

openai_func_parser-0.1.0-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page