Cinnamon / kotaemon

An open-source RAG-based tool for chatting with your documents.
https://cinnamon.github.io/kotaemon/
Apache License 2.0
16.46k stars 1.27k forks source link

[BUG] - Unknow Error cannot chat with file attached & show error related to envs #300

Closed kientranasia closed 1 month ago

kientranasia commented 1 month ago

Description

I have open app and it cannot run,

Reproduction steps

I have open app and it cannot run,
- Attached the pdf file
- Provide simple like summarize file.

Screenshots

![DESCRIPTION](LINK.png)

Logs

python app.py 
[nltk_data] Downloading package punkt_tab to /opt/homebrew/Caskroom/mi
[nltk_data]     niconda/base/envs/kotaemon/lib/python3.10/site-
[nltk_data]     packages/llama_index/core/_static/nltk_cache...
[nltk_data]   Package punkt_tab is already up-to-date!
GraphRAG dependencies not installed. GraphRAG retriever pipeline will not work properly.
User "admin" already exists
Setting up quick upload event
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
User-id: None, can see public conversations: False
User-id: 1, can see public conversations: True
len(results)=10, len(file_list)=10
len(results)=0, len(file_list)=1
Overriding with default loaders
use_quick_index_mode False
reader_mode default
Using reader <kotaemon.loaders.pdf_loader.PDFThumbnailReader object at 0x16c44c9a0>
len(results)=10, len(file_list)=10
User-id: 1, can see public conversations: True
Session reasoning type None
Session LLM None
Reasoning class <class 'ktem.reasoning.simple.FullQAPipeline'>
Reasoning state {'app': {'regen': False}, 'pipeline': {}}
Thinking ...
Retrievers [DocumentRetrievalPipeline(DS=<kotaemon.storages.docstores.lancedb.LanceDBDocumentStore object at 0x169d9efb0>, FSPath=PosixPath('/Users/kientran/Development/kotaemon/ktem_app_data/user_data/files/index_1'), Index=<class 'ktem.index.file.index.IndexTable'>, Source=<class 'ktem.index.file.index.Source'>, VS=<kotaemon.storages.vectorstores.chroma.ChromaVectorStore object at 0x169d9f250>, get_extra_table=False, llm_scorer=LLMTrulensScoring(concurrent=True, normalize=10, prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x16c3dc3a0>, system_prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x16c3def20>, top_k=3, user_prompt_template=<kotaemon.llms.prompts.template.PromptTemplate object at 0x16c3dc340>), mmr=False, rerankers=[CohereReranking(cohere_api_key='', model_name='rerank-multilingual-v2.0')], retrieval_mode='hybrid', top_k=10, user_id=1), GraphRAGRetrieverPipeline(DS=<theflow.base.unset_ object at 0x1015e1090>, FSPath=<theflow.base.unset_ object at 0x1015e1090>, Index=<class 'ktem.index.file.index.IndexTable'>, Source=<theflow.base.unset_ object at 0x1015e1090>, VS=<theflow.base.unset_ object at 0x1015e1090>, file_ids=[], user_id=<theflow.base.unset_ object at 0x1015e1090>)]
searching in doc_ids ['37dbbe5a-e360-4305-9df8-56c17382433e']
retrieval_kwargs: dict_keys(['do_extend', 'scope', 'filters'])
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/queueing.py", line 575, in process_events
    response = await route_utils.call_process_api(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/blocks.py", line 1923, in process_api
    result = await self.call_function(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/utils.py", line 663, in async_iteration
    return await iterator.__anext__()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/utils.py", line 656, in __anext__
    return await anyio.to_thread.run_sync(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/utils.py", line 639, in run_sync_iterator_async
    return next(iterator)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/gradio/utils.py", line 801, in gen_wrapper
    response = next(iterator)
  File "/Users/kientran/Development/kotaemon/libs/ktem/ktem/pages/chat/__init__.py", line 804, in chat_fn
    for response in pipeline.stream(chat_input, conversation_id, chat_history):
  File "/Users/kientran/Development/kotaemon/libs/ktem/ktem/reasoning/simple.py", line 660, in stream
    docs, infos = self.retrieve(message, history)
  File "/Users/kientran/Development/kotaemon/libs/ktem/ktem/reasoning/simple.py", line 488, in retrieve
    retriever_docs = retriever_node(text=query)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1097, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1088, in __call__
    output = self.fl.exec(func, args, kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/backends/base.py", line 151, in exec
    return run(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 144, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 141, in __call__
    _output = self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 117, in __call__
    return self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1017, in _runx
    return self.run(*args, **kwargs)
  File "/Users/kientran/Development/kotaemon/libs/ktem/ktem/index/file/pipelines.py", line 162, in run
    docs = self.vector_retrieval(text=text, top_k=self.top_k, **retrieval_kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1261, in exec
    return child(*args, **kwargs, __fl_runstates__=__fl_runstates__)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1097, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1088, in __call__
    output = self.fl.exec(func, args, kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/backends/base.py", line 151, in exec
    return run(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 144, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 141, in __call__
    _output = self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 117, in __call__
    return self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1017, in _runx
    return self.run(*args, **kwargs)
  File "/Users/kientran/Development/kotaemon/libs/kotaemon/kotaemon/indices/vectorindex.py", line 188, in run
    emb = self.embedding(text)[0].embedding
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1261, in exec
    return child(*args, **kwargs, __fl_runstates__=__fl_runstates__)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1675, in __call__
    return self._create_callable(getattr(self.ff_original_obj, "__call__"))(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1663, in wrapper
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1661, in wrapper
    output = callable_obj(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 144, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 141, in __call__
    _output = self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 117, in __call__
    return self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1261, in exec
    return child(*args, **kwargs, __fl_runstates__=__fl_runstates__)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1097, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1088, in __call__
    output = self.fl.exec(func, args, kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/backends/base.py", line 151, in exec
    return run(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 144, in __call__
    raise e from None
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 141, in __call__
    _output = self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/middleware.py", line 117, in __call__
    return self.next_call(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/theflow/base.py", line 1017, in _runx
    return self.run(*args, **kwargs)
  File "/Users/kientran/Development/kotaemon/libs/kotaemon/kotaemon/embeddings/base.py", line 10, in run
    return self.invoke(text, *args, **kwargs)
  File "/Users/kientran/Development/kotaemon/libs/kotaemon/kotaemon/embeddings/openai.py", line 104, in invoke
    resp = self.openai_response(client, input=input_, **kwargs).dict()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/kotaemon/lib/python3.10/site-packages/tenacity

Browsers

No response

OS

MacOS

Additional information

M2

phv2312 commented 1 month ago

Hi. I doubt your error message related to wrongly set up necessary models. Can you help to check whether you have set up correctly the embedding & LLM, as described in the document ?