PFT Framework
Prompt File Template (PFT) framework structures text for AI interpretation, specifying tasks ranging from queries to feedback statements. It allows LLM to temporary learn from prompts.
PFT frameworks are characterized by a prompt template and data files. Within the prompt template, locations where entire data from data files to be extracted are demarcated. During a task, PFT processes and populates the template with data from data files and send the newly created prompt to the large language models.
PFT Data Flow
During a PFT framework design, the prompt template and the kind of content of the data files expected are fixed. During PFT usage, different data files but of the same content can be used to solve a specific problem.
flowchart LR
A[Data Files] -->B[Updated Prompt]
C[Prompt Template] -->B[Updated Prompt]
B[Updated Prompt] --> D[LLM] --> E[LLM Response]
How to use
Usecase Creation
A user can use the developer portal under the tab Usecase Creation or call the POST API.
Prompt Writing Guideline
Here are some good practices when writing a prompt inside the template:
1. Description
Provide relevant, detailed and concise information
-
Consistency
Ensure consistency in your information and your task specification. Inconsistency can lead to confusion and inaccurate response. -
Role
Provide a role that the LLM should act as. Example:You are a Job interviewer for an IT company looking for a System Engineer role.
-
Context
Give the background and scope that the LLM can use to generate its task. -
Highlight/Separate
It's better to highlight and separate the specific data that LLM should process. -
Rules and constraints
Provide rules and constraints that LLM should adhere to. Example: -
Specify output format
Example: -
Examples
Give examples whereever possible, especially on the output expected. Example:
Above are just an example of guidelines that we follow to create a good prompt. There are other guidelines and best practices to construct an AI prompt, feel free to read them.
PFT Data Ingestion
Data files in template is enclosed by {}.
There are 2 ways in which the data files can be passed to the PFT framework during a task (chat completion API call):
-
As invidual files uploaded.
Put the variable name for data files inside {}. Example:Based on the following ingredients: ************************** {ingredients} ************************** Plan a 3 course meal and list the ingredients used in each dish, here's a sample: 1. Main Course: Lasagna Ingredients: Beef, salt, black pepper, olive oil, onions, garlic, vinegar, tomato paste, flour
-
Input multiple contents for the variable.
Put the variable name for data files inside {} and add :load. Example:Based on the following ingredients, plan a 3 course meal and list the ingredients used in each dish: ************************** {ingredients:load} ************************** Plan a 3 course meal and list the ingredients used in each dish, here's a sample: 1. Main Course: Lasagna Ingredients: Beef, salt, black pepper, olive oil, onions, garlic, vinegar, tomato paste, flour
Under the load choices, you can add multiple contents accordingly:
load_choices =
{
"ingredients":
{
"ingredients1": "beef, chicken",
"ingredients2": "salt, pepper"
}
}
In the developer portal, a user can perform Usecase Creation and Usecase Editing. They can add or edit multiple fields and their respective options manually.
After the usecase is created you can select for each field name, the multiple Options corresponding to the files that you have generated.
Usecase Test/Debug
You can test the usecase through the frontend or debug using the developer portal under the tab Debug.
Using recipe usecase and prompt number 1 for individual files upload, prepare and upload a txt document containing a list of ingredients. Here's a sample:
salt
sugar
butter
eggs
garlic
water
olive oil
milk
flour
onion
pepper
onions
black pepper
brown sugar
egg
cinnamon
all-purpose flour
baking powder
lemon juice
tomatoes
vanilla
vanilla extract
parsley
unsalted butter
baking soda
sour cream
vegetable oil
celery
ginger
lemon
cream cheese
carrots
cheddar cheese
beef
potatoes
oil
honey
nutmeg
cheese
soy sauce
mayonnaise
chicken broth
oregano
cumin
thyme
Execute or run the usecase. The usecase will generate 3 dishes along with the list of ingredients used for each dish. For example:
1. Main Course: Lasagna
Ingredients: Beef, salt, black pepper, olive oil, onions, garlic, vinegar, tomato paste, flour
2. Side dish: Potatoes au Gratin
Ingredients: Cream, garlic, unsalted butter, potatoes, salt, black pepper, cheddar cheese, thyme
3. Dessert: Cinnamon-honey cheesecake
Ingredients: Cinnamon, honey, unsalted butter, sugar, cream cheese, eggs, vanilla extract, sour cream, salt