File size: 13,344 Bytes
cfd5951
e5f3c6a
fe32b1a
e5f3c6a
7bbab48
e71660c
c40e1d2
0d09775
 
a1b20d6
85b56ea
8b8bed5
3e674b0
 
8b8bed5
 
 
e14ff63
8b8bed5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85b56ea
a1b20d6
 
e5f3c6a
 
7bbab48
3e674b0
 
 
 
 
4dad20a
953e4dd
ed456c3
4ec8cf6
 
854a64a
9a0170b
 
 
 
 
 
 
 
 
854a64a
1d3d947
 
 
79e4375
4ec8cf6
c7c4d1d
9a0170b
79e4375
854a64a
 
 
 
 
 
79e4375
854a64a
 
ed456c3
 
 
 
 
 
1d3d947
 
 
ed456c3
 
 
 
 
 
 
 
 
 
 
 
 
 
fa7c9d6
ed456c3
fa7c9d6
55f68a5
 
1d3d947
fa7c9d6
 
 
 
 
 
 
 
 
 
ed456c3
 
2355d92
 
1d3d947
 
55f68a5
2355d92
 
 
 
1d3d947
 
2355d92
 
 
 
 
 
 
 
 
 
 
 
 
 
7e88bcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed456c3
7e88bcf
de20879
ed456c3
 
 
 
 
854a64a
 
fa7c9d6
 
2355d92
 
7e88bcf
 
fa7c9d6
854a64a
 
 
da42800
 
3e674b0
 
da42800
 
 
 
 
 
 
 
 
 
 
 
 
cb2c907
da42800
 
d2088dd
da42800
 
 
 
 
 
953e4dd
e5f3c6a
6459d21
48f1b79
a1b20d6
d346a00
 
 
48f1b79
 
 
 
 
 
 
 
324f291
48f1b79
 
 
 
 
 
 
 
 
d346a00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766d59f
d346a00
 
 
 
 
 
 
 
 
915d4f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766d59f
915d4f9
 
 
 
 
d346a00
48f1b79
df7b089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81f213b
df7b089
 
 
 
 
 
 
 
819e178
df7b089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81f213b
df7b089
 
 
 
 
819e178
 
 
 
 
 
e5f3c6a
 
 
8b8bed5
 
e5f3c6a
8b8bed5
6cb1bc5
e6cd17a
 
e5f3c6a
da42800
48f1b79
 
 
d346a00
 
915d4f9
 
 
df7b089
 
 
 
92e0476
e5f3c6a
6cb1bc5
819e178
a25c2ae
819e178
0d09775
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
import streamlit as st
from langchain.chains import LLMChain, SimpleSequentialChain
from langchain.memory import SimpleMemory
from langchain.prompts import PromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain_google_genai import ChatGoogleGenerativeAI




def generate_event_name(topic, audience, benefit):
    # Initialize the LLM with GPT-4 chat model
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    # llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])

    # Define the template for generating the event name
    event_name_template = (
        "Generate an event name that combines the topic:{topic},audience:{audience}, and benefit: {benefit}. "
        "The format should be ‘[Masterclass/Workshop/Bootcamp] on [topic] for [audience] to [benefit]’. "
        "Make sure the name is engaging and highlights the value."
    )

    # Format the event name template using PromptTemplate
    event_name_prompt = PromptTemplate(template=event_name_template).format(
        topic=topic,
        audience=audience,
        benefit=benefit
    )

    # Generate the event name using the LLM
    event_name_response = llm.invoke(event_name_prompt)

    # Return the generated event name
    return event_name_response.content




