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.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for baichat_py-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af5e83d813b93b249009da35fbb6cfcea8c65ee36fa0102e3ed7340d90804391 |
|
MD5 | 78a66fde541939c3e0aa882cbc2d30b4 |
|
BLAKE2b-256 | f5ba2b3ff0140b714149b4ee0c3af857f5e9b5fecd0d877370ea89351c21f433 |