|
23 | 23 | import os |
24 | 24 | from typing import Annotated, Any, Literal |
25 | 25 |
|
26 | | -from langchain.agents import create_agent |
27 | 26 | from langchain_core.messages import BaseMessage, HumanMessage, SystemMessage |
28 | 27 | from langchain_core.output_parsers import StrOutputParser |
29 | 28 | from langchain_core.prompts import ChatPromptTemplate |
|
34 | 33 | from pydantic import BaseModel, Field |
35 | 34 | from typing_extensions import TypedDict |
36 | 35 |
|
| 36 | +from langchain.agents import create_agent |
| 37 | + |
37 | 38 |
|
38 | 39 | class PlanStep(BaseModel): |
39 | 40 | """A single step in the execution plan.""" |
@@ -167,7 +168,7 @@ def build_plan_and_execute_graph() -> Any: |
167 | 168 |
|
168 | 169 | # Build executor agent with tools |
169 | 170 | tools = [calculate, lookup, analyze] |
170 | | - executor_agent = create_agent(model, tools) |
| 171 | + executor_agent: Any = create_agent(model, tools) |
171 | 172 |
|
172 | 173 | def create_plan(state: PlanExecuteState) -> dict[str, Any]: |
173 | 174 | """Create an execution plan from the objective. |
@@ -243,9 +244,7 @@ def execute_step(state: PlanExecuteState) -> dict[str, Any]: |
243 | 244 | if result.get("messages"): |
244 | 245 | last_msg = result["messages"][-1] |
245 | 246 | result_content = ( |
246 | | - last_msg.content |
247 | | - if hasattr(last_msg, "content") |
248 | | - else str(last_msg) |
| 247 | + last_msg.content if hasattr(last_msg, "content") else str(last_msg) |
249 | 248 | ) |
250 | 249 |
|
251 | 250 | step_result = StepResult( |
|
0 commit comments