Skip to main content
from prompthub import PromptHub, errors

try:
    prompts = PromptHub('http://localhost:8000', '25cee15690db575d123271ef7f408e6a1f9446b1', category='rmb-prod')
except errors.CategoryNotFoundError:
    print('Category not found')
    # do something
except errors.ConnectionError:
    print('Connection error')
    # do something

# 按照这个顺序来找可以适用的模型
prompts.set_preferred_models(['gpt-3.5', 'gpt-4-turbo', 'any'])

try:
    prompt = prompts.get(
        'MetaName',
        raise_if_missing_variables=True,
        k1='v1',
        k2='v2',
    )
    content = prompt.content
    model = prompt.model

except errors.PromptNotFoundError:
    print('Prompt not found')
    # do something
except errors.PromptMissingVariablesError as e:
    print('Prompt missing variables', e)
    # do something
except errors.NoValidModelError:
    print('No valid model')
    # do something

from client.prompthub.hub import PromptHub, errors

prompts = PromptHub('http://localhost:8000', '25cee15690db575d123271ef7f408e6a1f9446b1', category='rmb-prod')

template = prompts.get_template('MetaName')
# 该Prompt适用的模型有哪些
valid_models = template.models

template = prompts.create_template(
    'MetaN1ame',
    'tex111t',
    output_format='str',
    model_names=['gpt-3.5', 'gpt-4-turbo'],
    label_names=['label1', 'label2'],
)

Metadata

Release files for prompthub 0.1.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

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

Release files / prompthub-0.1.17-py3-none-any.whl

Download URL prompthub-0.1.17-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9da58f7cc507852fc5609e6b6b33ffb8eb245e58e7e11bbd18e2d4813c2da2cc
BLAKE2b-256 checksum
How to use checksums
a5b6ff6f42a1bf6659b35234258ac3416461af3b96068792955bc370d5ea44b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for prompthub 0.1.17

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