Download: https://pypi.org/project/ai-openchat/
Chat
- Example #1 Chat:
import asyncio
from ai_openchat import Model, AsyncOpenAI
async def chat():
openai_client = AsyncOpenAI(token='API-KEY')
resp = await openai_client.generate_message('Your request?', Model().chat())
print(resp)
if __name__ == '__main__':
asyncio.run(chat())
- Example #2 Movie to Emoji:
import asyncio
from ai_openchat import Model, AsyncOpenAI
async def movie_to_emoji():
openai_client = AsyncOpenAI(token='API-KEY')
resp = await openai_client.generate_message('Convert movie titles into emoji.\n\n'
'Back to the Future: 👨👴🚗🕒 \n'
'Batman: 🤵🦇 \n'
'Transformers: 🚗🤖 \n'
'Star Wars:', Model().movie_to_emoji())
print(resp)
# ⭐️⚔️
if __name__ == '__main__':
asyncio.run(movie_to_emoji())
- Example #3 Custom chat
import asyncio
from ai_openchat import Model, AsyncOpenAI
async def image_generator():
custom_model = Model(
model="code-davinci-002",
temperature=0,
max_tokens=100,
top_p=1.0,
frequency_penalty=0.5,
presence_penalty=0.0,
stop=["You:"]
)
openai_client = AsyncOpenAI(token='API-KEY')
resp = await openai_client.generate_message('Hello!', custom_model)
print(resp)
if __name__ == '__main__':
asyncio.run(image_generator())
Image
- Generate Image
import asyncio
from ai_openchat import ImageModel, AsyncOpenAI
async def image_generator():
openai_client = AsyncOpenAI(token='API-KEY')
resp = await openai_client.generate_image('Captain America', ImageModel().image())
print(resp)
if __name__ == '__main__':
asyncio.run(image_generator())
- Generate custom Image
import asyncio
from ai_openchat import ImageModel, AsyncOpenAI
async def image_generator():
custom_model = ImageModel(n=1, size="1024x1024")
openai_client = AsyncOpenAI(token='API-KEY')
resp = await openai_client.generate_image('Captain America', custom_model)
print(resp)
if __name__ == '__main__':
asyncio.run(image_generator())
This project is an attempt to make an asynchronous library for convenient OpenAI management. You can check out the rest of the models here: https://beta.openai.com/examples.
Technologies
- Python >= 3.8;
- aiohttp >= 3.8
Metadata
Release files for ai-openchat 1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_openchat-1.1.8.tar.gz | 8.1 kB | Without provenance | Details for ai_openchat-1.1.8.tar.gz |
Release files / ai_openchat-1.1.8.tar.gz
| Download URL | ai_openchat-1.1.8.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d86ecb5a21e2c4fa2069b3882f6ee2404d0036e511d023139fb8e6c87b0a798c
|
|
BLAKE2b-256 checksum How to use checksums |
3361acea18901b02d564fcfd3d1690befde62160dc96709ff21e48c95ad0d595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.0
|
Security for ai-openchat 1.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.