170c4eb33c
* fix: revert the part of patch of issue-710 to extract the content from the plan * Upgrade the ddgs for the new compatible version * Upgraded langchain to 1.1.0 updated langchain related package to the new compatable version * Update pyproject.toml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
29 lines
931 B
Python
29 lines
931 B
Python
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
import logging
|
|
|
|
from langchain_core.messages 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 src.prose.graph.state import ProseState
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def prose_zap_node(state: ProseState):
|
|
logger.info("Generating prose zap content...")
|
|
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
|
prose_content = model.invoke(
|
|
[
|
|
SystemMessage(content=get_prompt_template("prose/prose_zap")),
|
|
HumanMessage(
|
|
content=f"For this text: {state['content']}.\nYou have to respect the command: {state['command']}"
|
|
),
|
|
],
|
|
)
|
|
logger.info(f"prose_content: {prose_content}")
|
|
return {"output": prose_content.content}
|