Skip to main content

Juji Python SDK

Project description

Juji Python SDK

This is a Python SDK for Juji Chatbot and Juji Design, using the Juji API.

Installation

pip install juji-python-sdk

Usage

The Chatbot and Design SDKs are in the same package.

Chatbot

from juji_python_sdk import Chatbot

chatbot = Chatbot("<chatbot_url>")

participation = chatbot.start_chat()

Asynchronous message handling

def handle_message(message: dict):
    if message["type"] == "normal":
        print(f"Juji: {message['text']}")
    elif message["type"] == "flowinfo":
        print(f"Juji is waiting for your response...")

participation.add_message_callback(handle_message)

time.sleep(10)

print("You: Hello, how are you?")
participation.send_chat_msg("Hello, how are you?")

time.sleep(10)

print("You: Bye!")
participation.end()

Synchronous message handling

messages = participation.get_messages()
print(messages)

print("You: Hello, how are you?")
messages = participation.send_chat_msg("Hello, how are you?")
print(messages) 

Design

from juji_python_sdk import JujiDesign

design = JujiDesign("<juji_api_key>", "<juji_platform_url>")

brands = design.get_brands()

browser_key = uuid.uuid4()
design.add_faq(["Where can I buy some tomatoes?"], 
               ["We have the best tomatoes in the world!"], 
               "<engagement_id>", 
               browser_key)

Check out the design_example.py for a complete example.

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

juji_python_sdk-0.2.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

juji_python_sdk-0.2.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file juji_python_sdk-0.2.4.tar.gz.

File metadata

  • Download URL: juji_python_sdk-0.2.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for juji_python_sdk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 44814114e9983381c54904abfe07b289ce1c07c839aa15fb9d20f8f5b46ec486
MD5 73117034ddfa875465c9d6d673b0caae
BLAKE2b-256 5c7046acfc23cfb0402abe3df27685e675b9f7e29c4b11fb1f83581bfbfc8963

See more details on using hashes here.

File details

Details for the file juji_python_sdk-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: juji_python_sdk-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for juji_python_sdk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b0a761931924454a71cd644cb4e82d661b320ee0a1625afd6f80ea53ce09d5b
MD5 46782c194cc1826403c5279cde8f0a07
BLAKE2b-256 71cfb7b02aa962ae836a052f9b4c512cbb03af011d4bf2747d3a4523e409cbaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page