Update post_generator.py
Browse files- post_generator.py +10 -23
post_generator.py
CHANGED
@@ -91,38 +91,25 @@ def generate_post(length, language, tag, selected_tone=None):
|
|
91 |
return post_content
|
92 |
|
93 |
|
94 |
-
def get_prompt(length, language, tag
|
95 |
length_str = get_length_str(length)
|
96 |
|
97 |
-
|
98 |
-
prompt = f"""
|
99 |
Write a professional, engaging LinkedIn post.
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
"""
|
106 |
|
107 |
-
if custom_context:
|
108 |
-
prompt += f'- Additional Context: "{custom_context}"\n'
|
109 |
-
|
110 |
-
prompt += """
|
111 |
-
The post should:
|
112 |
-
1. Start with an engaging introduction or relatable statement.
|
113 |
-
2. Provide useful insights, examples, or tips.
|
114 |
-
3. End with a motivational or actionable closing statement.
|
115 |
-
"""
|
116 |
-
|
117 |
-
# Add examples
|
118 |
examples = few_shot.get_filtered_posts(length, language, tag)
|
119 |
if examples:
|
120 |
prompt += "\nExamples of great posts:\n"
|
121 |
for i, post in enumerate(examples[:2]): # Limit to 2 examples
|
122 |
post_text = post['text']
|
123 |
-
prompt += f"Example {i + 1}
|
124 |
-
|
125 |
-
prompt += "\nNow write the
|
126 |
return prompt
|
127 |
|
128 |
|
|
|
91 |
return post_content
|
92 |
|
93 |
|
94 |
+
def get_prompt(length, language, tag):
|
95 |
length_str = get_length_str(length)
|
96 |
|
97 |
+
prompt = f'''
|
|
|
98 |
Write a professional, engaging LinkedIn post.
|
99 |
+
1. Topic: "{tag}"
|
100 |
+
2. Post Length: "{length_str}"
|
101 |
+
3. Language: "{language}" (Hinglish means Hindi phrases written in English script).
|
102 |
+
4. Incorporate creativity, enthusiasm, emotional appeal, and actionable advice.
|
103 |
+
'''
|
|
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
examples = few_shot.get_filtered_posts(length, language, tag)
|
106 |
if examples:
|
107 |
prompt += "\nExamples of great posts:\n"
|
108 |
for i, post in enumerate(examples[:2]): # Limit to 2 examples
|
109 |
post_text = post['text']
|
110 |
+
prompt += f"Example {i + 1}: {post_text}\n"
|
111 |
+
|
112 |
+
prompt += "\nNow write the post."
|
113 |
return prompt
|
114 |
|
115 |
|