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
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
684f18c76421ae0bc4597735a09950f504a9f94bb20956c0cd110707696bc4d7
|
|
| MD5 |
a3d2de14ee6c91aede5cf73fbf02d335
|
|
| BLAKE2b-256 |
e909fc7da771995146f5869e58b35852000e493387d4afc04bba5b3c70aa0a76
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9202ede6c07d9946d34bc730f0437f1a997996f75c98310acb442df71f1c36e0
|
|
| MD5 |
70485bed3a3343e45b65f3cdfc15c9e0
|
|
| BLAKE2b-256 |
cd70b72b2b8a6fe8dd5de1d0d669b72195b4b49cad990844c5e719e9867f7d1d
|