Closed LastRoze closed 1 year ago
Hi @LastRoze, from your screenshot, the pandas
package reported an error about not having a key called Season 1
. Did you somehow updated the contents of articles.csv
? You can check it by downloading the latest version of the CSV file from your S3 bucket.
In the original sample file, the keys should all look like The Mandalorian - Season [n]
, which is different from the key in your error message Season 1
(without The Mandalorian -
).
Hi Gabriel,
No, I did not change the content, I used the lazy command to test the sample data you provided.
I tried multiple times (re-create the C9 and start over) and still the same issue happened.
When I asked Who is Grogu it's giving me the answer though but if it's something else the error happened.
Hello Gabriel
Thank you for this wonderful idea. I followed the steps mentioned in your readme and I was able to implement it in the AWS. But as the previous user mentioned I am also having the same exact error
[ERROR] 2023-08-12T13:55:00.892Z 8df0a02d-5acc-4f81-9f46-25706fbe639f Failed to run listener function (error: 'Season 1') Traceback (most recent call last): File "/opt/python/pandas/core/indexes/base.py", line 3652, in get_loc return self._engine.get_loc(casted_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Season 1'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/python/slack_bolt/listener/thread_runner.py", line 65, in run returned_value = listener.run_ack_function(request=request, response=response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/python/slack_bolt/listener/custom_listener.py", line 50, in run_ack_function return self.ack_function( ^^^^^^^^^^^^^^^^^^ File "/var/task/lambda_function.py", line 54, in handle_message_events prompt_with_articles_as_context = construct_prompt(message, embeddings, df) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/task/embedding.py", line 218, in construct_prompt document_section = df.loc[section_index]
File "/opt/python/pandas/core/indexing.py", line 1097, in __getitem__
return self._getitem_tuple(key)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexing.py", line 1280, in _getitem_tuple
return self._getitem_lowerdim(tup)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexing.py", line 1000, in _getitem_lowerdim
section = self._getitem_axis(key, axis=i)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexing.py", line 1343, in _getitem_axis
return self._get_label(key, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexing.py", line 1293, in _get_label
return self.obj.xs(label, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/generic.py", line 4088, in xs
loc, new_index = index._get_loc_level(key, level=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexes/multi.py", line 3059, in _get_loc_level
indexer = self._get_level_indexer(key, level=level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexes/multi.py", line 3160, in _get_level_indexer
idx = self._get_loc_single_level_index(level_index, key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexes/multi.py", line 2752, in _get_loc_single_level_index
return level_index.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python/pandas/core/indexes/base.py", line 3654, in get_loc
raise KeyError(key) from err
KeyError: 'Season 1'
Hi both @LastRoze and @junemohan, thanks both for reporting.
I finally got time to deep dive into the issue, it turned out that there were some inconsistent indices in the sample embedding file.
The first few records had an index pattern of (Season 1,Chapter 1: The Mandalorian)
,
while the remaining records had a pattern of (The Mandalorian - Season 1,Chapter 1: The Mandalorian)
;
i.e. the prefix The Mandalorian -
was missing in the first few records, resulting to the error both of you got: KeyError: 'Season 1'
.
I have updated the sample file and tested the end to end integration with the update files from scratch deployments.
You may refer to the diff at https://github.com/gabrielkoo/chatgpt-faq-slack-bot/commit/6c994deab828b6b7dd7678805360e3492af1bc41 for details.
Was managed to deploy and run on Cloud9 (without error). It's working when I ask "Who is grogu" using the sample data, when I ask other things it shows an error, also using the /submit (train command) always returns with try again.