def ai_generated_content(topic, audience, benefit, date_time, event_name):

    
    
    # Initialize the LLM and memory
    # llm = OpenAI(model="gpt-4",openai_api_key=st.secrets["OPENAI_API_KEY"])
    llm = ChatOpenAI(
        model="gpt-4", 
        openai_api_key=st.secrets["OPENAI_API_KEY"]  # Fetch API key from Streamlit secrets
    )
    # llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])


    # hero-section headline


    # Define the template for the headline section



    # Break down the benefit into immediate benefit and major goal
    immediate_benefit = f"quickly {benefit.lower()}"  # Assume a quick win as the immediate benefit
    major_goal = f"achieve long-term {benefit.lower()}"  # Assume a more significant goal as the major benefit


    
    headline_template = (
        f"Generate a concise and engaging headline in the following format: "
        f"MASTER {topic} IN 30 Days USING Proven Strategies TO {immediate_benefit} "
        f"AND FINALLY {major_goal}, GUARANTEED!"
    )

    
    

    # Format the headline template using PromptTemplate
    headline_prompt = PromptTemplate(template=headline_template).format(
        topic=topic,
        immediate_benefit=immediate_benefit,
        major_goal=major_goal
    )

    # Generate the response using the LLM
    headline_response = llm.invoke(headline_prompt)



    # hero -section sub-headline_prompt

    subheadline_template = (
        f"Generate a subheading that reassures the user they don’t need any prior "
        f"knowledge in {topic} or experience in achieving {benefit}. The "
        f"format should be ‘WITHOUT ANY PRIOR {topic}-RELATED SKILLS OR EXPERIENCE’. "
    )

    # Format the subheadline template using PromptTemplate
    subheadline_prompt = PromptTemplate(template=subheadline_template).format(
        topic=topic,
        benefit=benefit
    )

    # Generate the response using the LLM
    subheadline_response = llm.invoke(subheadline_prompt)




    # hero section price

    price_statement_template = (
        f"Generate a short value statement that combines the outcome  "
        f"The format should be: "
        f"‘Become an advanced {topic} expert in Rs.1999.’ Use language that emphasizes the low cost for high-value results."
    )

    # Format the price statement template using PromptTemplate
    price_statement_prompt = PromptTemplate(template=price_statement_template).format(
        topic=topic,
     
    )

    # Generate the response using the LLM
    price_statement_response = llm.invoke(price_statement_prompt)


    # Define the template for the primary CTA button based on the PDF reference
    cta_button_template = (
        f"Generate a call-to-action button text that encourages users to take immediate "
        f"action, focusing on urgency and the value they will receive. The format should be "
        f"bold and action-oriented.eg ‘Become a Certified {topic} Expert Now!’."
    )

    # Define the template for the offer validity or urgency statement based on the PDF reference
    urgency_statement_template = (
        f"Write a short statement that creates urgency for the offer (e.g., ‘Offer Valid Only "
        f"For Today’ or ‘Limited Slots Available’). The tone should be urgent but reassuring."
    )

    # Format the CTA button and urgency statement using PromptTemplate
    cta_button_prompt = PromptTemplate(template=cta_button_template).format(
        topic=topic
    )
    urgency_statement_prompt = PromptTemplate(template=urgency_statement_template).format()

    # Generate the responses using the LLM
    cta_button_response = llm.invoke(cta_button_prompt)
    urgency_statement_response = llm.invoke(urgency_statement_prompt)



    # Define the template for the benefits section with the specific format
    benefits_template = (
        "List 6 benefits of {topic} for {audience}. Each benefit should be written in the format: "
        "‘[Mini-Headline]: [Detailed Benefit Description].’ The mini-headline should highlight a key feature like a number or "
        "a unique aspect of the {topic}, and the detailed benefit should explain the value or outcome in a single line."
    )

    # Format the benefits template using PromptTemplate
    benefits_prompt = PromptTemplate(template=benefits_template).format(
        topic=topic,
        audience=audience
    )

    # Generate the benefits using the LLM
    benefits_response = llm.invoke(benefits_prompt)

    # Split the benefits into individual lines
    benefits = benefits_response.content




    

    # Return the generated headline
    return {"headline": headline_response.content,
            "subheadline":subheadline_response.content,
            "price_statement": price_statement_response.content,
            "cta_button": cta_button_response.content,
            "urgency_statement": urgency_statement_response.content,
            "benefits":benefits
           }



def generate_first_person_benefits(benefits):
    # Initialize the LLM with GPT-4 chat model
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    # llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])

    # Define the prompt template
    prompt_template = """
    Rephrase the following benefits in the first-person point of view. 
    Make the statements sound needy, focusing on personal challenges, goals, or desires. 
    The output should use varied sentence structures, but all should reflect a sense of urgency or a strong personal need.

    Benefits:
    {benefits}

    Rephrased Benefits (in First-Person):
    """



    # Prepare the prompt using the benefits text
    prompt = PromptTemplate(template=prompt_template).format(benefits=benefits)

    # Generate the response using the LLM
    response = llm.invoke(prompt)

    # Return the rephrased benefits as a list by splitting them by new lines
    return response.content                                                                                   
    


def what_if_told_you(topic,audience,key_benefits):


    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])

    prompt_template = """
    WHAT IF I TOLD YOU…
    
    Imagine being able to {key_benefits}, and doing all of this with ease, even if you have no prior experience in {topic}. YES, it’s that simple, and it's specifically designed for {audience} like you!
    
    Join The LIVE {topic} Workshop Tailored For {audience}!
    """

    prompt = PromptTemplate(template=prompt_template).format(key_benefits=key_benefits,topic=topic,audience=audience)

    # Generate the response using the LLM
    response = llm.invoke(prompt)

    # Return the rephrased benefits as a list by splitting them by new lines
    return response.content  

    



