Skip to content

Commit

Permalink
fix collusion
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Jul 19, 2024
1 parent d1c731a commit f4f9429
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/models/talk/summary_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create_summary!
parameters: {
model: "gpt-4o-mini", # Required.
response_format: {type: "json_object"},
messages: messages
messages: create_summary_messages
}
)

Expand All @@ -23,14 +23,14 @@ def create_summary!

private

def messages
def create_summary_messages
[
{role: "system", content: "You are a helpful assistant skilled in processing and summarizing transcripts."},
{role: "user", content: prompt}
{role: "user", content: create_summary_prompt}
]
end

def prompt
def create_summary_prompt
<<~PROMPT
You are tasked with creating a summary of a video based on its transcript and metadata. Follow these steps carefully:
Expand Down
10 changes: 5 additions & 5 deletions app/models/talk/transcript_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def enhance_transcript!
parameters: {
model: "gpt-4o-mini", # Required.
response_format: {type: "json_object"},
messages: messages
messages: enhance_transcript_messages
}
)
raw_response = JSON.repair(response.dig("choices", 0, "message", "content"))
Expand All @@ -35,14 +35,14 @@ def enhance_transcript!

private

def messages
def enhance_transcript_messages
[
{role: "system", content: "You are a helpful assistant skilled in processing and summarizing transcripts."},
{role: "user", content: prompt}
{role: "user", content: enhance_transcript_prompt}
]
end

def prompt
def enhance_transcript_prompt
<<~PROMPT
You are tasked with improving and formatting a raw VTT transcript. Your goal is to correct and enhance the text, organize it into paragraphs, and format it into a specific JSON structure. Follow these instructions carefully to complete the task.
Expand All @@ -65,7 +65,7 @@ def prompt
5. For each paragraph, use the start time of its first sentence as the paragraph's start time, and the end time of its last sentence as the paragraph's end time.
6. Format the improved transcript into a JSON structure using this schema:
[{start_time: "00:00:00", end_time: "00:00:05", text: "Hello, world!"},...]
{"transcript": [{start_time: "00:00:00", end_time: "00:00:05", text: "Hello, world!"},...]}
Here is the raw VTT transcript to process:
Expand Down

0 comments on commit f4f9429

Please sign in to comment.