English | 简体中文
Make anyone master of prompt engineering!
View Demo
·
Web UI
·
Report Bug
·
Request Feature


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:
COSTAR, RISE.See the demos for more details.
pip install polish_your_promptEnter 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.
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.
See the schemas for more choices.
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!
Distributed under the MIT License. See LICENSE.txt for more information.
Projects or articles that inspired this project: