do-cap-utils
A library to simplify your use case with chat bot with LLMs. Perfect for Common AI Platform.
Installation
uv add do-cap-utils
Usage
See example.py and example_multiagents.py.
General
from do_cap_utils.agent.base import BaseAgent
from do_cap_utils.agent.prebuilt import SummariserAgent
from do_cap_utils.tool import tool
# --------------------------------------------
# Create and run your own agent with some tool
# --------------------------------------------
@tool
def add_numbers(a: int, b: int):
"""Adds two numbers together"""
return a + b
agent = BaseAgent(
system_prompt="You are a helpful assistant that answers everything nicely (only that you can do or know)",
tools=[add_numbers],
)
r = agent.chat_each_message("hello")
r = agent.chat_each_message("add two numbers for me")
r = agent.chat_each_message("2 and 4")
print(r) # Inpect the output
print()
# You can use `chat_interact()` method to have an interactive session
agent.chat_interact()
Now, if you use self.chat_interact(), save the file and run this file in the command line.
uv run your_file.py
Or activate your python environment and run
python your_file.py
Example output:
================================ Human Message =================================
hello
================================== Ai Message ==================================
Hello! How can I assist you today?
================================ Human Message =================================
add two numbers for me
================================== Ai Message ==================================
Of course! Please provide the two numbers you'd like to add.
================================ Human Message =================================
2 and 4
================================== Ai Message ==================================
Tool Calls:
add_numbers (call_kGDJ89gTwG6cTZFT7cWr1dBs)
Call ID: call_kGDJ89gTwG6cTZFT7cWr1dBs
Args:
a: 2
b: 4
================================= Tool Message =================================
Name: add_numbers
6
================================== Ai Message ==================================
The sum of 2 and 4 is 6.
Metadata
Release files for do-cap-utils 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| do_cap_utils-0.2.1.tar.gz | 93.6 kB | Without provenance | Details for do_cap_utils-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| do_cap_utils-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for do_cap_utils-0.2.1-py3-none-any.whl |
Total release size: 101.2 kB
Release files / do_cap_utils-0.2.1.tar.gz
| Download URL | do_cap_utils-0.2.1.tar.gz |
|---|---|
| Size | 93.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9768609142d31939f6abdbc7f6ebd84e2acb36a4b01605b9521fc8a06224e58
|
|
BLAKE2b-256 checksum How to use checksums |
320a29d4f4e58ff5d8695bbee78f7f616f0988394ef33f3f34af9e8296efffd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.11
|
Release files / do_cap_utils-0.2.1-py3-none-any.whl
| Download URL | do_cap_utils-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c3972ff67158c77bc6ef30ffa8677e3ce225d4c0908fa27e6e79eb4496b0833
|
|
BLAKE2b-256 checksum How to use checksums |
6eb2a594613bad4b63899dce2f32a9bc8fe37202eca80e90c48f2ab33a4884f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.11
|
Security for do-cap-utils 0.2.1
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.