mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 20:34:45 +08:00
feat: support Podcast generation
This commit is contained in:
27
src/podcast/graph/script_writer_node.py
Normal file
27
src/podcast/graph/script_writer_node.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import logging
|
||||
|
||||
from langchain.schema import HumanMessage, SystemMessage
|
||||
|
||||
from src.config.agents import AGENT_LLM_MAP
|
||||
from src.llms.llm import get_llm_by_type
|
||||
from src.prompts.template import get_prompt_template
|
||||
|
||||
from ..types import Script
|
||||
from .state import PodcastState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def script_writer_node(state: PodcastState):
|
||||
logger.info("Generating script for podcast...")
|
||||
model = get_llm_by_type(
|
||||
AGENT_LLM_MAP["podcast_script_writer"]
|
||||
).with_structured_output(Script)
|
||||
script = model.invoke(
|
||||
[
|
||||
SystemMessage(content=get_prompt_template("podcast_script_writer")),
|
||||
HumanMessage(content=state["input"]),
|
||||
],
|
||||
)
|
||||
logging.info(script)
|
||||
return {"script": script, "audio_chunks": []}
|
||||
Reference in New Issue
Block a user