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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -37
app.py CHANGED
@@ -1337,7 +1337,7 @@ Replace vague phrases with specific details:
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**:
@@ -1499,7 +1499,7 @@ prompt_template = ChatPromptTemplate.from_messages([
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
@@ -2203,51 +2203,51 @@ def handle_prompt(prompt):
2203
  add_dot_typing_animation()
2204
  display_typing_indicator()
2205
  cleaned_text = ""
2206
- # base_instructions = """
2207
 
2208
- # Avoid Flowery language and ai words.Always include alof of data of numbers,names,dollars, programs ,awards and action when finding trustbuilders from internet.*
2209
 
2210
- # 1. **Adhere to Uploaded Document's Style**:
2211
- # - When asked uploaded files or document means knowledgebase.
2212
- # - Use the uploaded document as a primary guide for writing style, tone, and structure. Just directly give response.
2213
- # - Match formatting such as headings, subheadings, and paragraph styles. If the uploaded document lacks headings, Strictly do not include them in the response.
2214
 
2215
- # 2. **Prioritize Knowledge Base and Internet Sources**:
2216
- # - Use uploaded documents or knowledge base files as the primary source.
2217
- # - Perform a Google search to retrieve valid and correct internet links for references, ensuring only accurate and verified source links are used.
2218
 
2219
- # 3. **Avoid Flowery Language and AI Jargon**:
2220
- # - Use clear, professional language without exaggerated or vague expressions. Avoid jargon like "beacon," "realm," "exemplifies," etc.
2221
 
2222
- # 4. **Ensure Accuracy**:
2223
- # - Provide only verifiable and accurate information. Do not include placeholders, fabricated URLs, or vague references.
2224
 
2225
- # - Give output in proper formatting.
2226
- # - Response in same language in which asked.
2227
- # -Use google to provide accurate sources links containing the trustbuilder text information.
2228
 
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®.
2235
- - Prioritize **accuracy and verification**:
2236
- - Use the uploaded document or knowledge base as the primary source.
2237
- - Validate references via Google search and avoid placeholders or vague sources.
2238
 
2239
- **Adhere to Uploaded Document's Style**:
2240
- 1. Use the document's tone, structure, and formatting as a guide.
2241
- 2. Match headings, subheadings, and paragraph styles exactly.
2242
- 3. If no headings exist in the document, do not include them in the response.
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
 
@@ -2256,7 +2256,7 @@ def handle_prompt(prompt):
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. "
@@ -2273,7 +2273,8 @@ def handle_prompt(prompt):
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 = ""
 
1337
 
1338
 
1339
  - **Body Content**:
1340
+ - **Integration**: Interweave various trust-builder fluidly, focusing on specifics like names, numbers (dollar amounts and years), programs, strategies, places, awards, and actions, **without mentioning prohibited terms**.
1341
 
1342
 
1343
  - **Conclusion**:
 
1499
  # Create Langchain Agent
1500
  llm = ChatOpenAI(
1501
  model="gpt-4o",
1502
+ temperature=0.6, # 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
 
2203
  add_dot_typing_animation()
2204
  display_typing_indicator()
2205
  cleaned_text = ""
2206
+ base_instructions = """
2207
 
2208
+ Avoid Flowery language and ai words.Always include alof of data of numbers,names,dollars, programs ,awards and action when finding trustbuilders from internet.*
2209
 
2210
+ 1. **Adhere to Uploaded Document's Style**:
2211
+ - When asked uploaded files or document means knowledgebase.
2212
+ - Use the uploaded document as a primary guide for writing style, tone, and structure. Just directly give response.
2213
+ - Match formatting such as headings, subheadings, and paragraph styles. If the uploaded document lacks headings, Strictly do not include them in the response.
2214
 
2215
+ 2. **Prioritize Knowledge Base and Internet Sources**:
2216
+ - Use uploaded documents or knowledge base files as the primary source.
2217
+ - Perform a Google search to retrieve valid and correct internet links for references, ensuring only accurate and verified source links are used.
2218
 
2219
+ 3. **Avoid Flowery Language and AI Jargon**:
2220
+ - Use clear, professional language without exaggerated or vague expressions. Avoid jargon like "beacon," "realm," "exemplifies," etc.
2221
 
2222
+ 4. **Ensure Accuracy**:
2223
+ - Provide only verifiable and accurate information. Do not include placeholders, fabricated URLs, or vague references.
2224
 
2225
+ - Give output in proper formatting.
2226
+ - Response in same language in which asked.
2227
+ -Use google to provide accurate sources links containing the trustbuilder text information.
2228
 
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®.
2235
+ # - Prioritize **accuracy and verification**:
2236
+ # - Use the uploaded document or knowledge base as the primary source.
2237
+ # - Validate references via Google search and avoid placeholders or vague sources.
2238
 
2239
+ # **Adhere to Uploaded Document's Style**:
2240
+ # 1. Use the document's tone, structure, and formatting as a guide.
2241
+ # 2. Match headings, subheadings, and paragraph styles exactly.
2242
+ # 3. If no headings exist in the document, do not include them in the response.
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
 
 
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, 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. "
 
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
+
2277
+ "**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.**"
2278
  )
2279
  else:
2280
  appended_instructions = ""