llama-hub
llama-hub copied to clipboard
[Bug]: Chain Of Table, KeyError: "None of [Int64Index([0, 2, 3], dtype='int64')] are in the [index]"
Bug Description
chain_of_table /chain_of_table.ipynb
KeyError Traceback (most recent call last)
[<ipython-input-52-07d7650d1fac>](https://localhost:8080/#) in <cell line: 1>()
----> 1 query_engine.query(query)
9 frames
[/usr/local/lib/python3.10/dist-packages/llama_index/query_engine/custom.py](https://localhost:8080/#) in query(self, str_or_query_bundle)
43 else:
44 query_str = str_or_query_bundle
---> 45 raw_response = self.custom_query(query_str)
46 return (
47 Response(raw_response)
[<ipython-input-31-1105bee10f52>](https://localhost:8080/#) in custom_query(self, query_str)
64 )
65 raw_args = generate_args_chain.run(question=query_str)
---> 66 args, cur_table = schema_mappings[key].parse_args_and_call_fn(
67 cur_table, raw_args
68 )
[<ipython-input-8-2d944fc15c94>](https://localhost:8080/#) in parse_args_and_call_fn(self, table, args)
18 """引数を解析し、関数を呼び出す。"""
19 args = self.parse_args(args)
---> 20 return args, self.fn(table, args)
21
22 def generate_prompt_component(self, **kwargs: Any) -> QueryComponent:
[<ipython-input-19-7a80280de750>](https://localhost:8080/#) in fn(self, table, args)
20 table = table.copy()
21 # テーブルから行を選択
---> 22 table = table.loc[args]
23 return table
24
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexing.py](https://localhost:8080/#) in __getitem__(self, key)
1071
1072 maybe_callable = com.apply_if_callable(key, self.obj)
-> 1073 return self._getitem_axis(maybe_callable, axis=axis)
1074
1075 def _is_scalar_access(self, key: tuple):
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexing.py](https://localhost:8080/#) in _getitem_axis(self, key, axis)
1299 raise ValueError("Cannot index with multidimensional key")
1300
-> 1301 return self._getitem_iterable(key, axis=axis)
1302
1303 # nested tuple slicing
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexing.py](https://localhost:8080/#) in _getitem_iterable(self, key, axis)
1237
1238 # A collection of keys
-> 1239 keyarr, indexer = self._get_listlike_indexer(key, axis)
1240 return self.obj._reindex_with_indexers(
1241 {axis: [keyarr, indexer]}, copy=True, allow_dups=True
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexing.py](https://localhost:8080/#) in _get_listlike_indexer(self, key, axis)
1430 axis_name = self.obj._get_axis_name(axis)
1431
-> 1432 keyarr, indexer = ax._get_indexer_strict(key, axis_name)
1433
1434 return keyarr, indexer
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/base.py](https://localhost:8080/#) in _get_indexer_strict(self, key, axis_name)
6068 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
6069
-> 6070 self._raise_if_missing(keyarr, indexer, axis_name)
6071
6072 keyarr = self.take(indexer)
[/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/base.py](https://localhost:8080/#) in _raise_if_missing(self, key, indexer, axis_name)
6128 if use_interval_msg:
6129 key = list(key)
-> 6130 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6131
6132 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
KeyError: "None of [Int64Index([0, 2, 3], dtype='int64')] are in the [index]"
The base.py works for some query but some time it gives KeyError. Is there any fix to this yet?
Version
0.9.41
Steps to Reproduce
run: query_engine.query(query)
Relevant Logs/Tracbacks
No response
I have a similar error. I was running the code in "chain_of_table.ipynb" using LLaMA2-7bn but I got the error messages below: