Main chatbot node that invokes the LLM. The LLM can decide to use gateway tools or respond directly.
(state: State, llm_with_tools)
| 43 | |
| 44 | |
| 45 | async def chatbot_node(state: State, llm_with_tools): |
| 46 | """ |
| 47 | Main chatbot node that invokes the LLM. |
| 48 | The LLM can decide to use gateway tools or respond directly. |
| 49 | """ |
| 50 | response = await llm_with_tools.ainvoke(state["messages"]) |
| 51 | return {"messages": [response]} |
| 52 | |
| 53 | |
| 54 | async def run_agent_with_gateway(user_message: str) -> str: |