Files
langgraph/examples/llm-compiler
MisraaksandGitHub 217321127f Issue #274: Fix LLMCompiler Bugs (#275)
* Update LLMCompiler.ipynb

The code didn't actually handle when there's more than one dependency listed in an argument. The example of multi-step math used in the code doesn't work because the third step has more than one dependency in its args and the code only handles one:
```
User query: "What's ((3*(4+5)/0.5)+3245) + 8? What's 32/4.23? What's the sum of those two values?"
1. math(problem="((3*(4+5)/0.5)+3245) + 8")
2. math(problem="32/4.23")
3. math(problem="${1}+${2}")
4. join()<END_OFPLAN>
```
Step 3 fails, and does so silently too. It correctly parses strings that are "${1}", but not multi-argument strings like "${1}+${2}"

This fixes it to handle any number of dependencies listed in one arg. It uses the regex pattern already defined in output_parser.py.

* Fix looping function calls because no arg context

Task Fetching Unit, when it inserts the tool_messages, the function args don't get logged with function calls, this causes the replanner to loop and use the same function parameters and never corrects itself.

* Fix tool index count and range

In the planner prompt formatting, the 'num_tools' variable needs to have a +1 added to it because we're appending the join() function, without +1 it says there's one less available tools than there actually is because it only counts the passed in functions and not the join() function. And add +1 for listing otherwise it starts at a 0 offset.

* Fix unhandled empty iterator exception

Task fetching unit: When it calls the tools it doesn't handle when there's no tasks. next() is called and fails. This fixes it by wrapping in a try/except. On exception we set tasks to an empty list since next() failed, there's no tasks.
2024-04-05 10:37:11 -07:00
..
2024-02-12 14:33:34 -08:00
2024-02-09 16:05:51 -08:00
2024-02-09 16:07:23 -08:00
2024-02-09 16:07:23 -08:00