Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1550,7 +1550,7 @@ You are an expert copywriter specializing in creating high-quality marketing con
|
|
| 1550 |
1. If `DATAFRAME_PROOF_POINT` is empty:
|
| 1551 |
- Respond: "Trust Builder information is not provided. Generating content based on general knowledge."
|
| 1552 |
- Create content using general knowledge.
|
| 1553 |
-
|
| 1554 |
- For each of the six Trust Buckets, list exactly **3 TrustBuilders®**,
|
| 1555 |
- Use the following format to display top-scoring statements:
|
| 1556 |
Top-scoring statements
|
|
@@ -1559,8 +1559,8 @@ You are an expert copywriter specializing in creating high-quality marketing con
|
|
| 1559 |
- TrustBuilder® Statement 2 [Percentage]
|
| 1560 |
- TrustBuilder® Statement 3 [Percentage]
|
| 1561 |
```
|
| 1562 |
-
|
| 1563 |
-
- Display unique Top-Scoring Statements:
|
| 1564 |
- Donot repeat a trustbuilder.
|
| 1565 |
- List the top three TrustBuilders® for each of the six Trust Buckets in the format:
|
| 1566 |
**Bucket Name**
|
|
@@ -1571,11 +1571,9 @@ You are an expert copywriter specializing in creating high-quality marketing con
|
|
| 1571 |
- Integrate **all listed TrustBuilders®** into the requested content format. Strictly minimum 9 trust statements must be used to make content longer.
|
| 1572 |
- Do not omit any TrustBuilders®—all must be actively and explicitly included in the content.
|
| 1573 |
- Maintain a **longer and detailed response**, using all the provided Trust statements to ensure comprehensive coverage.
|
| 1574 |
-
|
| 1575 |
-
|
| 1576 |
-
|
| 1577 |
-
- Exactly **3 TrustBuilders®** must be listed for each Trust Bucket, even if percentages are below 18%.
|
| 1578 |
-
- Ensure consistency in the format.
|
| 1579 |
**Content Guidelines**
|
| 1580 |
Use **all TrustBuilders®** in the content and make it longer.
|
| 1581 |
**General Rules**
|
|
@@ -1592,7 +1590,6 @@ Use **all TrustBuilders®** in the content and make it longer.
|
|
| 1592 |
- Heuristics Used: List 3-5 relevant heuristics.
|
| 1593 |
- Creative Techniques Used: Mention and explain any metaphor, analogy, or creative technique employed.
|
| 1594 |
2. **Sales Conversations/Ad Copy**
|
| 1595 |
-
-
|
| 1596 |
- Structure:
|
| 1597 |
Detailed conversation.
|
| 1598 |
- Intro line: "Here is a draft of your [Sales Conversation/Ad Copy]. Feel free to suggest further refinements."
|
|
@@ -1708,28 +1705,6 @@ def get_trust_tip_and_suggestion():
|
|
| 1708 |
|
| 1709 |
|
| 1710 |
|
| 1711 |
-
def extract_top_scoring_statements(df_builder_pivot_str, buckets_to_include):
|
| 1712 |
-
"""
|
| 1713 |
-
Extracts top-scoring statements for the given trust buckets.
|
| 1714 |
-
Args:
|
| 1715 |
-
df_builder_pivot_str: The computed dataframe proof point string.
|
| 1716 |
-
buckets_to_include: List of trust buckets to include in the response.
|
| 1717 |
-
Returns:
|
| 1718 |
-
A formatted string of top-scoring statements.
|
| 1719 |
-
"""
|
| 1720 |
-
try:
|
| 1721 |
-
# Filter the dataframe for the required buckets
|
| 1722 |
-
filtered_df = df_builder_pivot_str[df_builder_pivot_str["Bucket"].isin(buckets_to_include)]
|
| 1723 |
-
|
| 1724 |
-
# Sort and extract top-scoring statements
|
| 1725 |
-
top_statements = filtered_df.sort_values(by="Score", ascending=False).groupby("Bucket").head(1)
|
| 1726 |
-
return top_statements.to_string(index=False)
|
| 1727 |
-
except Exception as e:
|
| 1728 |
-
logger.error(f"Error extracting top-scoring statements: {e}")
|
| 1729 |
-
return "No top-scoring statements available."
|
| 1730 |
-
|
| 1731 |
-
|
| 1732 |
-
|
| 1733 |
def chatbot_response(message, history):
|
| 1734 |
global selected_dataset_ai
|
| 1735 |
global df_builder_pivot_str
|
|
@@ -1742,7 +1717,7 @@ def chatbot_response(message, history):
|
|
| 1742 |
|
| 1743 |
output = agent_executor.invoke({"input": message, "chat_history": chat_history})
|
| 1744 |
trust_tip, suggestion = get_trust_tip_and_suggestion()
|
| 1745 |
-
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}
|
| 1746 |
|
| 1747 |
|
| 1748 |
# Add Trust Tip and Suggestion if not already in history
|
|
|
|
| 1550 |
1. If `DATAFRAME_PROOF_POINT` is empty:
|
| 1551 |
- Respond: "Trust Builder information is not provided. Generating content based on general knowledge."
|
| 1552 |
- Create content using general knowledge.
|
| 1553 |
+
**Listing Top-Scoring Statements**
|
| 1554 |
- For each of the six Trust Buckets, list exactly **3 TrustBuilders®**,
|
| 1555 |
- Use the following format to display top-scoring statements:
|
| 1556 |
Top-scoring statements
|
|
|
|
| 1559 |
- TrustBuilder® Statement 2 [Percentage]
|
| 1560 |
- TrustBuilder® Statement 3 [Percentage]
|
| 1561 |
```
|
| 1562 |
+
If `DATAFRAME_PROOF_POINT` is present:
|
| 1563 |
+
- Display unique Top-Scoring Statements at start:
|
| 1564 |
- Donot repeat a trustbuilder.
|
| 1565 |
- List the top three TrustBuilders® for each of the six Trust Buckets in the format:
|
| 1566 |
**Bucket Name**
|
|
|
|
| 1571 |
- Integrate **all listed TrustBuilders®** into the requested content format. Strictly minimum 9 trust statements must be used to make content longer.
|
| 1572 |
- Do not omit any TrustBuilders®—all must be actively and explicitly included in the content.
|
| 1573 |
- Maintain a **longer and detailed response**, using all the provided Trust statements to ensure comprehensive coverage.
|
| 1574 |
+
|
| 1575 |
+
|
| 1576 |
+
|
|
|
|
|
|
|
| 1577 |
**Content Guidelines**
|
| 1578 |
Use **all TrustBuilders®** in the content and make it longer.
|
| 1579 |
**General Rules**
|
|
|
|
| 1590 |
- Heuristics Used: List 3-5 relevant heuristics.
|
| 1591 |
- Creative Techniques Used: Mention and explain any metaphor, analogy, or creative technique employed.
|
| 1592 |
2. **Sales Conversations/Ad Copy**
|
|
|
|
| 1593 |
- Structure:
|
| 1594 |
Detailed conversation.
|
| 1595 |
- Intro line: "Here is a draft of your [Sales Conversation/Ad Copy]. Feel free to suggest further refinements."
|
|
|
|
| 1705 |
|
| 1706 |
|
| 1707 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1708 |
def chatbot_response(message, history):
|
| 1709 |
global selected_dataset_ai
|
| 1710 |
global df_builder_pivot_str
|
|
|
|
| 1717 |
|
| 1718 |
output = agent_executor.invoke({"input": message, "chat_history": chat_history})
|
| 1719 |
trust_tip, suggestion = get_trust_tip_and_suggestion()
|
| 1720 |
+
response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}"
|
| 1721 |
|
| 1722 |
|
| 1723 |
# Add Trust Tip and Suggestion if not already in history
|