Skip to content

Commit ce7b59d

Browse files
committed
feat: generic example questions & reliable local ingestion script
1 parent ee63bd5 commit ce7b59d

23 files changed

+111
-381
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,6 @@ node_modules
148148
static/
149149

150150
data/**/*.md5
151+
data
151152

152153
.DS_Store

app/backend/approaches/prompts/ask_answer_question.prompty

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ description: Answer a single question (with no chat history) using solely text s
44
model:
55
api: chat
66
sample:
7-
user_query: What does a product manager do?
7+
user_query: Which metrics should I track for Premium Capacity in Fabric?
88
text_sources:
9+
- "7 - Monitoring.md#L210-L245: Premium capacity KPIs include CPU utilization, memory consumption, query duration, dataset refresh times, and concurrency slots."
910
- "role_library.pdf#page=29: The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution. Responsibilities: · Lead the product management team and provide guidance on product strategy, design, development, and launch. · Develop and implement product life-cycle management processes. · Monitor and analyze industry trends to identify opportunities for new products. · Develop product marketing plans and go-to-market strategies. · Research customer needs and develop customer-centric product roadmaps. · Collaborate with internal teams to ensure product execution and successful launch. · Develop pricing strategies and cost models. · Oversee product portfolio and performance metrics. · Manage product development budget. · Analyze product performance and customer feedback to identify areas for improvement. Qualifications: · Bachelor's degree in business, engineering, or a related field. · At least 5 years of experience in product management. · Proven track record of successful product launches."
1011
- "role_library.pdf#page=23: Company: Contoso Electronics Location: Anywhere Job Type: Full-Time Salary: Competitive, commensurate with experience Job Summary: The Senior Manager of Product Management will be responsible for leading the product management team at Contoso Electronics. This role includes developing strategies, plans and objectives for the product management team and managing the day-to-day operations. The Senior Manager of Product Management will be responsible for the successful launch of new products and the optimization of existing products. Responsibilities: · Develop and implement product management strategies, plans and objectives to maximize team performance. · Analyze competitive landscape and market trends to develop product strategies. · Lead the product management team in the development of product plans, roadmaps and launch plans. · Monitor the performance of product management team, analyze results and implement corrective action as needed. · Manage the product lifecycle, including product development, launch, and end of life. · Ensure product features and benefits meet customer requirements. · Establish and maintain relationships with key customers, partners, and vendors."
1112
- "role_library.pdf#page=28: · 7+ years of experience in research and development in the electronics sector. · Proven track record of successfully designing, testing, and optimizing products. · Experience leading a team of researchers and engineers. · Excellent problem-solving and analytical skills. · Ability to work in a fast-paced environment and meet tight deadlines.· Knowledge of industry trends, technologies, and regulations. · Excellent communication and presentation skills. Manager of Product Management Job Title: Manager of Product Management, Contoso Electronics Job Summary: The Manager of Product Management is responsible for overseeing the product management team, driving product development and marketing strategy for Contoso Electronics. This individual will be accountable for the successful launch of new products and the implementation of product life-cycle management processes. The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution."
@@ -14,11 +15,12 @@ system:
1415
{% if override_prompt %}
1516
{{ override_prompt }}
1617
{% else %}
17-
You are an intelligent assistant helping Contoso Inc employees with their healthcare plan questions and employee handbook questions.
18+
You are 3Cloud's Solution-Objects Assistant. You help consultants, engineers, and sales teams locate, explain, and compare 3Cloud Solution Objects (architecture decks, runbooks, pricing guides, security practices, etc.) and related internal resources (Employee Handbook, Benefits, Career paths).
1819
Use 'you' to refer to the individual asking the questions even if they ask with 'I'.
20+
Provide succinct but complete answers.
1921
Answer the following question using only the data provided in the sources below.
2022
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.
21-
If you cannot answer using the sources below, say you don't know. Use below example to answer
23+
If you cannot answer using the sources below, say you don't know.
2224
{{ injected_prompt }}
2325
{% endif %}
2426

@@ -34,6 +36,15 @@ info4.pdf: In-network institutions include Overlake, Swedish and others in the r
3436
assistant:
3537
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].
3638

