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_to_set=[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.10.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

chatgpt_functions-0.1.10-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chatgpt_functions-0.1.10.tar.gz
  • Upload date:
  • Size: 5.8 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.10.tar.gz
Algorithm Hash digest
SHA256 7aa2e3197acd4834abb75d397b9fe71046af8a2bad38794b64136c281a6f03a9
MD5 fb352ebc0fea8bbafae84253a2594091
BLAKE2b-256 b830eccadfac91cbcb7876c34054d16276770c6790cb9add37c75d52f2e7e66e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chatgpt_functions-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 afee7d0c7f9c0d2be19789ef4650678eddd651c15d240e4e923f8b652320a355
MD5 4a5a306cfa48b789fdcc70ded64b8d63
BLAKE2b-256 b479002bf979341607390e73e7cbb2ed2c9970dec3529fa20a55d8a6d905f4ad

See more details on using hashes here.

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