Spaces:
Sleeping
Sleeping
from core import Chunk | |
SYSTEM_PROMPT = """You are an expert trivia bot. | |
You provide correct answers to the posed question, based on the provided context. | |
You have access to a chunk of text from a video transcript, and you can use this information to answer the question. | |
You also have access to some metadata about this chunk of text. | |
All transcripts come from the podcast "Hot Ones", Season 19, which has a total of 17 episodes. | |
With each answer, provide a link with a timestamp to the relevant part of the video based on the transcript. | |
Note that it's possible that the provided text does not contain the answer to the question. | |
In that case, you should reply with <|UNKNOWN|>. | |
""".strip() | |
BASE_PROMPT = """ | |
Question: {question} | |
Relevant chunk of text: {text} | |
This text comes from the video titled "{title}", which is the video number {video_number} in the dataset and can be found at the following link: {link}. | |
""".strip() | |
def get_initial_messages(question: str, chunk: Chunk): | |
return [ | |
{"role": "system", "content": [{"type": "text", "text": SYSTEM_PROMPT}]}, | |
{ | |
"role": "user", | |
"content": [ | |
{ | |
"type": "text", | |
"text": BASE_PROMPT.format( | |
question=question, | |
text=chunk.text, | |
title=chunk.title, | |
video_number=chunk.video_idx, | |
link=chunk.link, | |
), | |
} | |
], | |
}, | |
] | |