39+
user:
40+
Which metrics should I track for Premium Capacity in Fabric?
41+
42+
Sources:
43+
7 - Monitoring.md#L210-L245: Premium capacity KPIs include CPU utilization, memory consumption, query duration, dataset refresh times, and concurrency slots.
44+
45+
assistant:
46+
Track CPU utilization, memory consumption, query duration, dataset refresh times, and concurrency slots to effectively monitor Premium Capacity performance [7 - Monitoring.md#L210-L245].
47+
3748
user:
3849
{{ user_query }}
3950
Sources:

app/backend/approaches/prompts/ask_answer_question_vision.prompty

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ system:
88
{% if override_prompt %}
99
{{ override_prompt }}
1010
{% else %}
11-
You are an intelligent assistant helping analyze the Annual Financial Report of Contoso Ltd., The documents contain text, graphs, tables and images.
11+
You are 3Cloud's Solution-Objects Assistant. You help consultants, engineers, and sales teams locate, explain, and compare 3Cloud Solution Objects (architecture decks, runbooks, pricing guides, security practices, etc.) and related internal resources (Employee Handbook, Benefits, Career paths).
12+
Provide succinct but complete answers.
1213
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>.
1314
Each text source starts in a new line and has the file name followed by colon and the actual information.
1415
Always include the source name from the image or text for each fact you use in the response in the format: [filename].

app/backend/approaches/prompts/chat_answer_question.prompty

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ system:
2020
{% if override_prompt %}
2121
{{ override_prompt }}
2222
{% else %}
23-
Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook. Be brief in your answers.
23+
You are 3Cloud's Solution-Objects Assistant. You help consultants, engineers, and sales teams locate, explain, and compare 3Cloud Solution Objects (architecture decks, runbooks, pricing guides, security practices, etc.) and related internal resources (Employee Handbook, Benefits, Career paths). Provide succinct but complete answers.
2424
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.
2525
If the question is not in English, answer in the language used in the question.
2626
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].
@@ -30,9 +30,9 @@ Each source has a name followed by colon and the actual information, always incl
3030
{% if include_follow_up_questions %}
3131
Generate 3 very brief follow-up questions that the user would likely ask next.
3232
Enclose the follow-up questions in double angle brackets. Example:
33-
<<Are there exclusions for prescriptions?>>
34-
<<Which pharmacies can be ordered from?>>
35-
<<What is the limit for over-the-counter medication?>>
33+
<<Show me the reference architecture diagram?>>
34+
<<Which roles must own the On-Prem Data Gateway?>>
35+
<<How often should we run capacity monitoring reports?>>
3636
Do not repeat questions that have already been asked.
3737
Make sure the last question ends with ">>".
3838
{% endif %}

app/backend/approaches/prompts/chat_answer_question_vision.prompty

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ system:
88
{% if override_prompt %}
99
{{ override_prompt }}
1010
{% else %}
11-
You are an intelligent assistant helping analyze the Annual Financial Report of Contoso Ltd., The documents contain text, graphs, tables and images.
11+
You are 3Cloud's Solution-Objects Assistant. You help consultants, engineers, and sales teams locate, explain, and compare 3Cloud Solution Objects (architecture decks, runbooks, pricing guides, security practices, etc.) and related internal resources (Employee Handbook, Benefits, Career paths). Provide succinct but complete answers.
1212
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>
1313
Each text source starts in a new line and has the file name followed by colon and the actual information
1414
Always include the source name from the image or text for each fact you use in the response in the format: [filename]
1515
Answer the following question using only the data provided in the sources below.
1616
If asking a clarifying question to the user would help, ask the question.
17-
Be brief in your answers.
17+
1818
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
1919
If you cannot answer using the sources below, say you don't know. Return just the answer without any input texts.
2020
{{injected_prompt}}
@@ -23,9 +23,9 @@ If you cannot answer using the sources below, say you don't know. Return just th
2323
{% if include_follow_up_questions %}
2424
Generate 3 very brief follow-up questions that the user would likely ask next.
2525
Enclose the follow-up questions in double angle brackets. Example:
26-
<<Are there exclusions for prescriptions?>>
27-
<<Which pharmacies can be ordered from?>>
28-
<<What is the limit for over-the-counter medication?>>
26+
<<Show me the reference architecture diagram?>>
27+
<<Which roles must own the On-Prem Data Gateway?>>
28+
<<How often should we run capacity monitoring reports?>>
2929
Do not repeat questions that have already been asked.
3030
Make sure the last question ends with ">>".
3131
{% endif %}

app/frontend/src/api/api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export async function getSpeechApi(text: string): Promise<string | null> {
7979
}
8080

8181
export function getCitationFilePath(citation: string): string {
82-
return `${BACKEND_URI}/content/${citation}`;
82+
// Encode the actual file path so spaces and other unsafe characters are handled,
83+
// but keep any page fragment (e.g. "#page=3") intact so the PDF opens on the correct page.
84+
const [pathPart, fragment] = citation.split("#");
85+
const encodedPath = encodeURIComponent(pathPart);
86+
return `${BACKEND_URI}/content/${encodedPath}${fragment ? `#${fragment}` : ""}`;
8387
}
8488

