Skip to main content

qBud Python Client

qbud helps to make interaction with qBud assistants easier. Its aim is to provide a low-code solution for interactions with assistants that you have configured via the UI.

How to Install

Installing is easy:

pip install qbud

We recommend python>=3.9, but the client may run with older versions as well. The only external dependency is the widely used requests library, which is installed when running the above command.

Configuration

Authentication is done with a per-assistant access key, generated from your account.

Variable Required Default Purpose
QBUD_ASSISTANT_ACCESS_KEY yes* Access key for the assistant. *Optional if you pass access_key=... to Assistant() directly.
QBUD_BASE_URL no https://api.qbud.ai Override the API host (e.g. for staging).

Quickstart

1. Connect to an assistant

Make sure you have built an assistant via our UI. When you're editing the assistant there, copy the ID from the address bar (after /assistants/) and pair it with your assistant access key:

from qbud import Assistant

assistant = Assistant("<your-assistant-id>", access_key="<your-access-key>")
# or, with QBUD_ASSISTANT_ACCESS_KEY set in the environment:
assistant = Assistant("<your-assistant-id>")

2. Send messages

Create a chat with assistant.create_chat() and call send_message(...) on it:

chat = assistant.create_chat()
response = chat.send_message("Hi!")
print(response)
> {"content": "Hi there!", "role": "assistant"}

Saving and loading chats

By design, chat message history cannot be retrieved from our API. If you need history across sessions, save chats locally:

from qbud import Chat

# save a Chat object as JSON (message history only — the access key is
# never written to disk, since it is a bearer credential for the chat)
chat.save("chat.json")

# ...session terminates

# load a Chat instance from the saved JSON. The result is read-only:
# get_messages() works, but send_message() requires a live chat created
# via Assistant.create_chat().
chat = Chat.load("chat.json")

You can also inspect the in-memory history with get_messages(...):

print(chat.get_messages())
> [{"content": "Hi!", "role": "user"}, {"content": "Hi there!", "role": "assistant"}]

Release files for qbud 0.2.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 qbud 0.2.0
File Size Uploaded
qbud-0.2.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qbud 0.2.0
File Interpreter ABI Platform
qbud-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size:14.5 kB

Release files / qbud-0.2.0.tar.gz

Download URL qbud-0.2.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a33815638a17a9f462d19eeab95fa19704816b108373748ff469f0fb34a0bebe
BLAKE2b-256 checksum
How to use checksums
16213a5afb5f32602ce107fbe3f467dacbe3832f62c5ad8fe0d5536b87d8395a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / qbud-0.2.0-py3-none-any.whl

Download URL qbud-0.2.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94fe3110b20dcf187d5c7fa58603c2abc19216b3ce1aff150ade714aef10afd0
BLAKE2b-256 checksum
How to use checksums
ecf2e55fcf82006f1adc8d9857c0115fcd183b215011931fc2b44d7f2654c0ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

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