Skip to main content

Easy-to-use OpenAI Agent with support for the latest Function call feature.

Project description

OpenAI Agent

Easy-to-use OpenAI Agent with support for the latest Function call feature.

Usage

  1. Create your own functions using comprehensive documentation comments and type annotations.
def add(a: int, b: int):
    """Add two numbers.

    :param a: First number.
    :param b: Second number.
    """
    return a + b
  1. Load the functions as function objects.
from openai_agent.completions import get_function_completion
from openai_agent.functions import Function
from openai_agent.messages import UserMessage


response = get_function_completion(
    messages=[UserMessage(content="Calculate 2 + 2")],
    functions=[Function.load_from_func(add)],
)

print(response.content)

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_agent-0.1.0.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

openai_agent-0.1.0-py3-none-any.whl (16.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