From 471f5d68ea0943f91372b8ae8b5500423ee35003 Mon Sep 17 00:00:00 2001 From: unknown <10066332@qq.com> Date: Tue, 12 Sep 2023 22:04:07 +0800 Subject: [PATCH 1/8] adding an action --- metagpt/actions/detail_mining.py | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 metagpt/actions/detail_mining.py diff --git a/metagpt/actions/detail_mining.py b/metagpt/actions/detail_mining.py new file mode 100644 index 000000000..8452ae2aa --- /dev/null +++ b/metagpt/actions/detail_mining.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +@Time : 2023/9/12 17:45 +@Author : fisherdeng +@File : detail_mining.py +""" + +from metagpt.actions import Action, ActionOutput +from metagpt.logs import logger + +PROMPT_TEMPLATE = """ +##讨论目标 +{topic} + +##讨论记录 +{record} + +##Format example +{format_example} +----- + +任务: 参考 ##讨论目标 和 ##讨论记录 进一步询问你感兴趣的细节,字数不多于150字 +特别注意1:你只是单纯地询问,不要赞同或否定任何人的任何观点 +特别注意2:本次输出,仅包含 ##OUTPUT 这一主题,不要增加、减少或改变主题。输出时,以'##OUTPUT'开头,然后马上换行,再正式输出内容,仔细参考"##Format example"中的格式。 +""" +FORMAT_EXAMPLE = """ + +## + +##OUTPUT +...(请在这里输出你想询问的细节) + +## + +## +""" +OUTPUT_MAPPING = { + "OUTPUT": (str, ...), +} + + +class DetailMining(Action): + def __init__(self, name="", context=None, llm=None): + super().__init__(name, context, llm) + + async def run(self, topic, record) -> ActionOutput: + + prompt = PROMPT_TEMPLATE.format(topic,record,format_example=FORMAT_EXAMPLE) + rsp = await self._aask_v1(prompt, "detail_mining", OUTPUT_MAPPING) + return rsp From 307ff817901b6f5050c67a430c3184d3c89020d0 Mon Sep 17 00:00:00 2001 From: unknown <10066332@qq.com> Date: Tue, 12 Sep 2023 23:39:36 +0800 Subject: [PATCH 2/8] adding an action --- metagpt/actions/detail_mining.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/metagpt/actions/detail_mining.py b/metagpt/actions/detail_mining.py index 8452ae2aa..5751b86d2 100644 --- a/metagpt/actions/detail_mining.py +++ b/metagpt/actions/detail_mining.py @@ -5,31 +5,30 @@ @Author : fisherdeng @File : detail_mining.py """ - from metagpt.actions import Action, ActionOutput from metagpt.logs import logger PROMPT_TEMPLATE = """ -##讨论目标 +##TOPIC {topic} -##讨论记录 +##RECORD {record} ##Format example {format_example} ----- -任务: 参考 ##讨论目标 和 ##讨论记录 进一步询问你感兴趣的细节,字数不多于150字 -特别注意1:你只是单纯地询问,不要赞同或否定任何人的任何观点 -特别注意2:本次输出,仅包含 ##OUTPUT 这一主题,不要增加、减少或改变主题。输出时,以'##OUTPUT'开头,然后马上换行,再正式输出内容,仔细参考"##Format example"中的格式。 +Task: Refer to the "##TOPIC" (discussion objectives) and "##RECORD" (discussion records) to further inquire about the details that interest you, within a word limit of 150 words. +Special Note 1: Your intention is solely to ask questions without endorsing or negating any individual's viewpoints. +Special Note 2: This output should only include the topic "##OUTPUT". Do not add, remove, or modify the topic. Begin the output with '##OUTPUT', followed by an immediate line break, and then proceed to provide the content in the specified format as outlined in the "##Format example" section. """ FORMAT_EXAMPLE = """ ## ##OUTPUT -...(请在这里输出你想询问的细节) +...(Please provide the specific details you would like to inquire about here.) ## @@ -41,11 +40,12 @@ OUTPUT_MAPPING = { class DetailMining(Action): + """This class allows LLM to further mine noteworthy details based on specific "##TOPIC"(discussion topic) and "##RECORD" (discussion records), thereby deepening the discussion. + """ def __init__(self, name="", context=None, llm=None): super().__init__(name, context, llm) async def run(self, topic, record) -> ActionOutput: - - prompt = PROMPT_TEMPLATE.format(topic,record,format_example=FORMAT_EXAMPLE) + prompt = PROMPT_TEMPLATE.format(topic, record, format_example=FORMAT_EXAMPLE) rsp = await self._aask_v1(prompt, "detail_mining", OUTPUT_MAPPING) return rsp From b5aa86cc450490aad036fdc20a75b045fce8db14 Mon Sep 17 00:00:00 2001 From: unknown <10066332@qq.com> Date: Fri, 15 Sep 2023 00:05:43 +0800 Subject: [PATCH 3/8] Adding an action --- metagpt/actions/detail_mining.py | 3 ++- tests/metagpt/actions/test_detail_mining.py | 23 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/metagpt/actions/test_detail_mining.py diff --git a/metagpt/actions/detail_mining.py b/metagpt/actions/detail_mining.py index 5751b86d2..e29d6911b 100644 --- a/metagpt/actions/detail_mining.py +++ b/metagpt/actions/detail_mining.py @@ -22,6 +22,7 @@ PROMPT_TEMPLATE = """ Task: Refer to the "##TOPIC" (discussion objectives) and "##RECORD" (discussion records) to further inquire about the details that interest you, within a word limit of 150 words. Special Note 1: Your intention is solely to ask questions without endorsing or negating any individual's viewpoints. Special Note 2: This output should only include the topic "##OUTPUT". Do not add, remove, or modify the topic. Begin the output with '##OUTPUT', followed by an immediate line break, and then proceed to provide the content in the specified format as outlined in the "##Format example" section. +Special Note 3: The output should be in the same language as the input. """ FORMAT_EXAMPLE = """ @@ -46,6 +47,6 @@ class DetailMining(Action): super().__init__(name, context, llm) async def run(self, topic, record) -> ActionOutput: - prompt = PROMPT_TEMPLATE.format(topic, record, format_example=FORMAT_EXAMPLE) + prompt = PROMPT_TEMPLATE.format(topic=topic, record=record, format_example=FORMAT_EXAMPLE) rsp = await self._aask_v1(prompt, "detail_mining", OUTPUT_MAPPING) return rsp diff --git a/tests/metagpt/actions/test_detail_mining.py b/tests/metagpt/actions/test_detail_mining.py new file mode 100644 index 000000000..c9d5331f9 --- /dev/null +++ b/tests/metagpt/actions/test_detail_mining.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +@Time : 2023/9/13 00:26 +@Author : fisherdeng +@File : test_detail_mining.py +""" +import pytest + +from metagpt.actions.detail_mining import DetailMining +from metagpt.logs import logger + +@pytest.mark.asyncio +async def test_detail_mining(): + topic = "如何做一个生日蛋糕" + record = "我认为应该先准备好材料,然后再开始做蛋糕。" + detail_mining = DetailMining("detail_mining") + rsp = await detail_mining.run(topic=topic, record=record) + logger.info(f"{rsp.content=}") + + assert '##OUTPUT' in rsp.content + assert '蛋糕' in rsp.content + From 37265312c07b0fdd9bea8b475be999a6498d6a66 Mon Sep 17 00:00:00 2001 From: femto Date: Thu, 21 Sep 2023 15:28:20 +0800 Subject: [PATCH 4/8] add semantic-kernel==0.3.10.dev0 to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 2e483a050..45943d8bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,3 +40,4 @@ libcst==1.0.1 qdrant-client==1.4.0 open-interpreter==0.1.3 ta==0.10.2 +semantic-kernel==0.3.10.dev0 From 9860e0d510c67f766e572d6eae5748cfca785cbe Mon Sep 17 00:00:00 2001 From: stellaHSR <34952977+stellaHSR@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:51:13 +0800 Subject: [PATCH 5/8] Update search_engine.py add __future__ import to avoid error in py3.9 --- metagpt/tools/search_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metagpt/tools/search_engine.py b/metagpt/tools/search_engine.py index 4ac078714..d5061d7cc 100644 --- a/metagpt/tools/search_engine.py +++ b/metagpt/tools/search_engine.py @@ -5,7 +5,7 @@ @Author : alexanderwu @File : search_engine.py """ -# from __future__ import annotations +from __future__ import annotations   import importlib from typing import Callable, Coroutine, Literal, overload @@ -13,7 +13,7 @@ from typing import Callable, Coroutine, Literal, overload from semantic_kernel.skill_definition import sk_function from metagpt.config import CONFIG -from metagpt.tools import SearchEngineType +from metagpt.tools import SearchEngineType  class SkSearchEngine: From a89b2a1a6dece1da90c36111f8d5bcfcc4f5e3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=A3=92=E6=A3=92?= Date: Thu, 21 Sep 2023 16:19:37 +0800 Subject: [PATCH 6/8] fix: open-interpreter dependency conflicts. --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2e483a050..3c3063b5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,7 @@ PyYAML==6.0 # sentence_transformers==2.2.2 setuptools==65.6.3 tenacity==8.2.2 -tiktoken==0.3.3 +tiktoken==0.4.0 tqdm==4.64.0 #unstructured[local-inference] # playwright @@ -38,5 +38,5 @@ typing-inspect==0.8.0 typing_extensions==4.5.0 libcst==1.0.1 qdrant-client==1.4.0 -open-interpreter==0.1.3 +open-interpreter==0.1.4; python_version>"3.9" ta==0.10.2 From a74f78f6daee320bba2ba6aa8fb9e1dd936fc86b Mon Sep 17 00:00:00 2001 From: stellaHSR <34952977+stellaHSR@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:49:57 +0800 Subject: [PATCH 7/8] Update search_engine.py rm useless space --- metagpt/tools/search_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metagpt/tools/search_engine.py b/metagpt/tools/search_engine.py index d5061d7cc..c36be9484 100644 --- a/metagpt/tools/search_engine.py +++ b/metagpt/tools/search_engine.py @@ -5,7 +5,7 @@ @Author : alexanderwu @File : search_engine.py """ -from __future__ import annotations   +from __future__ import annotations import importlib from typing import Callable, Coroutine, Literal, overload @@ -13,7 +13,7 @@ from typing import Callable, Coroutine, Literal, overload from semantic_kernel.skill_definition import sk_function from metagpt.config import CONFIG -from metagpt.tools import SearchEngineType  +from metagpt.tools import SearchEngineType class SkSearchEngine: From 871bef481ba8453a17e7543ce81f659123e1b0a0 Mon Sep 17 00:00:00 2001 From: MORDECAI ETUKUDO <103220475+martcpp@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:53:16 +0100 Subject: [PATCH 8/8] Update FAQ-EN.md added some important video links for tutorial --- docs/FAQ-EN.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/FAQ-EN.md b/docs/FAQ-EN.md index b5ae9184b..4c86ed150 100644 --- a/docs/FAQ-EN.md +++ b/docs/FAQ-EN.md @@ -17,14 +17,15 @@ 1. EN 1. Demo Video: [MetaGPT: Multi-Agent AI Programming Framework](https://www.youtube.com/watch?v=8RNzxZBTW8M) - 1. Tutorial: [MetaGPT: Deploy POWERFUL Autonomous Ai Agents BETTER Than SUPERAGI!](https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s) + 2. Tutorial: [MetaGPT: Deploy POWERFUL Autonomous Ai Agents BETTER Than SUPERAGI!](https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s) + 3. Author's thoughts video(EN): [MetaGPT Matthew Berman](https://youtu.be/uT75J_KG_aY?si=EgbfQNAwD8F5Y1Ak) 1. CN 1. Demo Video: [MetaGPT:一行代码搭建你的虚拟公司_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1NP411C7GW/?spm_id_from=333.999.0.0&vd_source=735773c218b47da1b4bd1b98a33c5c77) 1. Tutorial: [一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目](https://youtu.be/Bp95b8yIH5c) - 1. Author's thoughts video(CN): [MetaGPT作者深度解析直播回放_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1Ru411V7XL/?spm_id_from=333.337.search-card.all.click) - + 2. Author's thoughts video(CN): [MetaGPT作者深度解析直播回放_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1Ru411V7XL/?spm_id_from=333.337.search-card.all.click) + 3. ### How to become a contributor? @@ -153,6 +154,7 @@ 1. Youtube(CN):[一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目=一个软件公司产品经理+程序员](https://youtu.be/Bp95b8yIH5c) 1. Youtube(EN)https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s + 2. video(EN): [MetaGPT Matthew Berman](https://youtu.be/uT75J_KG_aY?si=EgbfQNAwD8F5Y1Ak) 1. openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details @@ -161,7 +163,7 @@ 1. What does "borg" mean in n_borg? - 1. https://en.wikipedia.org/wiki/Borg + 1. [Wikipedia borg meaning ](https://en.wikipedia.org/wiki/Borg) 1. The Borg civilization operates based on a hive or collective mentality, known as "the Collective." Every Borg individual is connected to the collective via a sophisticated subspace network, ensuring continuous oversight and guidance for every member. This collective consciousness allows them to not only "share the same thoughts" but also to adapt swiftly to new strategies. While individual members of the collective rarely communicate, the collective "voice" sometimes transmits aboard ships. 1. How to use the Claude API?