Skip to main content

No project description provided

Project description

openai-tiny-function-calling

from enum import Enum
import openai_tiny_function_calling


class Unit(Enum):
    CELSIUS = "celsius"
    FAHRENHEIT = "fahrenheit"


def get_current_weather(location: str, unit: Unit = Unit.CELSIUS):
    """
    Get the current weather in a given location

    Args:
        location: The city and state, e.g. San Francisco, CA
        unit: The temperature unit to use
    """
    pass


def test_example():
    function = openai_tiny_function_calling.create_function_dict(get_current_weather)
    print(function)
    assert function["name"] == "get_current_weather"
    assert function["description"] == "Get the current weather in a given location"
    assert function["parameters"]["properties"]["location"]["type"] == "string"
    assert function["parameters"]["properties"]["location"]["description"] == "The city and state, e.g. San Francisco, CA"
    assert function["parameters"]["properties"]["unit"]["type"] == "string"
    assert set(function["parameters"]["properties"]["unit"]["enum"]) == {"celsius", "fahrenheit"}
    assert function["parameters"]["properties"]["unit"]["description"] == "The temperature unit to use (Default: celsius)"
    assert set(function["parameters"]["required"]) == {"location"}

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_tiny_function_calling-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

openai_tiny_function_calling-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file openai_tiny_function_calling-0.0.1.tar.gz.

File metadata

File hashes

Hashes for openai_tiny_function_calling-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6d1c4d575f83f099b2c45b7758ea2e76b80ab2cfbb38f1ff143ff7ef54d19ac3
MD5 5efc8200681fae33055eca4a591e6325
BLAKE2b-256 4feef04b36f98ce3395871418892b499fd215cf10c7fde95c0f48eabae13f770

See more details on using hashes here.

File details

Details for the file openai_tiny_function_calling-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for openai_tiny_function_calling-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b4be91a7d5d94e46ab69f8f12785bac9e34567bab2d493ed43a87bf07700df3
MD5 264abd32c7ac9b46bb0339f89504e132
BLAKE2b-256 231f1673d91102b64f636661a861e7c804afdb39af1af9b5bda58cb16daae7a6

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