AhmadMustafa commited on
Commit
3c9d498
·
1 Parent(s): 5416d7e

update: live event prompt test

Browse files
Files changed (1) hide show
  1. app.py +40 -31
app.py CHANGED
@@ -383,46 +383,55 @@ Total takes: 2
383
  - [Take 1. <div id='topic' style="display: inline"> 20s at 25:45]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{1245}}&et={{1265}})
384
  - [Take 3 (Best). <div id='topic' style="display: inline"> 5s at 10:13 </div>]({link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618)"""
385
  else:
386
- prompt = f"""<div id="initial_message"> Given the following transcript with Speakers: {", ".join([speaker for speaker in speaker_mapping.values()])}. Transcript:
387
- {transcript}
388
- Analyze all speakers' discussions and list out people, news, events, trends, and sources mentioned. For each speaker, provide at least 3 topics that would make engaging social media clips. Include duration and starting time for each topic.
389
 
390
- Format the output as follows:
391
 
 
392
  **Speaker Name**
393
- 1. [Topic title <div id='topic' style="display: inline"> 12s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{762}})
394
- 2. [Topic title <div id='topic' style="display: inline"> 33s at 14:45 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{885}}&et={{918}})
395
- 3. [Topic title <div id='topic' style="display: inline"> 1m 10s at 16:20 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{980}}&et={{1050}})
396
- 4. [Topic title <div id='topic' style="display: inline"> 25s at 14:00 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{840}}&et={{865}})
397
-
398
- Requirements:
399
- - Only speaker names should be bold using markdown **Name**
400
- - Topic titles should be in normal case (i.e first word of Sentence capital rest small)
401
- - Use timestamp and duration format: HH:MM (Xs) where X is seconds
402
- - Each line should be a clickable link including timestamp and title
403
- - When selecting timestamps, STRICTLY limit the start and end times to contain only the current speaker's continuous dialogue. The timestamp should begin exactly when the current speaker starts talking about that specific topic and end when they finish their point or another speaker begins. Do not include any portions of previous or subsequent speakers' dialogue in the selected time range.
404
- - IN NO CASE should the duration include any overlapping dialogue from other speakers. i.e if you chose 1m 10s at 16:20, 16:20 till 17:30 should only contain the current speaker's dialogue. THIS IS IMPORTANT.
405
- - Convert display timestamps to seconds for URL parameters
406
- Example: 21s at 10:13 in URL would be st=613&et=634
407
-
408
- URL format: {link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{start_time_in_sec}}&et={{end_time_in_sec}}
409
-
410
- Rank topics based on their potential virality and engagement for social media clips. </div>
 
 
 
 
 
 
 
 
411
  """
412
- print(prompt)
413
  completion = client.chat.completions.create(
414
  model="gpt-4o-mini",
415
  messages=[
416
  {
417
  "role": "system",
418
- "content": f"""You are a helpful assistant who is analyzing the transcript. The transcript is for Call ID: {cid}, Session ID: {rsid}, Origin: {origin}, Call Type: {ct}.
419
- These 2 are the most important rules:
420
- - When selecting timestamps, STRICTLY limit the start and end times to contain only the current speaker's continuous dialogue. The timestamp should begin exactly when the current speaker starts talking about that specific topic and end when they finish their point or another speaker begins. Do not include any portions of previous or subsequent speakers' dialogue in the selected time range.
421
- - IN NO CASE should the duration include any overlapping dialogue from other speakers. i.e if you chose 1m 10s at 16:20, 16:20 till 17:30 should only contain the current speaker's dialogue. THIS IS IMPORTANT.
422
- - The length of the social media clips should be atleast 20 seconds and atmost 1 minute.
423
- - Make sure that the topics are engaging and interesting for the social media clips.
424
- - It is not necessary to get 3 topics for each speaker if you dont find any interesting topics for the speaker, but try to get atleast 2 topics, 3 is good.
425
- """,
 
426
  },
427
  {"role": "user", "content": prompt},
428
  ],
 
383
  - [Take 1. <div id='topic' style="display: inline"> 20s at 25:45]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{1245}}&et={{1265}})
384
  - [Take 3 (Best). <div id='topic' style="display: inline"> 5s at 10:13 </div>]({link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618)"""
385
  else:
386
+ prompt = f"""<div id="initial_message">
387
+ Given the transcript {transcript}, analyze speakers' discussions to identify compelling social media clips. For each speaker, identify key topics that mention people, news, events, trends, or sources.
 
388
 
389
+ Format requirements:
390
 
391
+ 1. SPEAKER FORMAT:
392
  **Speaker Name**
393
+ 1. [Topic title <div id='topic' style="display: inline"> 20s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{770}})
394
+ 2. [Topic title <div id='topic' style="display: inline"> 45s at 14:45 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{885}}&et={{930}})
395
+ 3. [Topic title <div id='topic' style="display: inline"> 55s at 16:20 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{980}}&et={{1035}})
396
+
397
+ 2. TIMESTAMP RULES:
398
+ - Start time (st): Must begin exactly when speaker starts discussing the specific topic
399
+ - End time (et): Must end exactly when either:
400
+ * The speaker completes their point, or
401
+ * Before the next speaker begins
402
+ - NO OVERLAP: Selected duration must NEVER include dialogue from other speakers
403
+ - Duration limits: Minimum 20 seconds, maximum 60 seconds
404
+ - Time format: "Xs at HH:MM" where X = seconds
405
+ - URL parameters: Convert display times to seconds
406
+ Example: "25s at 10:13" st=613&et=638
407
+
408
+ 3. FORMATTING RULES:
409
+ - Speaker names: Use markdown bold (**Name**)
410
+ - Topic titles: First word capitalized, rest lowercase
411
+ - Each topic must be a clickable link with correct timestamp
412
+ - URL format: {link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{start_time_in_sec}}&et={{end_time_in_sec}}
413
+
414
+ 4. TOPIC SELECTION:
415
+ - Prioritize engaging, viral-worthy content
416
+ - Minimum 2 topics per speaker, aim for 3 if available
417
+ - Topics should be self-contained discussions within the timestamp
418
+ - Skip speakers if fewer than 2 compelling topics found</div>
419
  """
420
+ print(prompt)
421
  completion = client.chat.completions.create(
422
  model="gpt-4o-mini",
423
  messages=[
424
  {
425
  "role": "system",
426
+ "content": f"""You are analyzing a transcript for Call ID: {cid}, Session ID: {rsid}, Origin: {origin}, Call Type: {ct}.
427
+
428
+ CORE REQUIREMENTS:
429
+ 1. TIMESTAMPS: Each clip must contain ONLY the specified speaker's dialogue about a single topic. No overlapping dialogue from other speakers.
430
+ 2. DURATION: Clips must be 20-60 seconds long
431
+ 3. CONTENT: Select engaging, viral-worthy topics
432
+ 4. COVERAGE: Minimum 2 topics per speaker, aim for 3 if good content exists
433
+
434
+ Prioritize accuracy in timestamp selection over quantity of clips.""",
435
  },
436
  {"role": "user", "content": prompt},
437
  ],