Skip to main content

Idiomatic way to build chatgpt apps using async generators in python

Project description

turbo-chat

Idiomatic way to build chatgpt apps using async generators in python

Example

from turbo_chat import *

@turbo()
async def horoscope(context):

    yield System(content="You are a fortune teller")
    yield User(content=f"My zodiac sign is {context['zodiac']}")

    input = yield GetUserInput(message="What do you want to know?")
    yield User(content=input)

    value = yield Generate(settings={"temperature": 0.9})
    print(f"generated: {value}")

b = horoscope({"zodiac": "pisces"})

output, done = await run(b)
assert isinstance(output, GetUserInput)
assert not done

user_input = "Tell me my fortune"
output, done = await run(b, user_input)
assert isinstance(output, str)
assert done

turbo

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

turbo_chat-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

turbo_chat-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file turbo_chat-0.1.0.tar.gz.

File metadata

  • Download URL: turbo_chat-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.8.13 Linux/5.15.0-60-generic

File hashes

Hashes for turbo_chat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 684f18c76421ae0bc4597735a09950f504a9f94bb20956c0cd110707696bc4d7
MD5 a3d2de14ee6c91aede5cf73fbf02d335
BLAKE2b-256 e909fc7da771995146f5869e58b35852000e493387d4afc04bba5b3c70aa0a76

See more details on using hashes here.

File details

Details for the file turbo_chat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: turbo_chat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.8.13 Linux/5.15.0-60-generic

File hashes

Hashes for turbo_chat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9202ede6c07d9946d34bc730f0437f1a997996f75c98310acb442df71f1c36e0
MD5 70485bed3a3343e45b65f3cdfc15c9e0
BLAKE2b-256 cd70b72b2b8a6fe8dd5de1d0d669b72195b4b49cad990844c5e719e9867f7d1d

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