大家好,我想向 Ruby China 社区介绍我开发的开源 AGI 框架 - Minion。
Minion 是一个设计用于执行各种类型查询的开源 AGI 框架,它提供了一系列展示其灵活性和智能性的功能。框架采用循环优化的工作方式,能够不断改进解决方案直到达到满意的结果。
出色的性能表现:在多个基准测试中取得了令人印象深刻的结果
灵活的任务处理能力:
智能迭代的工作流程:
不同例子的代码(参见 examples/smart_minion/brain.py
) 中。您可以通过修改代码来尝试不同的示例,因为各种场景已经被注释掉以便于测试。
#数学例子
obs, score, *_ = await brain.step(query="what's the solution 234*568")
print(obs)
#game 24例子
obs, score, *_ = await brain.step(query="what's the solution for game of 24 for 4 3 9 8")
print(obs)
obs, score, *_ = await brain.step(query="what's the solution for game of 24 for 2 5 11 8")
print(obs)
#解方程例子
obs, score, *_ = await brain.step(query="solve x=1/(1-beta^2*x) where beta=0.85")
print(obs)
#写小说例子
obs, score, *_ = await brain.step(
query="Write a 500000 characters novel named 'Reborn in Skyrim'. "
"Fill the empty nodes with your own ideas. Be creative! Use your own words!"
"I will tip you $100,000 if you write a good novel."
"Since the novel is very long, you may need to divide it into subtasks."
)
print(obs)
#解aime例子
cache_plan = os.path.join(current_file_dir, "aime", "plan_gpt4o.1.json")
obs, score, *_ = await brain.step(
query="Every morning Aya goes for a $9$-kilometer-long walk and stops at a coffee shop afterwards. When she walks at a constant speed of $s$ kilometers per hour, the walk takes her 4 hours, including $t$ minutes spent in the coffee shop. When she walks $s+2$ kilometers per hour, the walk takes her 2 hours and 24 minutes, including $t$ minutes spent in the coffee shop. Suppose Aya walks at $s+\frac{1}{2}$ kilometers per hour. Find the number of minutes the walk takes her, including the $t$ minutes spent in the coffee shop.",
route="cot",
dataset="aime 2024",
cache_plan=cache_plan,
)
print(obs)
cache_plan = os.path.join(current_file_dir, "aime", "plan_gpt4o.7.json")
#解方程例子
obs, score, *_ = await brain.step(
query="Find the largest possible real part of\[(75+117i)z+\frac{96+144i}{z}\]where $z$ is a complex number with $|z|=4$.",
route="cot",
dataset="aime 2024",
cache_plan=cache_plan,
)
print(obs)
# 编程例子
test_data = {
"task_id": "HumanEval/88",
"prompt": "\ndef sort_array(array):\n \"\"\"\n Given an array of non-negative integers, return a copy of the given array after sorting,\n you will sort the given array in ascending order if the sum( first index value, last index value) is odd,\n or sort it in descending order if the sum( first index value, last index value) is even.\n\n Note:\n * don't change the given array.\n\n Examples:\n * sort_array([]) => []\n * sort_array([5]) => [5]\n * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5]\n * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0]\n \"\"\"\n",
"entry_point": "sort_array",
"test": ["assert candidate([]) == []",
"assert candidate([5]) == [5]",
"assert candidate([2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]",
"assert candidate([2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]"]
}
obs, score, *_ = await brain.step(
query=test_data["prompt"],
route="python",
post_processing="extract_python",
entry_point=test_data["entry_point"],
check=10,
check_route="ldb_check",
dataset="HumanEval",
metadata={"test_cases": test_data["test"]} # 添加测试用例到 metadata
)
print(obs)
框架设计基于最新的神经科学研究成果和机器学习算法,能够在多变的环境中自我调整,以实现更高效的智能推理和决策。
git clone https://github.com/femto/minion.git && cd minion && pip install -r requirements.txt
cp config/config.yaml.example config/config.yaml
cp config/.env.example config/.env
然后编辑 config/config.yaml:
models:
"default":
api_type: "openai"
base_url: "${DEFAULT_BASE_URL}"
api_key: "${DEFAULT_API_KEY}"
model: "deepseek-chat"
temperature: 0
接着编辑 config/.env:
DEFAULT_API_KEY=sk-xxx
DEFAULT_BASE_URL=base_url
DEFAULT_MODEL=...
docker build -t intercode-python -f docker/python.Dockerfile .
brain = Brain() # 默认将使用 docker python 环境
python docker/utils/python_server.py --port 3007
brain = Brain(python_env=RpycPythonEnv(port=3007))
查看这些演示视频,了解 Minion 的实际应用:
加入我们的 Discord 社区,与其他 Minion 用户交流,获取支持,并了解最新动态。
与现有的 AI 解决方案相比,Minion 框架不仅能够支持复杂的多任务处理,还能适应不同领域的需求。其模块化设计允许用户根据具体需求进行功能定制和扩展,从而提高智能系统的灵活性和适用性。
欢迎大家试用并提供反馈!如果你对 AGI 和人工智能感兴趣,Minion 将是一个很好的工具和学习资源。