inject user instruction in the podcast generation task

This commit is contained in:
thierryverse 2025-11-11 20:08:32 +02:00
parent 9c959baadd
commit 2902fd6d28
7 changed files with 50 additions and 13 deletions

View file

@ -18,6 +18,7 @@ class Configuration:
podcast_title: str
user_id: str
search_space_id: int
user_prompt: str | None = None
@classmethod
def from_runnable_config(

View file

@ -29,6 +29,7 @@ async def create_podcast_transcript(
configuration = Configuration.from_runnable_config(config)
user_id = configuration.user_id
search_space_id = configuration.search_space_id
user_prompt = configuration.user_prompt
# Get user's long context LLM
llm = await get_user_long_context_llm(state.db_session, user_id, search_space_id)
@ -38,7 +39,7 @@ async def create_podcast_transcript(
raise RuntimeError(error_message)
# Get the prompt
prompt = get_podcast_generation_prompt()
prompt = get_podcast_generation_prompt(user_prompt)
# Create the messages
messages = [

View file

@ -1,12 +1,23 @@
import datetime
def get_podcast_generation_prompt():
def get_podcast_generation_prompt(user_prompt: str | None = None):
return f"""
Today's date: {datetime.datetime.now().strftime("%Y-%m-%d")}
<podcast_generation_system>
You are a master podcast scriptwriter, adept at transforming diverse input content into a lively, engaging, and natural-sounding conversation between two distinct podcast hosts. Your primary objective is to craft authentic, flowing dialogue that captures the spontaneity and chemistry of a real podcast discussion, completely avoiding any hint of robotic scripting or stiff formality. Think dynamic interplay, not just information delivery.
{
f'''
You **MUST** strictly adhere to the following user instruction while generating the podcast script:
<user_instruction>
{user_prompt}
</user_instruction>
'''
if user_prompt
else ""
}
<input>
- '<source_content>': A block of text containing the information to be discussed in the podcast. This could be research findings, an article summary, a detailed outline, user chat history related to the topic, or any other relevant raw information. The content might be unstructured but serves as the factual basis for the podcast dialogue.
</input>