assafelovic / gpt-researcher

LLM based autonomous agent that conducts local and web research on any topic and generates a comprehensive report with citations.
https://gptr.dev
Apache License 2.0
14.95k stars 2k forks source link

RETRIVER setting #922

Closed peiyaoli closed 2 weeks ago

peiyaoli commented 1 month ago

Describe the bug It looks like we cannot set RETRIVER solely to duckduckgo or others.

It always throw an exception about Exception: Tavily API key not found. Please set the TAVILY_API_KEY environment variable.

danieldekay commented 1 month ago

How did you set it?

assafelovic commented 1 month ago

Hey @peiyaoli can you try now? I just pushed a fix here: https://github.com/assafelovic/gpt-researcher/pull/924

Please pull latest version

ntheodorg commented 1 month ago

the issue is still ongoing, even with using the latest commits

Traceback (most recent call last):
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 242, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/middleware/errors.py", line 152, in __call__
    await self.app(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in __call__
    await self.app(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/routing.py", line 362, in handle
    await self.app(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/routing.py", line 95, in app
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/starlette/routing.py", line 93, in app
    await func(session)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/multi_agents/.env/lib/python3.12/site-packages/fastapi/routing.py", line 383, in app
    await dependant.call(**solved_result.values)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/server/server.py", line 142, in websocket_endpoint
    await handle_websocket_communication(websocket, manager)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/server/server_utils.py", line 117, in handle_websocket_communication
    await handle_start_command(websocket, data, manager)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/server/server_utils.py", line 28, in handle_start_command
    report = await manager.start_streaming(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/server/websocket_manager.py", line 61, in start_streaming
    report = await run_agent(task, report_type, report_source, source_urls, tone, websocket, headers)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/server/websocket_manager.py", line 73, in run_agent
    researcher = DetailedReport(
                 ^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/backend/report_type/detailed_report/detailed_report.py", line 40, in __init__
    self.main_task_assistant = GPTResearcher(
                               ^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/gpt_researcher/master/agent/master.py", line 43, in __init__
    self.cfg = Config(config_path)
               ^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/gpt_researcher/config/config.py", line 22, in __init__
    self._set_attributes(config_to_use)
  File "/mnt/d/Theo/__ResearchAI/gpt-researcher/gpt_researcher/config/config.py", line 36, in _set_attributes
    self.retrievers = self.parse_retrievers(os.environ["RETRIEVER"])
                                            ~~~~~~~~~~^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'RETRIEVER'
assafelovic commented 1 month ago

Did you set RETRIEVER=duckduckgo?

ntheodorg commented 1 month ago

i have followed the instructions from https://docs.gptr.dev/docs/gpt-researcher/getting-started/getting-started There is no information on RETRIEVER and I want to use the default, TAVILY

assafelovic commented 1 month ago

You're right there was a bug. Just merged a HUGE PR that also includes a fix for that: https://github.com/assafelovic/gpt-researcher/pull/925

assafelovic commented 1 month ago

Please pull and try again

assafelovic commented 1 month ago

@ntheodorg can you please update if it's resolved?

ntheodorg commented 4 weeks ago

yup, it solved my observed issue