Make anyone master of prompt engineering.
Project description
Polish-Your-Prompt
Make anyone master of prompt engineering!
View Demo
·
Report Bug
·
Request Feature
Table of Contents
About The Project
What is the ENGINEERING
part of Prompt Engineering
?
Prompt Engineering is the mix of engineering and art. Some people are very good at writing, and they can talk to LLMs in a very natural way. However, some may not. They need help to create high-quality prompts that can be used to generate satisfactory text.
In this project, we introduced a tool that make you master of prompt engineering and create prompts that can be reused the rest of your life.
The tool provides 3 types of prompt refiner:
- Simple Refiner: refine your prompt with a simple prefix.
- Schema Refiner: refine your prompt with a widely used structure, e.g.
COSTAR
,RISE
. - Annotated Refiner: refine your prompt with text annotations.
See the demos for more details.
Getting-started
Installation
pip install polish_your_prompt
Configuration
Enter your LLM API base and API key in .env
file (create one if not exist).
API_BASE="your-api-base"
API_KEY="your-api-key"
In theory, any large language model that supports the OpenAI API style can use this tool.
Usage
Take SchemaRefiner
as an example:
from polish_your_prompt.core import SchemaRefiner, MODE
from polish_your_prompt.schemas import *
prompt = "help me do my homework"
refiner = SchemaRefiner()
structure, prompt = refiner.refine(prompt, schema=COSTAR(), mode=MODE.ONE_STEP)
CO-STAR is a prompt template proposed by Sheila Teo in Singapore’s first ever " "GPT-4 Prompt Engineering competition organized by the Government Technology " "Agency of Singapore (GovTech).
Check out the article for more details.
In this way, the LLM will change the prompt into a CO-STAR
style structure, like:
# CONTEXT #
You are a student in high school taking a math class.
# OBJECTIVE #
Seek assistance with completing your homework assignment.
# STYLE #
Informal student seeking help.
# TONE #
Polite and respectful.
# AUDIENCE #
Classmate or tutor who can provide guidance.
# RESPONSE #
Clear explanation of the homework task and request for assistance.\n'
In most cases, the LLM will generate a more satisfactory response.
See the demos for more details.
Roadmap
- Multi-language Support
- Chinese
- A demo interface for non-programmers
- A choice to give death threats or 10$ tips to LLM
Willing to contribute? Check out the open issues.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Acknowledgments
Projects or articles that inspired this project:
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 Distribution
Built Distribution
File details
Details for the file polish_your_prompt-0.0.2.tar.gz
.
File metadata
- Download URL: polish_your_prompt-0.0.2.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9221814ddfac71f5fbf52196370ff9844af5ae59e1ef0a7081cd8c0b406e6d4 |
|
MD5 | 4d7486758f6adaa775795b6a63d7c65b |
|
BLAKE2b-256 | 5887dcbeb0d8f2725f235a57701c60c96571c5826f198132d5c48e7d54355c5a |
File details
Details for the file polish_your_prompt-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: polish_your_prompt-0.0.2-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c0335b7a4abcbffceeda4bb703be8fc0f06314eb45ddf7e361b45cd19ddab34 |
|
MD5 | 0b390a2718c264bb37211e30bf4d0854 |
|
BLAKE2b-256 | ccc575d94c0bc1c94004841f0d4b4bdb840de9e268eb6951e04427b21d225897 |