Skip to main content

Prompt Hub Python Client

PyPI - Version Tests

A simple client to fetch prompts from Prompt Hub using its REST API.

Usage

First step is obviously installation:

pip install prompthub-py

Then you can import Prompt, that class is all you're going to need.

import prompthub

# To load from a JSON file
p = prompthub.from_json("./path/to/my/prompt.json")


# To load from a YAML file
p = prompthub.from_yaml("./path/to/my/prompt.yaml")


# To load from Prompt Hub
p = prompthub.fetch("deepset/question-answering")

# To get the prompt text (see Prompt class)
p.text

If you want to use a different Prompt Hub you must set the PROMPTHUB_MAIN_ENDPOINT environment variable to your main endpoint.

If the environment variable is not set the default api.prompthub.deepset.ai will be used.

Testing

To run tests locally first install dev dependencies, we use poetry to manage our dependencies:

poetry install --with=dev

Run Prompt Hub locally with a set of fake prompts:

docker run -p80:80 --volume $PWD/test/fake_prompts:/prompts deepset/prompthub

And then run tests:

poetry run pytest test

Metadata

Release files for prompthub-py 4.0.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 prompthub-py 4.0.0
File Size Uploaded Provenance Actions
prompthub_py-4.0.0.tar.gz 6.1 kB Without provenance Details for prompthub_py-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompthub-py 4.0.0
File Interpreter ABI Platform Actions
prompthub_py-4.0.0-py3-none-any.whl Python 3 none any Details for prompthub_py-4.0.0-py3-none-any.whl

Total release size: 13.0 kB

Release files / prompthub_py-4.0.0.tar.gz

Download URL prompthub_py-4.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d2d145213c86712d1951b840e77b8193b9605de77eb5119ce737ba66a058ca29
BLAKE2b-256 checksum
How to use checksums
db9524c62ce6ae9d8a087576f89dcaffbc05b3c3b2bc6d1367204a5cab570a48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1037-azure

Release files / prompthub_py-4.0.0-py3-none-any.whl

Download URL prompthub_py-4.0.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45923abea2ff0770d0ade8e79064886cdeffe3e3ac7b4d82b505b12e896991a1
BLAKE2b-256 checksum
How to use checksums
275f8c4939e290ff93af79364b88ffe3902d29c234f94e8227cf0b7fce3c887f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1037-azure

Security for prompthub-py 4.0.0

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.

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