Spaces:
Sleeping
Sleeping
Download nested_agent/agents/documenter.py from aeolusyansheng/multi-agent: direct link, hf CLI and curl.
- Browser
- Download file 754 Bytes
-
https://huggingface.co/spaces/aeolusyansheng/multi-agent/resolve/main/nested_agent/agents/documenter.py
- Command line
-
hf download hf://spaces/aeolusyansheng/multi-agent/nested_agent/agents/documenter.py
-
curl -L -o documenter.py https://huggingface.co/spaces/aeolusyansheng/multi-agent/resolve/main/nested_agent/agents/documenter.py
754 Bytes
| """ | |
| 文档生成 Agent (Documenter) | |
| """ | |
| from langchain_core.messages import SystemMessage, HumanMessage | |
| from llm import call_with_fallback | |
| from nested_agent.prompts import DOCUMENTER_SYSTEM_PROMPT, DOCUMENTER_HUMAN_PROMPT | |
| def documenter_node(state: dict) -> dict: | |
| requirement = state["requirement"] | |
| code = state.get("coder_output", "未提供代码实现。") | |
| messages = [ | |
| SystemMessage(content=DOCUMENTER_SYSTEM_PROMPT), | |
| HumanMessage(content=DOCUMENTER_HUMAN_PROMPT.format( | |
| requirement=requirement, | |
| code=code | |
| )), | |
| ] | |
| result = call_with_fallback(messages) | |
| return { | |
| "documenter_output": result.content, | |
| "model_used_by": {"documenter": result.model_used}, | |
| } | |