No project description provided
Project description
BAIChat API Python
Installation
Pypi
pip install baichat-py
Codeberg
pip install --index-url https://codeberg.org/api/packages/Bavarder/pypi/simple/ baichat-py
Usage
Async
import asyncio
loop = asyncio.get_event_loop()
hello = loop.run_until_complete(chat.async_ask("Hi"))
print(hello.text)
# => Hello! How can I assist you today?
Context manager
with BAIChat() as (loop, chat):
hello = chat.ask("Hi")
print(hello.text)
# => Hello! How can I assist you today?
Delta
with BAIChat() as (loop, chat):
hello = chat.ask("Hi")
for delta in hello:
print(delta.text)
# => Hello
# => Hello!
# => Hello! How
# => Hello! How may
# => Hello! How may I
# => Hello! How may I assist
# => Hello! How may I assist you
# => Hello! How may I assist you today
# => Hello! How may I assist you today?
Sync
chat = BAIChat()
print(chat.sync_ask("Hello, how are you?").text)
# => Hello! As an AI language model, I don't have feelings, but I'm functioning properly and ready to assist you. How may I help you today?
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
baichat_py-0.2.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for baichat_py-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb90c55d875afbd451807af136de9bd0a454ba8ed000d29bf148b716a09e9325 |
|
MD5 | 23bb3755ed9dcd5a0f4ec4b26115ccca |
|
BLAKE2b-256 | 2de89f2d3296cb16b0ea34ad0e26a687ed7efe67698bd785d47e23ae3372333c |