-
I am working on a PoC and modified this example I found online - https://github.com/christianrice/ai-demos/blob/96050c43f06cf43ff059458c8d19d49dad49da3b/2024_02_09%20-%20LangGraph%20Parallel%20Tool%20Calling/03_LangGraph_LLM_with_tools.ipynb I have it working where it correctly calls the tools and returns the appropriate response, but there is an extra LLM call/step at the end by the agent I am trying to remove. Here is the graph definition: Here is the 'should_continue' function: You can see in the following LangSmith screen shot the 3 calls (agent > action (tool) > agent) Is it possible to just return the answer directly from action since no new information is added by the final agent/llm call? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
For a little more clarity here is a pic of the graph. Additionally, I set the tool parameter 'return_direct' to True but still has the extra final call through the agent I am trying to avoid or remove. question_answer = StructuredTool.from_function( |
Beta Was this translation helpful? Give feedback.
-
I figured out my issue and a couple different ways to solve by adjusting the structure of the graph. I could have a conditional edge from action to end, which works pretty well. Appreciate the help! |
Beta Was this translation helpful? Give feedback.
-
Awesome! Ya |
Beta Was this translation helpful? Give feedback.
I figured out my issue and a couple different ways to solve by adjusting the structure of the graph. I could have a conditional edge from action to end, which works pretty well. Appreciate the help!