BabyAGI 是一个用于自构建自主代理的实验框架

 这个最新的 BabyAGI 是一个用于自构建自主代理的实验框架

核心是一个新的函数框架 (functionz),用于存储、管理和执行数据库中的函数。它提供了一个基于图形的结构,用于跟踪导入、依赖函数和身份验证密钥,并具有自动加载和全面的日志记录功能。此外,它还附带一个用于管理函数、运行更新和查看日志的控制面板。

官网:https://github.com/yoheinakajima/babyagi

安装

pip install babyagi

启动 

import babyagi

if __name__ == "__main__":
    app = babyagi.create_app('/dashboard')
    app.run(host='0.0.0.0', port=8080)

登录

http://127.0.0.1:8080/

其实是这里

http://192.168.0.98:8080/dashboard/

页面显示:

BabyAGI 是一个用于自构建自主代理的实验框架_第1张图片

这个展示页面有什么用呢?

basic使用

import babyagi

# Register a simple function
@babyagi.register_function()
def world():
    return "world"

# Register a function that depends on 'world'
@babyagi.register_function(dependencies=["world"])
def hello_world():
    x = world()
    return f"Hello {x}!"

# Execute the function
print(babyagi.hello_world())  # Output: Hello world!

if __name__ == "__main__":
    app = babyagi.create_app('/dashboard')
    app.run(host='0.0.0.0', port=8080)

比如在192.168.0.16浏览:

http://192.168.0.16:8080/dashboard/

 可以看到新写的world和hello_world这两个函数。BabyAGI 是一个用于自构建自主代理的实验框架_第2张图片

Function Metadata函数元数据

Functions can be registered with metadata to enhance their capabilities and manage their relationships. Here's a more comprehensive example of function metadata, showing logical usage of all fields:

函数可以注册到元数据中,以增强其功能并管理它们之间的关系。下面是一个更全面的函数元数据示例,显示了所有字段的逻辑用法:

import babyagi

@babyagi.register_function(
    imports=["math"],
    dependencies=["circle_area"],
    key_dependencies=["openai_api_key"],
    metadata={
        "description": "Calculates the volume of a cylinder using the circle_area function."
    }
)
def cylinder_volume(radius, height):
    import math
    area = circle_area(radius)
    return area * height

Available Metadata Fields:

  • imports: List of external libraries the function depends on.
  • dependencies: List of other functions this function depends on.
  • key_dependencies: List of secret keys required by the function.
  • metadata["description"]: A description of what the function does.

总结

这个软件不错,但是后面没有更新了,证明后劲不足!

所以只是关注,未花费精力去使用。

你可能感兴趣的:(人工智能,python,开发语言)