Args: tools: List of tools to use. max_replans: Maximum number of replans to do. benchmark: Whether to collect benchmark stats. Planner Args: planner_llm: LLM to use for planning. planner_example_prompt: Example prompt for
(
self,
tools: Sequence[Union[Tool, StructuredTool]],
planner_llm: BaseLLM,
planner_example_prompt: str,
planner_example_prompt_replan: Optional[str],
planner_stop: Optional[list[str]],
planner_stream: bool,
agent_llm: BaseLLM,
joinner_prompt: str,
joinner_prompt_final: Optional[str],
max_replans: int,
benchmark: bool,
**kwargs,
)
| 48 | output_key: str = "output" |
| 49 | |
| 50 | def __init__( |
| 51 | self, |
| 52 | tools: Sequence[Union[Tool, StructuredTool]], |
| 53 | planner_llm: BaseLLM, |
| 54 | planner_example_prompt: str, |
| 55 | planner_example_prompt_replan: Optional[str], |
| 56 | planner_stop: Optional[list[str]], |
| 57 | planner_stream: bool, |
| 58 | agent_llm: BaseLLM, |
| 59 | joinner_prompt: str, |
| 60 | joinner_prompt_final: Optional[str], |
| 61 | max_replans: int, |
| 62 | benchmark: bool, |
| 63 | **kwargs, |
| 64 | ) -> None: |
| 65 | """ |
| 66 | Args: |
| 67 | tools: List of tools to use. |
| 68 | max_replans: Maximum number of replans to do. |
| 69 | benchmark: Whether to collect benchmark stats. |
| 70 | |
| 71 | Planner Args: |
| 72 | planner_llm: LLM to use for planning. |
| 73 | planner_example_prompt: Example prompt for planning. |
| 74 | planner_example_prompt_replan: Example prompt for replanning. |
| 75 | Assign this if you want to use different example prompt for replanning. |
| 76 | If not assigned, default to `planner_example_prompt`. |
| 77 | planner_stop: Stop tokens for planning. |
| 78 | planner_stream: Whether to stream the planning. |
| 79 | |
| 80 | Agent Args: |
| 81 | agent_llm: LLM to use for agent. |
| 82 | joinner_prompt: Prompt to use for joinner. |
| 83 | joinner_prompt_final: Prompt to use for joinner at the final replanning iter. |
| 84 | If not assigned, default to `joinner_prompt`. |
| 85 | """ |
| 86 | super().__init__(**kwargs) |
| 87 | |
| 88 | if not planner_example_prompt_replan: |
| 89 | log( |
| 90 | "Replan example prompt not specified, using the same prompt as the planner." |
| 91 | ) |
| 92 | planner_example_prompt_replan = planner_example_prompt |
| 93 | |
| 94 | self.planner = Planner( |
| 95 | llm=planner_llm, |
| 96 | example_prompt=planner_example_prompt, |
| 97 | example_prompt_replan=planner_example_prompt_replan, |
| 98 | tools=tools, |
| 99 | stop=planner_stop, |
| 100 | ) |
| 101 | |
| 102 | self.agent = LLMCompilerAgent(agent_llm) |
| 103 | self.joinner_prompt = joinner_prompt |
| 104 | self.joinner_prompt_final = joinner_prompt_final or joinner_prompt |
| 105 | self.planner_stream = planner_stream |
| 106 | self.max_replans = max_replans |
| 107 |
nothing calls this directly
no test coverage detected