qwen-agent项目部署

1、下载qwen-agent

https://github.com/QwenLM/Qwen-Agent

2、安装依赖环境

pip3 install -r requirements.txt

自定义Tool

cd qwen_agent/tools

在这里插入图片描述
参考其他的工具,我这里创建了一个查询手机号归属地的工具get_mobile_address.py:

import json
import urllib.parse
from typing import Union

from qwen_agent.tools.base import BaseTool, register_tool


@register_tool('get_mobile_address')
class MobileAddress(BaseTool):
    description = '手机号归属地查询服务,输入手机号,返回该手机号的归属地。'
    parameters = [{
        'name': 'mobile',
        'type': 'string',
        'description': '输入的手机号',
        'required': True
    }]

    def call(self, params: Union[str, dict], **kwargs) -> str:
        params = self._verify_json_format_args(params)

        prompt = params['mobile']
        url = "https://eolink.o.apispace.com/teladress/teladress"
		payload = {"mobile":f"{prompt}"}
		headers = {
			"X-APISpace-Token":"v1a524e7ctm4h87illkgmxxxxxxxxx",
			"Content-Type":"application/x-www-form-urlencoded"
		}
		response=requests.request("POST", url, data=payload, headers=headers)
		return response.text

工具创建好之后,还需要在__init__.py中添加,要不然加载该工具的时候会报错:
在这里插入图片描述

调用工具

创建一个通用的工具调用服务:

import json
import os

import json5
import urllib.parse
from qwen_agent.agents import Assistant
from qwen_agent.tools.base import BaseTool, register_tool

llm_cfg = {
    'model': 'qwen:14b',
    'model_server': 'http://10.8.xx.xxx:11434/v1',
    'generate_cfg': {
        'top_p': 0.8
    }
}
system = '你扮演一个助手,会调用工具'

tools = ['image_gen','get_mobile_address']
bot = Assistant(llm=llm_cfg,
                system_message=system,
                function_list=tools)

messages = []
while True:
    query = input('user question: ')
    messages.append({'role': 'user', 'content': query})
    response = []
    for response in bot.run(messages=messages):
        print('bot response:', response)
    messages.extend(response)

调用工具结果:

bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': ''}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile":'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "17'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "176'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "17692'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "176922'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223x'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xx'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxx'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码17'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码176'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码17692'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码176922'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223x'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xx'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxx'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n-'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n-'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n-'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:03'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:031'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n-'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人来自'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人来自哪个'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人来自哪个地区'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人来自哪个地区。'}]
bot response: [{'role': 'assistant', 'content': '', 'function_call': {'name': 'get_mobile_address', 'arguments': '{"mobile": "1769223xxxx"}'}}, {'role': 'function', 'content': '{"tradeNo":"9643077250786157612","chargeStatus":1,"message":"成功","data":{"orderNo":"111","handleTime":"2024-03-06 18:10:03","province":"河北","city":"保定","provinceCode":"0312","isp":"联通","mobile":"1769223xxxx","postCode":"071000","cityCode":"130600"},"code":"200000"}', 'name': 'get_mobile_address'}, {'role': 'assistant', 'content': '查询结果显示,电话号码1769223xxxx的归属地信息如下:\n\n- 省份:河北\n- 城市:保定\n- 省份代码:0312\n- 运营商:联通\n\n请根据这些信息来确认电话号码的主人来自哪个地区。'}]

当然,我们还可以将以上的代码改造成API服务,这样只要调用接口传入参数就可以了:

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from qwen_agent.agents import Assistant

app = FastAPI()

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

llm_cfg = {
    'model': 'qwen:14b',
    'model_server': 'http://10.8.xx.xxx:11434/v1',
    'generate_cfg': {
        'top_p': 0.8
    }
}

system = '你扮演一个助手,会调用工具'

tools = ['image_gen','get_mobile_address']
bot = Assistant(llm=llm_cfg,
                system_message=system,
                function_list=tools)

@app.post("/v1/tools", response_model=str)
def get_embeddings2(prompt: dict):
    messages = []
    messages.append(prompt)
    for response in bot.run(messages=messages):
        print('bot response:', response)

if __name__ == '__main__':
    uvicorn.run(app, host='0.0.0.0', port=8000, workers=1)

在这里插入图片描述

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