def generate_bonuses_llm(benefits):
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    
    # Define the prompt template
    prompt_template = """
    Based on the following benefits, create 4 bonuses that align with these benefits. Each bonus should be a digital product with a title, a short description, and an estimated value in INR (Indian Rupees).

    Benefits:
    {benefits}

    Format:
    Bonus 1
    Title: [Title of the bonus]
    Description: [Short description of what the bonus offers]
    Value: [Estimated value in INR]

    Bonus 2
    Title: [Title of the bonus]
    Description: [Short description of what the bonus offers]
    Value: [Estimated value in INR]

    Bonus 3
    Title: [Title of the bonus]
    Description: [Short description of what the bonus offers]
    Value: [Estimated value in INR]

    Bonus 4
    Title: [Title of the bonus]
    Description: [Short description of what the bonus offers]
    Value: [Estimated value in INR]
    """

    # Format the prompt with the provided benefits
    formatted_prompt = PromptTemplate(template=prompt_template).format(benefits=benefits)

    # Generate the bonuses using the LLM
    response = llm.invoke(formatted_prompt)

    return response.content




def generate_appreciative_testimonials_llm(benefits):
    # Initialize the LLM
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    
    # Define the prompt template
    prompt_template = """
    Based on the following benefits of a course, generate 4 realistic and natural-sounding testimonials that appreciate the instructor and highlight how helpful the course was. Avoid using the exact benefits in the statements. Instead, focus on the positive experience, the quality of teaching, and the practical impact of the course.

    Benefits:
    {benefits}

    Generate the testimonials separated by newline characters:
    """

    # Format the prompt with the provided benefits
    formatted_prompt = PromptTemplate(template=prompt_template).format(benefits=benefits)

    # Generate the testimonials using the LLM
    response = llm.invoke(formatted_prompt)

    return response.content

    
def generate_workshop_audience_llm(benefits,topic):
    # Initialize the LLM
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    
    # Define the prompt template
    prompt_template = """
    Based on the following benefits of a course on {topic}, generate a section for "Who is this Workshop For?" including a headline and a bulleted list of 16 audience types who would benefit from the workshop. Only include the audience types, no descriptions.

    Benefits:
    {benefits}

    Format:
    Headline:
    [Write a headline that introduces the target audience for the workshop]

    Audience List:
    Generate the audience list separated by newline characters:
    """

    # Format the prompt with the provided benefits
    formatted_prompt = PromptTemplate(template=prompt_template).format(benefits=benefits,topic=topic)

    # Generate the audience section using the LLM
    response = llm.invoke(formatted_prompt)

    return response.content




def generate_workshop_faqs_llm(benefits,topic):
    # Initialize the LLM
    llm = ChatOpenAI(model="gpt-4", openai_api_key=st.secrets["OPENAI_API_KEY"])
    
    # Define the prompt template
    prompt_template = """
    Based on the following benefits of a course on {topic}, generate 6 frequently asked questions (FAQs) along with their answers for a workshop. The FAQs should be relevant to the target audience and address common concerns, providing clear and concise responses.

    Benefits:
    {benefits}

    Format for FAQs:
    FAQ 1:
    Q: [Question]
    A: [Answer]

    FAQ 2:
    Q: [Question]
    A: [Answer]

    Continue for a total of 6 FAQs.
    """

    # Format the prompt with the provided benefits
    formatted_prompt = PromptTemplate(template=prompt_template).format(benefits=benefits,topic=topic)

    # Generate the FAQs using the LLM
    response = llm.invoke(formatted_prompt)

    return response.content


def generate_workshop_details(topic, audience, benefit, date_time):
    if not (topic and audience and benefit and date_time):
        return "All details are required to generate the workshop information."

    
    
    
    # Generate the event name using the model
    event_name = generate_event_name(topic, audience, benefit)
    
    details = ai_generated_content(topic, audience, benefit, date_time,event_name)

    details["event_name"] = event_name

    
    details['first_person_benefits'] = generate_first_person_benefits(details['benefits'])


    details['What_if'] = what_if_told_you(topic,audience,details['benefits'])

    details['bonuses'] = generate_bonuses_llm(details['benefits'])


    details['testimonials'] = generate_appreciative_testimonials_llm(details['benefits'])

    details['audience_list'] = generate_workshop_audience_llm(details['benefits'],topic)

    details['faqs'] = generate_workshop_faqs_llm(details['benefits'],topic)

    
  

    return details