No project description provided
Project description
BAIChat API Python
Installation
You can install it from PyPi
pip install 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.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for baichat_py-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1912c08a896af78aaa6ce19d45a0762ca89f6dd01b625e19ecc1c58cfda18c8c |
|
MD5 | fdb22ee7d51a29c3db76642856f5a899 |
|
BLAKE2b-256 | b1e4b992eab56c071759348354642e56f2f120b4b043b5139a4ca785fc9a1e4e |