KeyError: '__type__'

My streamlit pyton app only has this problem on streamlit cloud, on my mac it runs ok, changed nothing but getting this error and couldn’t fix it, any idea what could be causing this?

[11:07:23] 🔄 Updated app!
2023-04-18 14:14:17.538 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/app/chat6529/6529GPT.py", line 99, in <module>
    st.session_state.response_text, st.session_state.similarity_score = process_question(query)
  File "/app/chat6529/6529GPT.py", line 54, in process_question
    index = GPTSimpleVectorIndex.load_from_disk(input_index)
  File "/home/appuser/venv/lib/python3.9/site-packages/llama_index/indices/base.py", line 369, in load_from_disk
    return cls.load_from_string(file_contents, **kwargs)
  File "/home/appuser/venv/lib/python3.9/site-packages/llama_index/indices/base.py", line 345, in load_from_string
    return cls.load_from_dict(result_dict, **kwargs)
  File "/home/appuser/venv/lib/python3.9/site-packages/llama_index/indices/vector_store/base.py", line 260, in load_from_dict
    vector_store = load_vector_store_from_dict(
  File "/home/appuser/venv/lib/python3.9/site-packages/llama_index/vector_stores/registry.py", line 52, in load_vector_store_from_dict
    type = vector_store_dict[TYPE_KEY]
KeyError: '__type__'

got this error also on heroku, what I don’t understand is it work perfectly on my mac

KeyError: ‘type

Traceback:

File "/app/.heroku/python/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "/app/6529GPT.py", line 99, in <module>
    st.session_state.response_text, st.session_state.similarity_score = process_question(query)
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^File "/app/6529GPT.py", line 54, in process_question
    index = GPTSimpleVectorIndex.load_from_disk(input_index)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/app/.heroku/python/lib/python3.11/site-packages/llama_index/indices/base.py", line 369, in load_from_disk
    return cls.load_from_string(file_contents, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/app/.heroku/python/lib/python3.11/site-packages/llama_index/indices/base.py", line 345, in load_from_string
    return cls.load_from_dict(result_dict, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/app/.heroku/python/lib/python3.11/site-packages/llama_index/indices/vector_store/base.py", line 260, in load_from_dict
    vector_store = load_vector_store_from_dict(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/app/.heroku/python/lib/python3.11/site-packages/llama_index/vector_stores/registry.py", line 52, in load_vector_store_from_dict
    type = vector_store_dict[TYPE_KEY]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^

resolved the issue by downgrading llama_index to 0.4.40

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.