Wajahat698 commited on
Commit
4621a85
·
verified ·
1 Parent(s): e830d15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -45
app.py CHANGED
@@ -1332,17 +1332,16 @@ Replace vague phrases with specific details:
1332
  *"Here is a draft of your newsletter. Feel free to suggest further refinements."*
1333
 
1334
  - **Headlines and Subheadings**:
1335
- - Write **engaging, active headlines** summarizing each section (e.g., "Investing in Your Future").
1336
- - Use **"you" and "your"** for a personal, reader-focused tone.
1337
- - Ensure paragraphsand trustbuilders are **interconnected ** contextually for a seamless, cohesive narrative.
1338
 
1339
  - **Body Content**:
1340
- - Focus on **specifics**: Include **names, numbers, programs, and awards**.
1341
- - **Integrate TrustBuilders® naturally**: Weave them into the text without isolating them.
1342
 
1343
- - **Conclusion**:
1344
- - End with a **strong Call-to-Action (CTA)**
1345
 
 
 
1346
 
1347
  #### 1. Report/Article/writeup/blog
1348
  - **Introduction**: Start with "Here is a draft of your [Annual Report/Article/writeup]. Feel free to suggest further refinements."
@@ -1500,7 +1499,7 @@ prompt_template = ChatPromptTemplate.from_messages([
1500
  # Create Langchain Agent
1501
  llm = ChatOpenAI(
1502
  model="gpt-4o",
1503
- temperature=0.6, # Balanced creativity and adherence
1504
  max_tokens=3000, # Ensure sufficient output length
1505
  top_p=0.85, # Focused outputs
1506
  frequency_penalty=0.1, # Minimize repetition
@@ -2230,7 +2229,6 @@ def handle_prompt(prompt):
2230
 
2231
  # """
2232
  base_instructions = """
2233
-
2234
  **General Guidelines**:
2235
  - Use **clear, professional language** without exaggerated expressions or AI jargon (e.g., "beacon," "realm," "exemplifies").
2236
  - Always include **specific numbers, names, dollar amounts, programs, awards, and actions** when identifying TrustBuilders®.
@@ -2245,15 +2243,12 @@ def handle_prompt(prompt):
2245
 
2246
  **Formatting and Accuracy**:
2247
  - Ensure responses are properly formatted and free of errors.
2248
- - Respond in the same language as the query.
2249
  - Provide **accurate source links** for all TrustBuilders® mentioned in a separate section.
2250
 
2251
  **Avoid**:
2252
- - Flowery language or AI-specific phrases.
2253
- - Isolated facts—ensure logical connections between ideas to maintain flow and thematic consistency.
2254
- - Repetition or mechanical structures.
2255
-
2256
- """
2257
 
2258
 
2259
 
@@ -2261,36 +2256,24 @@ def handle_prompt(prompt):
2261
  # Check if user request includes blog, article, or newsletter
2262
  if any(keyword in prompt.lower() for keyword in ["blog", "write","article","annual report","report", "newsletter","news letter ","website introduction"]):
2263
  appended_instructions = (
2264
- "Craft a seamless, compelling, and professional newsletter using *clear, precise language* that feels like the work of an experienced copywriter. "
2265
- "The tone should be conversational yet professional, avoiding jargon, vague expressions, or overly formal language. Follow these enhanced guidelines to ensure the newsletter flows naturally and engages the reader: "
2266
-
2267
- "1. **Deep Interconnection**: Structure the newsletter so that each paragraph connects logically to the next, ensuring a cohesive flow. Avoid standalone paragraphs or disjointed sections. Each idea should build on the last, weaving a single, unified narrative throughout. "
2268
-
2269
- "2. **TrustBuilders® Integration**: Integrate TrustBuilders® naturally into the content without isolating them or explicitly listing them. Embed them in engaging sentences that strengthen the narrative and build credibility without breaking the flow. "
2270
-
2271
- "3. **Storytelling with Emotional Appeal**: Use relatable examples and emotionally resonant storytelling to draw the reader in. Highlight the human impact of initiatives or projects to create a strong emotional connection. Avoid technical jargon and focus on making the content feel personal and impactful. "
2272
-
2273
- "4. **Active Headlines and Subheadings**: Use concise, action-oriented headlines and subheadings for each paragraph to guide the reader. Headlines should summarize the content and entice the reader to continue. Avoid vague or generic phrasing like 'Empowering Communities' and instead use specific, engaging language. "
2274
-
2275
- "5. **Engaging Transitions**: Ensure smooth transitions between sections so that the newsletter reads as one cohesive piece. For example, use phrases like, *'Building on this foundation...' or 'Extending the impact of our earlier initiatives...' to maintain narrative momentum.* "
2276
-
2277
- "6. **Reader-Centric Focus**: Tailor the content to resonate with the audience’s needs, challenges, and aspirations. Include actionable insights and calls-to-action that inspire readers to get involved, whether through donating, volunteering, or learning more. "
2278
-
2279
- "7. **Purpose-Driven Clarity**: Ensure every paragraph and section reinforces the core message of the newsletter—whether to inform, inspire, or persuade. Avoid redundant details or tangents that detract from the focus. "
2280
-
2281
- "8. **Polished and Professional Presentation**: Deliver a refined, error-free final copy that is ready for publication. Use active voice consistently and ensure every paragraph demonstrates mastery of language and storytelling techniques. "
2282
-
2283
- "9. **Creative Techniques and Heuristics**: "
2284
- " - In a separate section, list 'TrustBuilders Used' with source links to enhance credibility. "
2285
- " - Include heuristics (e.g., social proof, authority, commitment) and creative techniques (e.g., storytelling, vivid imagery) in a footnote-style format. "
2286
-
2287
- "10. **Structure-Specific Rules for Newsletters**: "
2288
- " - Headlines and subheadings must precede each paragraph, summarizing the content in a compelling way. "
2289
- " - Avoid direct references to TrustBuckets in headings or the body of the newsletter. "
2290
- " - Ensure the newsletter feels like a continuous narrative, not a series of independent sections or blocks. "
2291
- " - Do not explicitly list TrustBuilders in the main body; weave them seamlessly into the narrative. "
2292
-
2293
- "11. **MOST IMPORTANT RULE**: The newsletter must have a seamless flow, ensuring every section connects naturally. Avoid isolated paragraphs or mechanical structures that make the content feel fragmented. The content should flow as a single, interconnected piece, engaging the reader from start to finish and delivering a clear, impactful message."
2294
  )
2295
  else:
2296
  appended_instructions = ""
 
1332
  *"Here is a draft of your newsletter. Feel free to suggest further refinements."*
1333
 
1334
  - **Headlines and Subheadings**:
1335
+ - Use **engaging, action-oriented headlines** that summarize each section clearly.
1336
+ - Incorporate **"you" and "your"** to make the tone reader-focused and personal.
1337
+
1338
 
1339
  - **Body Content**:
1340
+ -**Integrate TrustBuilders® seamlessly**: Embed them naturally into paragraphs to ensure they support the narrative without standing out as isolated facts.AVOID DISJOINTED PARAGRAPHS.
 
1341
 
 
 
1342
 
1343
+ - **Conclusion**:
1344
+ - End with a **strong, actionable Call-to-Action (CTA)** that motivates the reader to engage. Use inclusive and inspiring language that ties back to the newsletter’s purpose.
1345
 
1346
  #### 1. Report/Article/writeup/blog
1347
  - **Introduction**: Start with "Here is a draft of your [Annual Report/Article/writeup]. Feel free to suggest further refinements."
 
1499
  # Create Langchain Agent
1500
  llm = ChatOpenAI(
1501
  model="gpt-4o",
1502
+ temperature=0.5, # Balanced creativity and adherence
1503
  max_tokens=3000, # Ensure sufficient output length
1504
  top_p=0.85, # Focused outputs
1505
  frequency_penalty=0.1, # Minimize repetition
 
2229
 
2230
  # """
2231
  base_instructions = """
 
2232
  **General Guidelines**:
2233
  - Use **clear, professional language** without exaggerated expressions or AI jargon (e.g., "beacon," "realm," "exemplifies").
2234
  - Always include **specific numbers, names, dollar amounts, programs, awards, and actions** when identifying TrustBuilders®.
 
2243
 
2244
  **Formatting and Accuracy**:
2245
  - Ensure responses are properly formatted and free of errors.
2246
+ - Respond in the same language as the user query.
2247
  - Provide **accurate source links** for all TrustBuilders® mentioned in a separate section.
2248
 
2249
  **Avoid**:
2250
+ - Flowery language or AI-specific phrases."""
2251
+
 
 
 
2252
 
2253
 
2254
 
 
2256
  # Check if user request includes blog, article, or newsletter
2257
  if any(keyword in prompt.lower() for keyword in ["blog", "write","article","annual report","report", "newsletter","news letter ","website introduction"]):
2258
  appended_instructions = (
2259
+ "Craft a flawless,flowing, engaging, and fluid compelling copy using *non-flowery language* that reads as though written by a professional copywriter having 25 years of experience. "
2260
+ "Do not use AI jargon, vague phrases, or formal language.Donot mention trustbucket names in the headings and content. Follow these enhanced guidelines to ensure a polished, publication-ready copy with a 10/10 quality: "
2261
+ "1. **Interconnected Structure**: Ensure all sections and ideas flow seamlessly with logical transitions between paragraphs. Build a cohesive narrative where every part supports the overall theme, reinforcing the message at every step. "
2262
+ "3. **Seamless Integration of TrustBuilders®**: Naturally incorporate TrustBuilders® into the narrative without isolating or explicitly listing them in the main body. Instead, weave them fluidly into sentences to build credibility and trust while maintaining the content’s readability and engagement. "
2263
+ "4. **Human Tone**: Write in a relatable, conversational tone that engages the reader and feels natural. Avoid repetitive phrasing, overly technical explanations, or mechanical structures. Use active voice consistently, ensuring the tone is both approachable and professional."
2264
+ "5. **Audience-Centric Engagement**: Tailor the content to meet the audience's needs, goals, and challenges. Create emotional connections by using relatable examples, vivid imagery, and direct appeals. Emphasize actionable insights and practical relevance to ensure the audience feels seen and understood."
2265
+ "6. **Enhanced Audience Engagement**: Use storytelling techniques and mix the trustbuilders into a content. Begin with a compelling hook, maintain momentum through transitions, and conclude with a strong call-to-action that inspires the reader to act or reflect. "
2266
+ "7. **Purpose-Driven Impact**: Clearly define and achieve the content’s purpose—whether to inform, persuade, or inspire action. Ensure every paragraph serves the overall objective while reinforcing the key message. "
2267
+ "8. **Polished Presentation**: Ensure the final output is refined, professional, and suitable for publication. The copy should demonstrate mastery of language and content design, leaving no room for ambiguity or errors. "
2268
+ "dont give source link in content"
2269
+ "1. ##List of TrustBuilders Used: Provide trustbuilders used followed by *Source links always*"
2270
+ " 2. ##Heuristics and Creative Techniques :"
2271
+ " -List them in a footnote-style small heading."
2272
+ " Use the following structure:"
2273
+ " -Heuristics: Mention names only like examples (e.g., social proof, authority, commitment)."
2274
+ " -Creative Techniques: Mention names onlyexamples (list only relevant marketing techniques without additional details)."
2275
+ "The final output must not include AI jargons. *With every paragraph give a creative headline that summarises the content give sub-headlines with each paragraph like example headline: Drive,empower use similar words but no driving, empowering etc *. Avoid mentioning trustbucket names."
2276
+ "MOST IMPORTANT RULE. IN EVERY PARAGRAPH Strengthen the connections between sections to ensure smoother flow and SHOULD BE DEEPLY INTERCONNECTED WITH EACH OTHER TO CREATE A SEAMLESS FLOW, MAKING THE CONTENT READ LIKE A SINGLE CONTENT RATHER THAN DISJOINTED PARAGRAPHS OR INDEPENDENT BLOG SECTIONS. EACH SECTION MUST LOGICALLY TRANSITION INTO THE NEXT, ENSURING THAT THE TOPIC REMAINS CONSISTENT AND RELEVANT THROUGHOUT. BY MAINTAINING A COHESIVE STRUCTURE, THE ARTICLE WILL ENGAGE READERS MORE EFFECTIVELY, HOLDING THEIR ATTENTION AND CONVEYING THE INTENDED MESSAGE WITH CLARITY AND IMPACT."
 
 
 
 
 
 
 
 
 
 
 
 
2277
  )
2278
  else:
2279
  appended_instructions = ""