Prompt Hub SDK.
Project description
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'],
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file prompthub-0.1.17-py3-none-any.whl
.
File metadata
- Download URL: prompthub-0.1.17-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9da58f7cc507852fc5609e6b6b33ffb8eb245e58e7e11bbd18e2d4813c2da2cc |
|
MD5 | 3aa6017281fe3f75f850857d7baf947b |
|
BLAKE2b-256 | a5b6ff6f42a1bf6659b35234258ac3416461af3b96068792955bc370d5ea44b8 |