微软autogen-进一步使用2

本着好奇的态度,进一步看了下它的例子,发现有些惊艳: https://github.com/microsoft/autogen/blob/main/notebook/agentchat_teaching.ipynb 考虑这样一个场景:需要找到某个主题的研究论文,对应用领域进行分类,并绘制每个领域的论文数量的条形图。

首先解决墙内访问OpenAI的问题, 继续使用openai-forward 代理到自己的转发服务上,修改代码如下:

import autogen

config_list =[
    {
        "model": "gpt-4",
        "api_key": "fk-xxxx",
        "api_base": "http://47.251.x.xxx:18088/v1"
    }
]

llm_config={
    "request_timeout": 600,
    "seed": 44,  # change the seed for different trials
    # "config_list": autogen.config_list_from_json(
    #     "OAI_CONFIG_LIST",
    #     filter_dict={"model": ["gpt-4-32k"]},
    # ),
    "config_list":config_list,
    "temperature": 0,
}

//然后告诉assistant 代理:到arxiv搜对应主题的文章
task1 = """
Find arxiv papers that show how are people studying trust calibration in AI based systems 
"""

user_proxy.initiate_chat(assistant, message=task1)

然后代理给出的结论答案很是厉害:
1.直接代码都给写好了。 包括搜索arxiv的方法、解析方法,都提供了实现。

输出也是比较有效: 完整的标题、作者、摘要

任务2:进行解读、摘要任务,也是非常顺利的完成。 甚至还在对话和执行中,能纠正变量缺失、依赖包缺失的问题。

task2 = “analyze the above the results to list the application domains studied by these papers “

user_proxy.initiate_chat(assistant, message=task2, clear_history=False)

任务3:用图标展示分析数据:

task3 = “””Use this data to generate a bar chart of domains and number of papers in that domain and save to a file “””

user_proxy.initiate_chat(assistant, message=task3, clear_history=False)

more:Create Recipes 甚至可以把上面的任务,定义成模板,然后进行复用! –因为涉及输入比较大,需要32k上下文模型


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注