Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompthub_py-4.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

prompthub_py-4.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file prompthub_py-4.0.0.tar.gz.

File metadata

  • Download URL: prompthub_py-4.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1037-azure

File hashes

Hashes for prompthub_py-4.0.0.tar.gz
Algorithm Hash digest
SHA256 d2d145213c86712d1951b840e77b8193b9605de77eb5119ce737ba66a058ca29
MD5 5a7a0745838f972336e4bb3ffb7c1b24
BLAKE2b-256 db9524c62ce6ae9d8a087576f89dcaffbc05b3c3b2bc6d1367204a5cab570a48

See more details on using hashes here.

File details

Details for the file prompthub_py-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: prompthub_py-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1037-azure

File hashes

Hashes for prompthub_py-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45923abea2ff0770d0ade8e79064886cdeffe3e3ac7b4d82b505b12e896991a1
MD5 26840ef3137f636b3b2cfe2bd571defa
BLAKE2b-256 275f8c4939e290ff93af79364b88ffe3902d29c234f94e8227cf0b7fce3c887f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page