DrishtiSharma commited on
Commit
e1a012a
Β·
verified Β·
1 Parent(s): d6caebb

Update post_generator.py

Browse files
Files changed (1) hide show
  1. post_generator.py +12 -19
post_generator.py CHANGED
@@ -95,28 +95,21 @@ def get_prompt(length, language, tag):
95
  length_str = get_length_str(length)
96
 
97
  prompt = f'''
98
- Generate a LinkedIn post using the below information. No preamble.
99
-
100
- 1) Topic: {tag}
101
- 2) Length: {length_str}
102
- 3) Language: {language}
103
- If Language is Hinglish then it means it is a mix of Hindi and English.
104
- The script for the generated post should always be English.
105
  '''
106
- # prompt = prompt.format(post_topic=tag, post_length=length_str, post_language=language)
107
 
108
  examples = few_shot.get_filtered_posts(length, language, tag)
109
-
110
- if len(examples) > 0:
111
- prompt += "4) Use the writing style as per the following examples."
112
-
113
- for i, post in enumerate(examples):
114
- post_text = post['text']
115
- prompt += f'\n\n Example {i+1}: \n\n {post_text}'
116
-
117
- if i == 1: # Use max two samples
118
- break
119
-
120
  return prompt
121
 
122
 
 
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