Wajahat698 commited on
Commit
6f925af
·
verified ·
1 Parent(s): 004970a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -48
app.py CHANGED
@@ -1561,46 +1561,6 @@ Generating Content**
1561
  2. **Content Integration:**
1562
  - Use **all TrustBuilders®** from all buckets without exceptions.
1563
  - Incorporate each TrustBuilder® clearly and meaningfully into the narrative.
1564
-
1565
- If dataset is VW Customers there are top scoring statements:
1566
- Top Scoring Statements:
1567
-
1568
- *Development*
1569
- - We bring together the world's best talent in many disciplines to create your cars.(25%)
1570
- - Building great and affordable cars is our foundation.(22%)
1571
- - Our beginnings are a unique combination of investors and unions, and today 9 of our 20 board members are staff representatives.(18%)
1572
-
1573
- *Benefit*
1574
- - We bring together the world's best talent in many disciplines to create your cars.(23%)
1575
- - We strongly focus on keeping and nurturing our team and have a 99.5% retention rate.(18%)
1576
- - Employees are provided with extensive continuous training.(16%)
1577
-
1578
- *Vision*
1579
- - Our brands are ranked No. 2 and 5 in the reliability rankings.(27%)
1580
- - Our technology and manufacturing capabilities are second to none.(22%)
1581
- - We produce almost 9 million cars per year.(15%)
1582
-
1583
-
1584
- If dataset is VW Prospects there are top scoring statements:
1585
- Top Scoring Statements:
1586
-
1587
- *Stability*
1588
- - We work with our unions in our restructuring and future plans.(21%)
1589
- - We have learned from our mistakes in the Diesel Affair and made fundamental changes.(19%)
1590
- - Building great and affordable cars is our foundation.(18%)
1591
-
1592
- *Relationship*
1593
- - We put a lot of emphasis on the interior experience and two of our cars have been ranked in the top 10. (24%)
1594
- - We are at the forefront of technology to deliver better cars and driving experiences. (17%)
1595
- - Our beginnings are a unique combination of investors and unions, and today 9 of our 20 board members are staff representatives. (17%)
1596
-
1597
- *Competence*
1598
- - At the heart of our decision-making is the long-term quality of life for all of us. (20%)
1599
- - We put a lot of emphasis on the interior experience and two of our cars have been ranked in the top 10. (19%)
1600
- - We are one of the longest-established car companies. (18%)
1601
-
1602
- just use them as per dataset and mention
1603
-
1604
  ---
1605
  **Content Guidelines**
1606
  **General Rules**
@@ -1800,19 +1760,70 @@ def chatbot_response(message, history):
1800
  # Recompute DATAFRAME_PROOF_POINT based on the selected dataset
1801
  #df_builder_pivot_str = compute_dataframe_proof_point()
1802
  selected_dataset_ai = read_ai_dataset_selection()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1803
 
1804
- # Get top-scoring statements based on selected dataset
1805
-
1806
- output = agent_executor.invoke({"input": message, "chat_history": chat_history})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1807
  trust_tip, suggestion = get_trust_tip_and_suggestion()
1808
-
1809
- # Prepend top-scoring statements to the response
1810
- response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}"
1811
-
1812
  # Add Trust Tip and Suggestion if not already in history
1813
  if not any(f"**Trust Tip**: {trust_tip}" in entry["bot"] and f"**Suggestion**: {suggestion}" in entry["bot"] for entry in history):
1814
  response += f"\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
1815
-
 
1816
  # Save the interaction context
1817
  history.extend(
1818
  [
 
1561
  2. **Content Integration:**
1562
  - Use **all TrustBuilders®** from all buckets without exceptions.
1563
  - Incorporate each TrustBuilder® clearly and meaningfully into the narrative.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1564
  ---
1565
  **Content Guidelines**
1566
  **General Rules**
 
1760
  # Recompute DATAFRAME_PROOF_POINT based on the selected dataset
1761
  #df_builder_pivot_str = compute_dataframe_proof_point()
1762
  selected_dataset_ai = read_ai_dataset_selection()
1763
+ datasets = {
1764
+ "VW Customers": {
1765
+ "Development": [
1766
+ "We bring together the world's best talent in many disciplines to create your cars. (25%)",
1767
+ "Building great and affordable cars is our foundation. (22%)",
1768
+ "Our beginnings are a unique combination of investors and unions, and today 9 of our 20 board members are staff representatives. (18%)",
1769
+ ],
1770
+ "Benefit": [
1771
+ "We bring together the world's best talent in many disciplines to create your cars. (23%)",
1772
+ "We strongly focus on keeping and nurturing our team and have a 99.5% retention rate. (18%)",
1773
+ "Employees are provided with extensive continuous training. (16%)",
1774
+ ],
1775
+ "Vision": [
1776
+ "Our brands are ranked No. 2 and 5 in the reliability rankings. (27%)",
1777
+ "Our technology and manufacturing capabilities are second to none. (22%)",
1778
+ "We produce almost 9 million cars per year. (15%)",
1779
+ ],
1780
+ },
1781
+ "VW Prospects": {
1782
+ "Stability": [
1783
+ "We work with our unions in our restructuring and future plans. (21%)",
1784
+ "We have learned from our mistakes in the Diesel Affair and made fundamental changes. (19%)",
1785
+ "Building great and affordable cars is our foundation. (18%)",
1786
+ ],
1787
+ "Relationship": [
1788
+ "We put a lot of emphasis on the interior experience and two of our cars have been ranked in the top 10. (24%)",
1789
+ "We are at the forefront of technology to deliver better cars and driving experiences. (17%)",
1790
+ "Our beginnings are a unique combination of investors and unions, and today 9 of our 20 board members are staff representatives. (17%)",
1791
+ ],
1792
+ "Competence": [
1793
+ "At the heart of our decision-making is the long-term quality of life for all of us. (20%)",
1794
+ "We put a lot of emphasis on the interior experience and two of our cars have been ranked in the top 10. (19%)",
1795
+ "We are one of the longest-established car companies. (18%)",
1796
+ ],
1797
+ },
1798
+ }
1799
 
1800
+ # Retrieve relevant data
1801
+ if selected_dataset_ai in datasets:
1802
+ trust_data = datasets[selected_dataset_ai]
1803
+ else:
1804
+ return "Error: Invalid dataset selection."
1805
+
1806
+ # Prepare response with top-scoring statements
1807
+ response = f"**Selected Dataset: {selected_dataset_ai}**\n\n"
1808
+ for bucket, statements in trust_data.items():
1809
+ response += f"**{bucket}**\n"
1810
+ for statement in statements:
1811
+ response += f"- {statement}\n"
1812
+
1813
+ # Generate AI output using agent_executor
1814
+ output = agent_executor.invoke({"input": message, "chat_history": history})
1815
+
1816
+ # Append the generated output to the response
1817
+ response += f"\n\n{output['output']}"
1818
+
1819
+ # Generate Trust Tip and Suggestion
1820
  trust_tip, suggestion = get_trust_tip_and_suggestion()
1821
+
 
 
 
1822
  # Add Trust Tip and Suggestion if not already in history
1823
  if not any(f"**Trust Tip**: {trust_tip}" in entry["bot"] and f"**Suggestion**: {suggestion}" in entry["bot"] for entry in history):
1824
  response += f"\n\n---\n\n**Trust Tip**: {trust_tip}\n\n**Suggestion**: {suggestion}"
1825
+
1826
+
1827
  # Save the interaction context
1828
  history.extend(
1829
  [