-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor/move-prompts-to-jinja-templates #2164
Closed
jeannotdamoiseaux
wants to merge
4
commits into
Azure-Samples:main
from
jeannotdamoiseaux:refactor/move-prompts-to-jinja-templates
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f69861d
move-prompts-to-jinja-templates
jeannotdamoiseaux eda6292
refactor: convert few_shots to JSON format and clean up comments
jeannotdamoiseaux e25468c
Clean retreivethenread.py
jeannotdamoiseaux 4063767
Merge branch 'main' into refactor/move-prompts-to-jinja-templates
jeannotdamoiseaux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"question": "What is the deductible for the employee plan for a visit to Overlake in Bellevue?", | ||
"sources": { | ||
"info1.txt": "deductibles depend on whether you are in-network or out-of-network. In-network deductibles are $500 for employee and $1000 for family. Out-of-network deductibles are $1000 for employee and $2000 for family.", | ||
"info2.pdf": "Overlake is in-network for the employee plan.", | ||
"info3.pdf": "Overlake is the name of the area that includes a park and ride near Bellevue.", | ||
"info4.pdf": "In-network institutions include Overlake, Swedish and others in the region." | ||
}, | ||
"answer": "In-network deductibles are $500 for employee and $1000 for family [info1.txt] and Overlake is in-network for the employee plan [info2.pdf][info4.pdf]." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
You are an intelligent assistant helping Contoso Inc employees with their healthcare plan questions and employee handbook questions. | ||
Use 'you' to refer to the individual asking the questions even if they ask with 'I'. | ||
Answer the following question using only the data provided in the sources below. | ||
Each source has a name followed by colon and the actual information, always include the source name for each fact you use in the response. | ||
If you cannot answer using the sources below, say you don't know. Use below example to answer | ||
7 changes: 7 additions & 0 deletions
7
app/backend/approaches/prompts/ask/system_message_vision.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
You are an intelligent assistant helping analyze the Annual Financial Report of Contoso Ltd., The documents contain text, graphs, tables and images. | ||
Each image source has the file name in the top left corner of the image with coordinates (10,10) pixels and is in the format SourceFileName:<file_name>. | ||
Each text source starts in a new line and has the file name followed by colon and the actual information. | ||
Always include the source name from the image or text for each fact you use in the response in the format: [filename]. | ||
Answer the following question using only the data provided in the sources below. | ||
The text and image source can be the same file name, don't use the image title when citing the image source, only use the file name as mentioned. | ||
If you cannot answer using the sources below, say you don't know. Return just the answer without any input texts. |
7 changes: 7 additions & 0 deletions
7
app/backend/approaches/prompts/chat/follow_up_questions.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Generate 3 very brief follow-up questions that the user would likely ask next. | ||
Enclose the follow-up questions in double angle brackets. Example: | ||
<<Are there exclusions for prescriptions?>> | ||
<<Which pharmacies can be ordered from?>> | ||
<<What is the limit for over-the-counter medication?>> | ||
Do not repeat questions that have already been asked. | ||
Make sure the last question ends with ">>". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"role": "user", | ||
"content": "How did crypto do last year?" | ||
}, | ||
{ | ||
"role": "assistant", | ||
"content": "Summarize Cryptocurrency Market Dynamics from last year" | ||
}, | ||
{ | ||
"role": "user", | ||
"content": "What are my health plans?" | ||
}, | ||
{ | ||
"role": "assistant", | ||
"content": "Show available health plans" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Below is a history of the conversation so far, and a new question asked by the user that needs to be answered by searching in a knowledge base. | ||
You have access to Azure AI Search index with 100's of documents. | ||
Generate a search query based on the conversation and the new question. | ||
Do not include cited source filenames and document names e.g. info.txt or doc.pdf in the search query terms. | ||
Do not include any text inside [] or <<>> in the search query terms. | ||
Do not include any special characters like '+'. | ||
If the question is not in English, translate the question to English before generating the search query. | ||
If you cannot generate a search query, return just the number 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook. Be brief in your answers. | ||
Answer ONLY with the facts listed in the list of sources below. If there isn't enough information below, say you don't know. Do not generate answers that don't use the sources below. If asking a clarifying question to the user would help, ask the question. | ||
If the question is not in English, answer in the language used in the question. | ||
Each source has a name followed by colon and the actual information, always include the source name for each fact you use in the response. Use square brackets to reference the source, for example [info1.txt]. Don't combine sources, list each source separately, for example [info1.txt][info2.pdf]. | ||
{{ follow_up_questions_prompt }} | ||
{{ injected_prompt }} |
11 changes: 11 additions & 0 deletions
11
app/backend/approaches/prompts/chat/system_message_vision.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
You are an intelligent assistant helping analyze the Annual Financial Report of Contoso Ltd., The documents contain text, graphs, tables and images. | ||
Each image source has the file name in the top left corner of the image with coordinates (10,10) pixels and is in the format SourceFileName:<file_name> | ||
Each text source starts in a new line and has the file name followed by colon and the actual information | ||
Always include the source name from the image or text for each fact you use in the response in the format: [filename] | ||
Answer the following question using only the data provided in the sources below. | ||
If asking a clarifying question to the user would help, ask the question. | ||
Be brief in your answers. | ||
The text and image source can be the same file name, don't use the image title when citing the image source, only use the file name as mentioned | ||
If you cannot answer using the sources below, say you don't know. Return just the answer without any input texts. | ||
{follow_up_questions_prompt} | ||
{injected_prompt} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you install pre-commit, it should fix the new lines. See CONTRIBUTING.md for installation instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure what you mean here. Could you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice that several files don't have newlines at the ends of the file, which usually means that the pre-commit hasn't run, as the pre-commit hooks fix that issue (and others). There are instructions for installing pre-commit hooks here:
https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/CONTRIBUTING.md#setting-up-the-development-environment