dyadic
The official Python SDK for the Dyadic API: use Iris from Python with streaming, function calling, images and typed errors. Requests use your Dyadic credits.
pip install dyadic
from dyadic import Dyadic
client = Dyadic() # reads DYADIC_API_KEY
print(client.ask("Hello!", model="iris"))
Runs: your own agent, Dyadic's tools, your functions
An application brings its own agent (name and instructions), lets it use
Dyadic's built-in tools, and gives it functions it runs itself. runs.run
calls your functions whenever the agent asks and returns the finished run.
def lookup_order(order_id):
"""Look up an order by id."""
return {"order_id": order_id, "status": "shipped"}
lookup_order.schema = {"type": "object", "properties": {"order_id": {"type": "string"}}, "required": ["order_id"]}
run = client.runs.run(
agent={"id": "helpdesk", "name": "Helpdesk", "instructions": "You answer customers of a small shop."},
messages=[{"role": "user", "content": "Where is order 1042? Also, what's the weather in Lisbon today?"}],
builtin_tools=["data.web_search", "data.web_fetch"],
functions={"lookup_order": lookup_order},
end_user="customer-17", # your own id for who asked, kept with the run's usage
conversation_id="ticket-88",
)
print(run.output_text, run.credits)
runs.create(..., stream=True) streams events (run.started, status,
tool.started, tool.completed, sources, image.generated, delta,
requires_action, run.completed).
Connected apps: saving into a person's Workspace
With the person's approval, an application can save into their Dyadic Workspace, naming them by the Discord account linked to their Dyadic account.
from dyadic import DyadicError
status = client.connections.discord(discord_id)
if not status.authorized:
print("Allow this app:", status.authorize_url) # show the person this link
try:
saved = client.workspace.saves.create(discord_id=discord_id, kind="message", title="From #general",
text="Worth keeping", url="https://discord.com/channels/1/2/3")
print(saved.url)
except DyadicError as error:
if error.code == "authorization_required":
print("Allow this app:", error.body["authorize_url"])
kind is message, conversation (with messages, saved as a chat the
person can continue unless as_chat=False), image or file (with files:
base64, up to 10 of 8 MB).
See https://dyadic.app/developers/ for the full guide.
Metadata
Release files for dyadic 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dyadic-1.1.0.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dyadic-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.5 kB
Release files / dyadic-1.1.0.tar.gz
| Download URL | dyadic-1.1.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45b903c08d9d4fdfdefe2853874fa9df7d141d0a35195c9bcb2872e30ead7713
|
|
BLAKE2b-256 checksum How to use checksums |
0ea057dd78f4963021be28f1a795b22b2a453966538b8f06b859417619088c52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / dyadic-1.1.0-py3-none-any.whl
| Download URL | dyadic-1.1.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2c325d1cd747f94f929976c94841a7f74d1c5a4d2321de4084614e59824a791
|
|
BLAKE2b-256 checksum How to use checksums |
ecdef4335db54b962b6aec744ae1c070ba4ff62566057b2e03185dda912bebcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|