ezprompt
An easy-to-use library for creating and sending prompts to various LLMs.
Features (Planned)
- Simple prompt definition using Markdown and Jinja templating.
- Automatic input validation against prompt templates.
- Model selection from a wide range of providers.
- Context length validation with suggestions for suitable models.
- Cost estimation before sending prompts.
- Up-to-date model information (context size, pricing).
- Asynchronous support for concurrent prompt execution.
Installation
pip install ez-prompt
Basic Usage
See the supported models by running:
from ez_prompt import list_models
list_models()
Then, create a template, choose your model, provide an API key, format and send. Sending is asynchronous by default.
import asyncio
from ez_prompt import Prompt
async def main():
# Define a prompt template (details TBD)
prompt_template = """
Translate the following text from {{ source_lang }} to {{ target_lang }}:
{{ text }}
"""
# Initialize the prompt
my_prompt = Prompt(
template=prompt_template,
model="gpt-3.5-turbo",
api_key="your_api_key"
)
# Format the prompt with inputs
my_prompt.format(
inputs={"source_lang": "English", "target_lang": "French", "text": "Hello, world!"},
)
# Send the prompt
response = await my_prompt.send()
print(f"Model response: {response}")
if __name__ == "__main__":
# Required environment variables (e.g., OPENAI_API_KEY)
# Set them according to the model provider you use.
asyncio.run(main())
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Metadata
Release files for ez-prompt 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ez_prompt-0.1.3.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ez_prompt-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / ez_prompt-0.1.3.tar.gz
| Download URL | ez_prompt-0.1.3.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bdf49b4d77cfb6bcc81a0f8a4f630b2cc7f1c4e7cde001ea7fd0bb5958e78c3
|
|
BLAKE2b-256 checksum How to use checksums |
b87f7e6df9afe0383852c6f112535bee93748194b81c11618ae1d5618d70eb14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Windows/10
|
Release files / ez_prompt-0.1.3-py3-none-any.whl
| Download URL | ez_prompt-0.1.3-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
901ffcfe956dd0e9afdd89e4d1bb01b02c140cb641a9a76be1f0296537d55362
|
|
BLAKE2b-256 checksum How to use checksums |
cf6f7b437ea1031043a4e3d5a180bda7f8fd00a0074b20ac26dc987dd1cc05c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Windows/10
|