mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-25 15:04:46 +08:00
feat: add context compress (#590)
* feat:Add context compress * feat: Add unit test * feat: add unit test for context manager * feat: add postprocessor param && code format * feat: add configuration guide * fix: fix the configuration_guide * fix: fix the unit test * fix: fix the default value * feat: add test and log for context_manager
This commit is contained in:
@@ -9,11 +9,18 @@ from src.prompts import apply_prompt_template
|
||||
|
||||
|
||||
# Create agents using configured LLM types
|
||||
def create_agent(agent_name: str, agent_type: str, tools: list, prompt_template: str):
|
||||
def create_agent(
|
||||
agent_name: str,
|
||||
agent_type: str,
|
||||
tools: list,
|
||||
prompt_template: str,
|
||||
pre_model_hook: callable = None,
|
||||
):
|
||||
"""Factory function to create agents with consistent configuration."""
|
||||
return create_react_agent(
|
||||
name=agent_name,
|
||||
model=get_llm_by_type(AGENT_LLM_MAP[agent_type]),
|
||||
tools=tools,
|
||||
prompt=lambda state: apply_prompt_template(prompt_template, state),
|
||||
pre_model_hook=pre_model_hook,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user