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
发布评论