run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
35.55k stars 5.02k forks source link

Could not parse dynamic plan: #13279

Closed yangyangyangOngithub closed 1 month ago

yangyangyangOngithub commented 4 months ago

Bug Description

Iteration: 0 Current table: col : Month | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Year row 1 : Average high °C (°F) | 17.3\n(63.1) | 19.5\n(67.1) | 22.6\n(72.7) | 25.9\n(78.6) | 27.2\n(81) | 29.3\n(84.7) | 31.8\n(89.2) | 31.4\n(88.5) | 28.9\n(84) | 25.5\n(77.9) | 21.7\n(71.1) | 19.2\n(66.6) | 24.76\n(76.57) row 2 : Average low °C (°F) | 7.9\n(46.2) | 9.4\n(48.9) | 12.5\n(54.5) | 17.6\n(63.7) | 19.2\n(66.6) | 21.6\n(70.9) | 23.8\n(74.8) | 22.5\n(72.5) | 20.7\n(69.3) | 16.5\n(61.7) | 14.1\n(57.4) | 8.5\n(47.3) | 15.94\n(60.69) row 3 : Precipitation mm (inches) | 235.9\n(9.287) | 129.2\n(5.087) | 82.8\n(3.26) | 33.6\n(1.323) | 4.7\n(0.185) | 0.2\n(0.008) | 0.0\n(0) | 0.2\n(0.008) | 3.2\n(0.126) | 58.0\n(2.283) | 107.4\n(4.228) | 214.5\n(8.445) | 857.3\n(33.752) row 4 : Avg. precipitation days | 13.9 | 11.4 | 8.6 | 3.6 | 2.4 | 0.1 | 0.0 | 0.1 | 1.8 | 4.9 | 8.0 | 11.8 | 63.7

Traceback (most recent call last): File "/data/test.py", line 29, in response = query_engine.query("Who won best Director in the 1972 Academy Awards?") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/query_engine/custom.py", line 45, in query raw_response = self.custom_query(query_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/packs/tables/chain_of_table/base.py", line 676, in custom_query key = dynamic_plan_chain.run(question=query_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/querypipeline/query.py", line 320, in run outputs, = self._run( ^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/query_pipeline/query.py", line 544, in _run result_outputs, intermediates = self._run_multi( ^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/query_pipeline/query.py", line 717, in _run_multi output_dict = module.run_component(module_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/base/query_pipeline/query.py", line 199, in run_component component_outputs = self._run_component(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/core/query_pipeline/components/function.py", line 97, in _run_component return {self.output_key: self.fn(**kwargs)} ^^^^^^^^^^^^^^^^^ File "/data/anaconda/envs/Qwenagent/lib/python3.11/site-packages/llama_index/packs/tables/chain_of_table/base.py", line 584, in _dynamic_plan_parser raise ValueError(f"Could not parse dynamic plan: {dynamic_plan_str}") ValueError: Could not parse dynamic plan:

Version

0.10.33

Steps to Reproduce

from llama_index.packs.tables.chain_of_table.base import ChainOfTableQueryEngine, serialize_table import pandas as pd from llama_index.llms.openai_like import OpenAILike

df = pd.read_csv("/data/WikiTableQuestions/csv/200-csv/42.csv")

llm = OpenAILike(model="Qwen", api_base="http://127.0.0.1:8000/v1", api_key="EMPTY")

from llama_index.packs.tables.chain_of_table.base import ChainOfTablePack

query_engine = ChainOfTableQueryEngine(df, llm=llm, verbose=True) response = query_engine.query("Who won best Director in the 1972 Academy Awards?")

Relevant Logs/Tracbacks

No response

dosubot[bot] commented 4 months ago

The error you're encountering, ValueError: Could not parse dynamic plan, indicates an issue with the format or content of the dynamic plan string used in the ChainOfTableQueryEngine. To resolve this:

  1. Ensure Correct Format: The dynamic plan should follow a specific format, with operations and arguments properly defined. It typically involves operation names followed by arguments, separated by specific delimiters.

  2. Check Operation Names: Verify that the operation names in your dynamic plan match those expected by the parser. Any discrepancy in operation names can lead to parsing errors.

  3. Dynamic Plan Completeness: Confirm that your dynamic plan string concludes with an <END> marker to signify the end of the plan.

  4. Compatibility Check: The version of the llama_index library you're using might not fully support Python 3.11. Consider using a Python version that is known to be compatible with llama_index version 0.10.33, or check if there's an updated version of the library that supports Python 3.11.

If after these checks the issue persists, it might be beneficial to consult the library's documentation for examples of valid dynamic plans or reach out to the library's support community for further assistance.

#### Details **Sources** - [llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-tables/llama_index/packs/tables/chain_of_table/base.py) - [llama-index-packs/llama-index-packs-tables/examples/chain_of_table.ipynb](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-tables/examples/chain_of_table.ipynb) - [docs/docs/CHANGELOG.md](https://github.com/run-llama/llama_index/blob/main/docs/docs/CHANGELOG.md) - [CHANGELOG.md](https://github.com/run-llama/llama_index/blob/main/CHANGELOG.md) - [llama-index-legacy/CHANGELOG.md](https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/CHANGELOG.md) - [llama-index-integrations/readers/llama-index-readers-pathway/tests/BUILD](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/readers/llama-index-readers-pathway/tests/BUILD)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.