Skip to main content

Wrapper over the gpt3.5 model, capable of calling functions

Project description

Example of usage:

import asyncio
from chatgpt_functions import (
    ChatGPT,
    Message,
    Roles,
    ChatGptFunction,
    Parameters,
    Property,
)
from config import API_KEY

chatgpt = ChatGPT(openai_api_key=API_KEY)


async def main():
    def say_hello(args):
        print(args)

    await chatgpt.get_chatgpt_response_with_functions(
        functions=[
            ChatGptFunction(
                function=say_hello,
                parameters=Parameters(
                    properties=[
                        Property(
                            property_name="name",
                            prop_type="string",
                            description="Name who to say hello to",
                            enum=["Evan", "Micha"],
                        ),
                        Property(
                            property_name="text",
                            prop_type="string",
                            description="Greeting",
                        ),
                    ]
                ),
                function_description="Say hello to user",
            )
        ],
        messages=[Message(role=Roles.USER, content='Скажи приветик миче')]
    )


loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(main())

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

chatgpt_functions-0.1.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

chatgpt_functions-0.1.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file chatgpt_functions-0.1.5.tar.gz.

File metadata

  • Download URL: chatgpt_functions-0.1.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for chatgpt_functions-0.1.5.tar.gz
Algorithm Hash digest
SHA256 278f5d4886367ab4fdfd0b54bbd790a080aedb12e0f24b9c24aba205856acbf3
MD5 dadae591dff31a8396e61b5c570a062d
BLAKE2b-256 a04f7a25eb3e690beac4facf889cb5b79af66d31242efd5a59b7bf5ed9fccb05

See more details on using hashes here.

File details

Details for the file chatgpt_functions-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for chatgpt_functions-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f1bdb9c85749616bbbf7c91cd7eef5ed5f0684aae37cae603a33a30c14766713
MD5 13fae9217ae42216401faa0f0a19afc8
BLAKE2b-256 ddae1a80885bb1fb1003e52f58831ad39a6d20b597856bcaefa4046fb8a25fab

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