AutoGen agent使用;调用本地LLM

编程入门 行业动态 更新时间:2024-10-23 11:33:53

<a href=https://www.elefans.com/category/jswz/34/1602564.html style=AutoGen agent使用;调用本地LLM"/>

AutoGen agent使用;调用本地LLM

参考:

安装:

pip install pyautogen

代码

本地LLM部署可以用fastchat、vllm等框架部署openai接口:

from autogen import AssistantAgent, UserProxyAgent, oai
## 调用本地模型对外的openai接口
config_list=[{"model": "/mnt/data/loong/AquilaChat2-7B","api_base": "http://localhost:10860/v1","api_type": "open_ai","api_key": "NULL", # just a placeholder}
]response = oai.Completion.create(config_list=config_list, prompt="Hi")
##构建agentassistant = AssistantAgent("assistant",llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy")##任务
user_proxy.initiate_chat(assistant, message="计算下2的10次方等于多少", config_list=config_list)

更多推荐

AutoGen agent使用;调用本地LLM

本文发布于:2023-11-17 11:46:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642565.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AutoGen   agent   LLM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!