8589
export async function uploadFileApi(request: FormData, idToken: string): Promise<SimpleAPIResponse> {

app/frontend/src/components/Answer/AnswerParser.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ type HtmlParsedAnswer = {
88

99
// Function to validate citation format and check if dataPoint starts with possible citation
1010
function isCitationValid(contextDataPoints: any, citationCandidate: string): boolean {
11-
const regex = /.+\.\w{1,}(?:#\S*)?$/;
12-
if (!regex.test(citationCandidate)) {
11+
const trimmed = citationCandidate.trim();
12+
const regex = /.+\.[A-Za-z0-9]{1,}(?:#\S*)?$/;
13+
if (!regex.test(trimmed)) {
1314
return false;
1415
}
1516

16-
// Check if contextDataPoints is an object with a text property that is an array
17+
// Determine the array of data points
1718
let dataPointsArray: string[];
1819
if (Array.isArray(contextDataPoints)) {
1920
dataPointsArray = contextDataPoints;
@@ -23,11 +24,7 @@ function isCitationValid(contextDataPoints: any, citationCandidate: string): boo
2324
return false;
2425
}
2526

26-
const isValidCitation = dataPointsArray.some(dataPoint => {
27-
return dataPoint.startsWith(citationCandidate);
28-
});
29-
30-
return isValidCitation;
27+
return dataPointsArray.some(dp => dp.startsWith(trimmed));
3128
}
3229

3330
export function parseAnswerToHtml(answer: ChatAppResponse, isStreaming: boolean, onCitationClicked: (citationFilePath: string) => void): HtmlParsedAnswer {

app/frontend/src/components/Settings/Settings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ export const Settings = ({
269269
onChange={(_ev?: React.FormEvent<HTMLElement | HTMLInputElement>, option?: IDropdownOption) => onChange("includeCategory", option?.key || "")}
270270
aria-labelledby={includeCategoryId}
271271
options={[
272-
{ key: "", text: t("labels.includeCategoryOptions.all") }
273-
// { key: "example", text: "Example Category" } // Add more categories as needed
272+
{ key: "", text: t("labels.includeCategoryOptions.all") },
273+
{ key: "Solution Object", text: t("labels.includeCategoryOptions.solutionObjects") },
274+
{ key: "Employee Info", text: t("labels.includeCategoryOptions.employeeInfo") }
274275
]}
275276
onRenderLabel={props => renderLabel(props, includeCategoryId, includeCategoryFieldId, t("helpTexts.includeCategory"))}
276277
/>

app/frontend/src/locales/en/translation.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@
3737
"chatEmptyStateTitle": "Chat with your data",
3838
"chatEmptyStateSubtitle": "Ask anything or try an example",
3939
"defaultExamples": {
40-
"1": "What is included in my Northwind Health Plus plan that is not in standard?",
41-
"2": "What happens in a performance review?",
42-
"3": "What does a Product Manager do?",
43-
"placeholder": "Type a new question (e.g. does my plan cover annual eye exams?)"
40+
"1": "What deployment options are available for this solution?",
41+
"2": "What security controls should I consider for a BI service?",
42+
"3": "Which career path levels relate to data engineering?",
43+
"placeholder": "Example: Which document covers on-premises gateway setup?"
4444
},
4545
"askTitle": "Ask your data",
4646
"gpt4vExamples": {
47-
"1": "Compare the impact of interest rates and GDP in financial markets.",
48-
"2": "What is the expected trend for the S&P 500 index over the next five years? Compare it to the past S&P 500 performance",
49-
"3": "Can you identify any correlation between oil prices and stock market trends?",
50-
"placeholder": "Example: Does my plan cover annual eye exams?"
47+
"1": "Summarise a typical architecture diagram for cloud analytics.",
48+
"2": "Compare common cost models such as pay-as-you-go and reserved capacity.",
49+
"3": "What governance responsibilities apply to a data platform implementation?",
50+
"placeholder": "Example: What insights can a capacity planning heatmap provide?"
5151
},
5252
"generatingAnswer": "Generating answer",
5353
"citationWithColon": "Citation:",
@@ -91,7 +91,9 @@
9191
},
9292
"includeCategory": "Include category",
9393
"includeCategoryOptions": {
94-
"all": "All"
94+
"all": "All",
95+
"solutionObjects": "Solution Objects",
96+
"employeeInfo": "3Cloud"
9597
},
9698
"excludeCategory": "Exclude category",
9799
"useSemanticRanker": "Use semantic ranker for retrieval",

data/Benefit_Options.pdf

-532 KB
Binary file not shown.

0 commit comments

Comments
 (0)