From 62dff7aabc199cd65fe64ce279fb421372bdc25c Mon Sep 17 00:00:00 2001 From: assafelovic Date: Mon, 13 Nov 2023 19:05:50 +0200 Subject: [PATCH 1/5] added more logs --- gpt_researcher/master/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpt_researcher/master/agent.py b/gpt_researcher/master/agent.py index 11f780fe4..ee2ba92ec 100644 --- a/gpt_researcher/master/agent.py +++ b/gpt_researcher/master/agent.py @@ -87,9 +87,9 @@ async def run_sub_query(self, sub_query): new_search_urls = await self.get_new_urls([url.get("href") for url in search_results]) # Scrape Urls - await stream_output("logs", f"📝 Summarizing sources...\n", self.websocket) + await stream_output("logs", f"📝 Scraping urls {new_search_urls}...\n", self.websocket) content = scrape_urls(new_search_urls, self.cfg) - + await stream_output("logs", f"Researching for relevant information...\n", self.websocket) # Summarize Raw Data summary = await summarize(query=sub_query, content=content, agent_role_prompt=self.role, cfg=self.cfg, websocket=self.websocket) From 257a9564b7ff4a642cff3a285d8094def89b6552 Mon Sep 17 00:00:00 2001 From: assafelovic Date: Mon, 13 Nov 2023 19:22:36 +0200 Subject: [PATCH 2/5] modified default word report --- gpt_researcher/config/config.py | 2 +- gpt_researcher/master/agent.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gpt_researcher/config/config.py b/gpt_researcher/config/config.py index 07cd89ad9..8a0ee2f16 100644 --- a/gpt_researcher/config/config.py +++ b/gpt_researcher/config/config.py @@ -20,7 +20,7 @@ def __init__(self, config_file: str = None): self.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" \ " Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" self.memory_backend = "local" - self.total_words = 1000 + self.total_words = 1200 self.report_format = "apa" self.max_iterations = 1 diff --git a/gpt_researcher/master/agent.py b/gpt_researcher/master/agent.py index ee2ba92ec..80509a30e 100644 --- a/gpt_researcher/master/agent.py +++ b/gpt_researcher/master/agent.py @@ -87,9 +87,9 @@ async def run_sub_query(self, sub_query): new_search_urls = await self.get_new_urls([url.get("href") for url in search_results]) # Scrape Urls - await stream_output("logs", f"📝 Scraping urls {new_search_urls}...\n", self.websocket) + # await stream_output("logs", f"📝Scraping urls {new_search_urls}...\n", self.websocket) content = scrape_urls(new_search_urls, self.cfg) - await stream_output("logs", f"Researching for relevant information...\n", self.websocket) + await stream_output("logs", f"🤔Researching for relevant information...\n", self.websocket) # Summarize Raw Data summary = await summarize(query=sub_query, content=content, agent_role_prompt=self.role, cfg=self.cfg, websocket=self.websocket) From 5aa73f7b4958a480aaf18f1268b45fce5f1b836e Mon Sep 17 00:00:00 2001 From: assafelovic Date: Mon, 13 Nov 2023 19:27:40 +0200 Subject: [PATCH 3/5] refactored permchain --- .../README.md | 0 .../editor_actors/editor.py | 0 .../research_team.py | 0 .../researcher.py | 0 .../reviser_actors/reviser.py | 0 .../search_actors/gpt_researcher.py | 0 .../search_actors/search_api.py | 0 .../{permchain_example => permchain_agents}/test.py | 12 ++++++------ .../writer_actors/writer.py | 0 9 files changed, 6 insertions(+), 6 deletions(-) rename examples/{permchain_example => permchain_agents}/README.md (100%) rename examples/{permchain_example => permchain_agents}/editor_actors/editor.py (100%) rename examples/{permchain_example => permchain_agents}/research_team.py (100%) rename examples/{permchain_example => permchain_agents}/researcher.py (100%) rename examples/{permchain_example => permchain_agents}/reviser_actors/reviser.py (100%) rename examples/{permchain_example => permchain_agents}/search_actors/gpt_researcher.py (100%) rename examples/{permchain_example => permchain_agents}/search_actors/search_api.py (100%) rename examples/{permchain_example => permchain_agents}/test.py (64%) rename examples/{permchain_example => permchain_agents}/writer_actors/writer.py (100%) diff --git a/examples/permchain_example/README.md b/examples/permchain_agents/README.md similarity index 100% rename from examples/permchain_example/README.md rename to examples/permchain_agents/README.md diff --git a/examples/permchain_example/editor_actors/editor.py b/examples/permchain_agents/editor_actors/editor.py similarity index 100% rename from examples/permchain_example/editor_actors/editor.py rename to examples/permchain_agents/editor_actors/editor.py diff --git a/examples/permchain_example/research_team.py b/examples/permchain_agents/research_team.py similarity index 100% rename from examples/permchain_example/research_team.py rename to examples/permchain_agents/research_team.py diff --git a/examples/permchain_example/researcher.py b/examples/permchain_agents/researcher.py similarity index 100% rename from examples/permchain_example/researcher.py rename to examples/permchain_agents/researcher.py diff --git a/examples/permchain_example/reviser_actors/reviser.py b/examples/permchain_agents/reviser_actors/reviser.py similarity index 100% rename from examples/permchain_example/reviser_actors/reviser.py rename to examples/permchain_agents/reviser_actors/reviser.py diff --git a/examples/permchain_example/search_actors/gpt_researcher.py b/examples/permchain_agents/search_actors/gpt_researcher.py similarity index 100% rename from examples/permchain_example/search_actors/gpt_researcher.py rename to examples/permchain_agents/search_actors/gpt_researcher.py diff --git a/examples/permchain_example/search_actors/search_api.py b/examples/permchain_agents/search_actors/search_api.py similarity index 100% rename from examples/permchain_example/search_actors/search_api.py rename to examples/permchain_agents/search_actors/search_api.py diff --git a/examples/permchain_example/test.py b/examples/permchain_agents/test.py similarity index 64% rename from examples/permchain_example/test.py rename to examples/permchain_agents/test.py index 339e0fb16..c8b0a86a7 100644 --- a/examples/permchain_example/test.py +++ b/examples/permchain_agents/test.py @@ -2,12 +2,12 @@ import os, sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) -from examples.permchain_example.researcher import Researcher -from examples.permchain_example.editor_actors.editor import EditorActor -from examples.permchain_example.reviser_actors.reviser import ReviserActor -from examples.permchain_example.search_actors.gpt_researcher import GPTResearcherActor -from examples.permchain_example.writer_actors.writer import WriterActor -from examples.permchain_example.research_team import ResearchTeam +from examples.permchain_agents.researcher import Researcher +from examples.permchain_agents.editor_actors.editor import EditorActor +from examples.permchain_agents.reviser_actors.reviser import ReviserActor +from examples.permchain_agents.search_actors.gpt_researcher import GPTResearcherActor +from examples.permchain_agents.writer_actors.writer import WriterActor +from examples.permchain_agents.research_team import ResearchTeam from scraping.processing.text import md_to_pdf diff --git a/examples/permchain_example/writer_actors/writer.py b/examples/permchain_agents/writer_actors/writer.py similarity index 100% rename from examples/permchain_example/writer_actors/writer.py rename to examples/permchain_agents/writer_actors/writer.py From 8551523c93ef1ba218308e159d2f87dfed932a93 Mon Sep 17 00:00:00 2001 From: assafelovic Date: Mon, 13 Nov 2023 19:32:56 +0200 Subject: [PATCH 4/5] modified research words --- gpt_researcher/config/config.py | 2 +- gpt_researcher/master/functions.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gpt_researcher/config/config.py b/gpt_researcher/config/config.py index 8a0ee2f16..07cd89ad9 100644 --- a/gpt_researcher/config/config.py +++ b/gpt_researcher/config/config.py @@ -20,7 +20,7 @@ def __init__(self, config_file: str = None): self.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" \ " Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" self.memory_backend = "local" - self.total_words = 1200 + self.total_words = 1000 self.report_format = "apa" self.max_iterations = 1 diff --git a/gpt_researcher/master/functions.py b/gpt_researcher/master/functions.py index 3d012d290..47fce929c 100644 --- a/gpt_researcher/master/functions.py +++ b/gpt_researcher/master/functions.py @@ -220,7 +220,7 @@ async def generate_report(query, context, agent_role_prompt, report_type, websoc return report -async def stream_output(type, output, websocket=None): +async def stream_output(type, output, websocket=None, logging=True): """ Streams output to the websocket Args: @@ -230,6 +230,6 @@ async def stream_output(type, output, websocket=None): Returns: None """ - if not websocket: + if not websocket or logging: return print(output) await websocket.send_json({"type": type, "output": output}) From ef794cf06868be0e76e52160e012eb9ebf08f54a Mon Sep 17 00:00:00 2001 From: assafelovic Date: Mon, 13 Nov 2023 19:41:21 +0200 Subject: [PATCH 5/5] modified gpt researcher logs --- gpt_researcher/master/functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gpt_researcher/master/functions.py b/gpt_researcher/master/functions.py index 47fce929c..c8cfca29d 100644 --- a/gpt_researcher/master/functions.py +++ b/gpt_researcher/master/functions.py @@ -231,5 +231,7 @@ async def stream_output(type, output, websocket=None, logging=True): None """ if not websocket or logging: - return print(output) - await websocket.send_json({"type": type, "output": output}) + print(output) + + if websocket: + await websocket.send_json({"type": type, "output": output})