pyroprompts-client
PyroPrompts client for python! PyroPrompts is a platform enabling easier exchange and automation of AI Prompts, Snippets and Workflows. This client library assists in token management and abstracts the HTTP requests to make it easy to interact with the system.
Learn more at https://pyroprompts.com.
Install
pip install pyroprompts-client
Docs
PyroPromptsClient
Create an instance of the PyroPromptsClient class with your credentials and then you may issue commands with that client instance.
Note: Might raise a pyroprompts_client.PyroPromptsError if PyroPrompts rejects the request
Note: Might raise a pyroprompts_client.PyroPromptsTimeoutError if the request times out
init
from pyroprompts_client import PyroPromptsClient,
client = PyroPromptsClient(
client_id="1234",
client_secret="567890",
)
workflow_trigger
# get all project snippets
client.workflow_trigger({
"account_id": "YOUR_ACCOUNT_ID",
"workflow_id": "WORKFLOW_ID",
"workflow_form_params": {"param_1": "value_1"}
})
get_workflow_executions
# get all project snippets
client.get_workflow_executions({
"workflow_id": "abcd-1234-cdfg-abcdefg"
})
which returns:
{
"count":1,
"next":null,
"previous":null,
"results":[
{
"id":"1a7bae4f-f121-432b-b44e-abcdefg",
"status":"complete",
"status_message":null,
"created_date":"2024-07-03T15:51:08.905236Z",
"workflow_id":"ca00d56b-79bc-42b1-8e99-abcdefg",
"result":"The response is in here",
"form_params":null
}
]
}
get_project_snippets
# get all project snippets
client.get_project_snippets()
# pass some filters as a dict of query parameters (see documentation)
client.get_project_snippets({
"project_id": "1234-56-78-9012",
"created_date__gt": "2023-01-01",
"limit": 1,
})
which returns:
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "3d1daced-ce1d-4232-9b39-abcdefg",
"name": "Snippet1",
"description": null,
"content": "Content of Snippet1",
"project_id": "e95d56f8-72d1-4b13-bc5d-abcdefg",
"deleted": 0,
"created_by": "454517f4-a97e-45a7-8088-abcdefg",
"created_date": "2024-07-03T15:38:14.387627Z",
"updated_date": "2024-07-03T15:38:14.387645Z"
},
{
"id": "f54049ee-266f-4fd7-a2f6-abcdefg",
"name": "Snippet2",
"description": null,
"content": "Content of Snippet2",
"project_id": "e95d56f8-72d1-4b13-bc5d-abcdefg",
"deleted": 0,
"created_by": "454517f4-a97e-45a7-8088-abcdefg",
"created_date": "2024-07-03T15:45:49.697119Z",
"updated_date": "2024-07-03T15:51:04.722434Z"
},
]
}
logging
To get visibility into logged events, override the log method and log however your app needs to log:
class CustomPyroPromptsClass(PyroPromptsClient):
def log(self, level, msg, **log_variables):
print(f"[{level}] {msg}", log_variables)
client = CustomPyroPromptsClass(client_id, client_secret)
Example
from pyroprompts import PyroPromptsClient, PyroPromptsError, PyroPromptsTimeoutError
my_client = PyroPromptsClient("1234", "56-789")
try:
results = my_client.get_project_snippets()
print(results)
except PyroPromptsError:
print("PyroPrompts failure")
except PyroPromptsTimeoutError:
print("PyroPrompts timed out")
Common Commands:
Black Formatting
$ black pyroprompts_client --config pyroprompts_client.toml
Build
$ python3 setup.py sdist
Pypi Distribution
$ python3 -m twine upload dist/*
License
PyroPrompts Client is MIT licensed.
Metadata
Release files for pyroprompts-client 0.1.2
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 |
|---|---|---|---|---|
| pyroprompts-client-0.1.2.tar.gz | 5.4 kB | Without provenance | Details for pyroprompts-client-0.1.2.tar.gz |
Release files / pyroprompts-client-0.1.2.tar.gz
| Download URL | pyroprompts-client-0.1.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e029c1be51fbf62c2eaf340286ebcacbdf705c9009fb188a90dbd5075b09467
|
|
BLAKE2b-256 checksum How to use checksums |
efb9be01eb641cfd37259334dbe06c414846a15a8fa724ad3cef862a75bfaaa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.13
|
Security for pyroprompts-client 0.1.2
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.