Skip to main content

Open Chat Bot Client package

This Python package contains utilities that allow you to find, access, and use the bots that are compliant with the Alliance for Open Chatbot standard. The package is designed for the Python 3 environments.

The implementation is based on the standard defined by the Alliance.

Authors

The initial implementation is made by Konverso in 2020 by Alexander Danilov and Amedee Potier (amedee.potier@konverso.ai).

See also

License

This package is released under the MIT license. To learn more about it, view the LICENSE file in this folder.

Installation

You can install this package using pip3. To do so, run the following command:

pip3 install -e git+https://github.com/konverso-ai/open-chatbot-py-client.git#egg=AllianceForOpenChatBot

Usage notes

Getting a response from a chatbot

The sample below demonstrates how to get a chat local stub, send a sentence to it, and retrieve the bot response.

from openchatbotclient import Client 
client = Client('https://callbot.konverso.ai', 443) 
response = client.ask("john", "hello", lang="en") 
print(response) 

The response you get is a JSON file using the standard Alliance format.

Looking up an enterprise bot

The standard includes the concept of bot registration. Companies can register their bot with the help of a standard JSON descriptor that is available at the following link: /.well-known/openchatbot-configuration.

Use the "repository" class to retrieve a descriptor instance:

from openchatbotclient import Repository
repo = Repository()

bot_descriptor = repo.get_descriptor("openchatbot.io")
print("Host: ", bot_descriptor.get_host())

Alternatively, you can use the "client" instance, where you can invoke multiple chat requests:

bot = repo.get_client("openchatbot.io")
print("Client: ", bot)

Then you can send chat text to these bots:

response = bot.ask("john", "hello", lang="en")
print(response)

Querying multiple bots

You can interact with multiple remote bots and manage multiple responses. This use case is demonstrated in the sample below.

  1. Create a second bot. This time it is done by an explicit declaration:
from openchatbotclient import Client
bot_konverso = Client('https://callbot.konverso.ai', 443)
  1. Create a group with these two bots:
from openchatbotclient import ClientGroup

bots = ClientGroup()
bots.append(bot_konverso)
bots.append(bot_alliance)
  1. Send user input to all the bots in this group:
responses = bots.ask("amedee", "hello", lang="en")
print("Found response of size:", len(responses))
  1. You get the response_group object. Now you can use utilities to extract the content of interest from this object.

Get one response:

response = responses.get_first()
   if response:
      print("Got first response from: ", response.get_client(), " : ", response.get_text())
   else:
      print("No response found !")

Print all available responses:

print("All reponses found:")
print(responses.get_all_string(response_format=" - {client}: {text}", separator="\n"))

Metadata

Release files for open-chatbot-py-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-chatbot-py-client 0.1.0
File Size Uploaded Provenance Actions
open-chatbot-py-client-0.1.0.tar.gz 10.4 kB Without provenance Details for open-chatbot-py-client-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for open-chatbot-py-client 0.1.0
File Interpreter ABI Platform Actions
open_chatbot_py_client-0.1.0-py3-none-any.whl Python 3 none any Details for open_chatbot_py_client-0.1.0-py3-none-any.whl

Total release size: 25.8 kB

Release files / open-chatbot-py-client-0.1.0.tar.gz

Download URL open-chatbot-py-client-0.1.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a5680dad7b1087637a97a0d4afb763d31b9c0abed1a0c2100fc42b56782ffdb2
BLAKE2b-256 checksum
How to use checksums
dbd695be2a5987f65f97adffee0117abe88344439b79e26d686d02a89966180f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Release files / open_chatbot_py_client-0.1.0-py3-none-any.whl

Download URL open_chatbot_py_client-0.1.0-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7b633b93967cf1f947aeb972129c4aff607d44ea716584fa5ed6b17965551ea
BLAKE2b-256 checksum
How to use checksums
fd2b343fe6ffbf285a8bcaaec0718dd079219fb07e9b6bbd3f6f2d0e32cb6352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Security for open-chatbot-py-client 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page