assafelovic / gpt-researcher

GPT based autonomous agent that does online comprehensive research on any given topic
https://gptr.dev
MIT License
12.98k stars 1.61k forks source link

No module named 'gpt_researcher.retrievers.custom' #609

Closed JustUser1410 closed 1 week ago

JustUser1410 commented 1 week ago

I am trying to run multi-agent researcher but I am getting following error:

Traceback (most recent call last): File "C:\Users\Tomas\Documents\Python Workspace\gpt-researcher\multi_agents\main.py", line 32, in asyncio.run(main()) File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\asyncio\base_events.py", line 654, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\Tomas\Documents\Python Workspace\gpt-researcher\multi_agents\main.py", line 27, in main research_report = await chief_editor.run_research_task() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\Documents\Python Workspace\gpt-researcher\multi_agents\agents\master.py", line 57, in run_research_task result = await chain.ainvoke({"task": self.task}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langgraph\pregel__init.py", line 1504, in ainvoke async for chunk in self.astream( File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langgraph\pregel__init__.py", line 1333, in astream _panic_or_proceed(done, inflight, step) File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langgraph\pregel__init__.py", line 1537, in _panic_or_proceed raise exc File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langgraph\pregel\retry.py", line 120, in arun_with_retry await task.proc.ainvoke(task.input, task.config) File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langchain_core\runnables\base.py", line 2540, in ainvoke input = await step.ainvoke(input, config, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\langgraph\utils.py", line 117, in ainvoke ret = await asyncio.create_task( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\Documents\Python Workspace\gpt-researcher\multi_agents\agents\researcher.py", line 36, in run_initial_research return {"task": task, "initial_research": await self.research(query=query, verbose=task.get("verbose"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\Documents\Python Workspace\gpt-researcher\multi_agents\agents\researcher.py", line 13, in research researcher = GPTResearcher(query=query, report_type=research_report, parent_query=parent_query, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\gpt_researcher\master\agent.py", line 55, in init__ self.retriever = get_retriever(self.cfg.retriever) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\gpt_researcher\master\actions.py", line 42, in get_retriever from gpt_researcher.retrievers import TavilySearch File "C:\Users\Tomas\anaconda3\envs\gpt\Lib\site-packages\gpt_researcher\retrievers__init__.py", line 8, in from .custom.custom import CustomRetriever ModuleNotFoundError: No module named 'gpt_researcher.retrievers.custom'

GabrieleRisso commented 1 week ago

same here using pip version. data: { detail: "No module named 'gpt_researcher.retrievers.custom'" }

JustUser1410 commented 1 week ago

This is caused by missing __init__.py file inside \gpt_researcher\retrievers\custom

Simply add empty file \gpt_researcher\retrievers\custom\__init__.py Then rebuild and reinstall gpt_researcher.

Not sure if that's the right solution but it works.

assafelovic commented 1 week ago

Thanks for raising this fixed in latest commit please pull latest to fix the issue: https://github.com/assafelovic/gpt-researcher/commit/a4a3ab3e1ad41779f706900d04880e58cdf67c87