Cinnamon / kotaemon

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

[BUG] NanoGraphRAG has this ---> Error: name 'EmbeddingFunc' is not defined #458

Open gutama opened 2 days ago

gutama commented 2 days ago

Description

Already installed nano-graphrag but cannot retrieve from nanoGraphCollection

image

image

image

Reproduction steps

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

![DESCRIPTION](LINK.png)

![image](https://github.com/user-attachments/assets/319ef0e2-95f1-49d4-aaa0-8d3d4e6513fd)

Logs

thumbnail docs 0 non-thumbnail docs 10 raw-thumbnail docs 0
retrieval step took 1.5637717247009277
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 575, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1923, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 663, in async_iteration
    return await iterator.__anext__()
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 656, in __anext__
    return await anyio.to_thread.run_sync(
  File "/usr/local/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 "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 943, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 639, in run_sync_iterator_async
    return next(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 801, in gen_wrapper
    response = next(iterator)
  File "/app/libs/ktem/ktem/pages/chat/__init__.py", line 812, in chat_fn
    for response in pipeline.stream(chat_input, conversation_id, chat_history):
  File "/app/libs/ktem/ktem/reasoning/simple.py", line 705, in stream
    docs, infos = self.retrieve(message, history)
  File "/app/libs/ktem/ktem/reasoning/simple.py", line 503, in retrieve
    retriever_docs = retriever_node(text=query)
  File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1097, in __call__
    raise e from None
  File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1088, in __call__
    output = self.fl.exec(func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/theflow/backends/base.py", line 151, in exec
    return run(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 144, in __call__
    raise e from None
  File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 141, in __call__
    _output = self.next_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 117, in __call__
    return self.next_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1017, in _runx
    return self.run(*args, **kwargs)
  File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 354, in run
    graphrag_func, query_params = self._build_graph_search()
  File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 286, in _build_graph_search
    llm_func, embedding_func, _, _ = get_default_models_wrapper()
  File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 88, in get_default_models_wrapper
    embedding_func = EmbeddingFunc(
NameError: name 'EmbeddingFunc' is not defined

Browsers

No response

OS

No response

Additional information

No response

taprosoft commented 2 days ago

Please check if nano-graphrag is correctly installed https://github.com/gusye1234/nano-graphrag/

gutama commented 2 days ago

nano-graphrag is running fine under lightrag

image

gutama commented 2 days ago

I was using docker full installation

docker run -e GRADIO_SERVER_NAME=0.0.0.0 -e GRADIO_SERVER_PORT=7860 -e USE_NANO_GRAPHRAG=true -p 7860:7860 -it --rm ghcr.io/cinnamon/kotaemon:main-full

thumbnail docs 0 non-thumbnail docs 10 raw-thumbnail docs 0 retrieval step took 1.5637717247009277 Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 575, in process_events response = await route_utils.call_process_api( File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api output = await app.get_blocks().process_api( File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1923, in process_api result = await self.call_function( File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function prediction = await utils.async_iteration(iterator) File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 663, in async_iteration return await iterator.anext() File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 656, in anext return await anyio.to_thread.run_sync( File "/usr/local/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 "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 943, in run result = context.run(func, args) File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 639, in run_sync_iterator_async return next(iterator) File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 801, in gen_wrapper response = next(iterator) File "/app/libs/ktem/ktem/pages/chat/init.py", line 812, in chat_fn for response in pipeline.stream(chat_input, conversation_id, chat_history): File "/app/libs/ktem/ktem/reasoning/simple.py", line 705, in stream docs, infos = self.retrieve(message, history) File "/app/libs/ktem/ktem/reasoning/simple.py", line 503, in retrieve retriever_docs = retriever_node(text=query) File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1097, in call raise e from None File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1088, in call output = self.fl.exec(func, args, kwargs) File "/usr/local/lib/python3.10/site-packages/theflow/backends/base.py", line 151, in exec return run(args, kwargs) File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 144, in call raise e from None File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 141, in call _output = self.next_call(*args, *kwargs) File "/usr/local/lib/python3.10/site-packages/theflow/middleware.py", line 117, in call return self.next_call(args, kwargs) File "/usr/local/lib/python3.10/site-packages/theflow/base.py", line 1017, in _runx return self.run(*args, **kwargs) File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 354, in run graphrag_func, query_params = self._build_graph_search() File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 286, in _build_graph_search llm_func, embeddingfunc, , _ = get_default_models_wrapper() File "/app/libs/ktem/ktem/index/file/graph/nano_pipelines.py", line 88, in get_default_models_wrapper embedding_func = EmbeddingFunc( NameError: name 'EmbeddingFunc' is not defined

taprosoft commented 1 day ago

@gutama currently Docker full installation haven't has nano-graphrag dependency installed yet. We are making some tweaks to nano-graphrag to make it more stable & easy to use before release it as official Docker image.

gutama commented 23 hours ago

thank you for the explanation