hwchase17 / notion-qa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when deploy to streamlit cloud

G1213123 opened this issue · comments

I was try to deploy the app to the streamlit cloud.
It works fine at localhost, but raised an error when trying to call the langchain vectordatabase with source:

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/chatrtc/main.py", line 50, in <module>
    result = chain({"question": user_input})
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 146, in __call__
    raise e
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 142, in __call__
    outputs = self._call(inputs)
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/qa_with_sources/base.py", line 96, in _call
    docs = self._get_docs(inputs)
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/chains/qa_with_sources/vector_db.py", line 20, in _get_docs
    return self.vectorstore.similarity_search(question, k=self.k)
  File "/home/appuser/venv/lib/python3.9/site-packages/langchain/vectorstores/faiss.py", line 91, in similarity_search
    _, indices = self.index.search(np.array([embedding], dtype=np.float32), k)
TypeError: search() missing 3 required positional arguments: 'k', 'distances', and 'labels'

I believe this is some kind of problem when the cloud server try to load the pickle file at the linux os, which is different from my localhost in window. Anyone know how to solve this?

For anyone need to know, a similar discussion is saw here:
https://www.reddit.com/r/LangChain/comments/111i9zy/help_error_after_deploying_on_streamlit/

P.S. Alternatively, I have changed the vectorstore to pinecone so it doesn;t have to load the pickled file