Spaces:
Running
Running
Commit
·
77f24d4
1
Parent(s):
6d3be2f
update: prompt
Browse files
app.py
CHANGED
@@ -441,18 +441,39 @@ def chat(
|
|
441 |
link_start = "http"
|
442 |
else:
|
443 |
link_start = "https"
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
|
|
451 |
|
|
|
|
|
|
|
452 |
For Example:
|
453 |
If the start time is 10:13 and end time is 10:18, the url will be:
|
454 |
{link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618&uid=82314
|
455 |
In the URL, make sure that after RSID there is ? and then rest of the fields are added via &.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
"""
|
457 |
messages = [{"role": "system", "content": prompt}]
|
458 |
|
@@ -466,7 +487,11 @@ In the URL, make sure that after RSID there is ? and then rest of the fields are
|
|
466 |
messages.append({"role": "user", "content": message})
|
467 |
|
468 |
completion = client.chat.completions.create(
|
469 |
-
model="gpt-4o-mini",
|
|
|
|
|
|
|
|
|
470 |
)
|
471 |
collected_messages = []
|
472 |
tool_calls_detected = False
|
@@ -762,7 +787,7 @@ def create_chat_interface():
|
|
762 |
transcript_data = get_transcript_for_url(turl)
|
763 |
transcript_processor = TranscriptProcessor(
|
764 |
transcript_data=transcript_data,
|
765 |
-
max_segment_duration=10,
|
766 |
call_type=ct,
|
767 |
)
|
768 |
|
|
|
441 |
link_start = "http"
|
442 |
else:
|
443 |
link_start = "https"
|
444 |
+
speaker_mapping = transcript_processor.speaker_mapping
|
445 |
+
prompt = f"""You are a helpful assistant analyzing transcripts and generating timestamps and URL. The user will ask you questions regarding the social media clips from the transcript.
|
446 |
+
Call ID is {cid},
|
447 |
+
Session ID is {rsid},
|
448 |
+
origin is {origin},
|
449 |
+
Call Type is {ct}.
|
450 |
+
Speakers: {", ".join(speaker_mapping.values())}
|
451 |
+
Transcript: {transcript_processor.get_transcript()}
|
452 |
|
453 |
+
If a user asks timestamps for a specific topic or things, find the start time and end time of that specific topic and return answer in the format:
|
454 |
+
Answers and URLs should be formated as follows:
|
455 |
+
[Topic title <div id='topic' style="display: inline"> 22s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{772}}&uid={{uid}})
|
456 |
For Example:
|
457 |
If the start time is 10:13 and end time is 10:18, the url will be:
|
458 |
{link_start}://roll.ai/colab/1234aq_12314/51234151?st=613&et=618&uid=82314
|
459 |
In the URL, make sure that after RSID there is ? and then rest of the fields are added via &.
|
460 |
+
You can include multiple links here that can related to the user answer. ALWAYS ANSWER FROM THE TRANSCRIPT.
|
461 |
+
|
462 |
+
Example 1:
|
463 |
+
User: Suggest me some clips that can go viral on Instagram.
|
464 |
+
Response:
|
465 |
+
1. [Clip 1 <div id='topic' style="display: inline"> 22s at 12:30 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{750}}&et={{772}}&uid={{uid}})
|
466 |
+
2. [Clip 2 <div id='topic' style="display: inline"> 10s at 10:00 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{600}}&et={{610}}&uid={{uid}})
|
467 |
+
|
468 |
+
Example 2:
|
469 |
+
User: Give me the URL where each person has introduced themselves.
|
470 |
+
Response (Please provide exact time where the person has started introducing themselves. Normally person start introducing themselves by saying Hi, Hello, I am, My name is, etc.):
|
471 |
+
1. [Person Name1 <div id='topic' style="display: inline"> 43s at 14:45 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{885}}&et={{928}}&uid={{uid}})
|
472 |
+
2. [Person Name2 <div id='topic' style="display: inline"> 58s at 16:20 </div>]({link_start}://{{origin}}/collab/{{cid}}/{{rsid}}?st={{980}}&et={{1038}}&uid={{uid}})
|
473 |
+
....
|
474 |
+
|
475 |
+
If the user provides a link to the agenda, use the correct_speaker_name_with_url function to correct the speaker names based on the agenda.
|
476 |
+
If the user provides the correct call type, use the correct_call_type function to correct the call type. Call Type for street interviews is 'si'.
|
477 |
"""
|
478 |
messages = [{"role": "system", "content": prompt}]
|
479 |
|
|
|
487 |
messages.append({"role": "user", "content": message})
|
488 |
|
489 |
completion = client.chat.completions.create(
|
490 |
+
model="gpt-4o-mini",
|
491 |
+
messages=messages,
|
492 |
+
tools=tools,
|
493 |
+
stream=True,
|
494 |
+
temperature=0.5,
|
495 |
)
|
496 |
collected_messages = []
|
497 |
tool_calls_detected = False
|
|
|
787 |
transcript_data = get_transcript_for_url(turl)
|
788 |
transcript_processor = TranscriptProcessor(
|
789 |
transcript_data=transcript_data,
|
790 |
+
max_segment_duration=20 if ct != "si" else 10,
|
791 |
call_type=ct,
|
792 |
)
|
793 |
|