Qwen-Agent自定义Tool

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)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/435990.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

php常见的45个漏洞及解决方案

[TOC](太多了,目录只列出最重要的几个,剩下的同学们自己翻) PHP作为一种广泛应用的服务器端脚本语言,在历史上曾曝出过多种安全漏洞。以下是一些PHP漏洞的类别及其简要解释,以及如何解决这些问题&#xff1…

vue3引入字体

一、首先挑选字体 推荐个网站: DaFont - Download fonts 这个网站里面有很多字体供我们下载。点击圈起来的地方可以选择不同的字体样式预览。 英文不好就翻译一下吧(狗头)。 二、使用 比如我点击LCD类型的,数码类型的。 点击输…

视频剪辑如何提取伴奏?短视频剪辑有妙方

在多媒体处理中,音频的编辑和处理是不可或缺的一部分。很多时候,我们可能想要从一段视频或音频中提取伴奏,或者实现人声的分离,以便于进一步制作或混音。以下,将为您介绍一种简单而有效的方法来实现这一目标。 一、提取…

Docker部署ruoyi前后端分离项目

目录 一. 介绍前后端项目 二. 搭建局域网 2.1 创建网络 2.2 注意点 三. Redis 3.1 安装 3.2 配置redis.conf文件 3.3 测试 四. 安装MySQL 4.1 安装 4.2 配置my2.cnf文件 4.3 充许远程连接 五. 若依部署后端服务 5.1 数据导入 5.2 使用Dockerfile自定义镜像 5.3 运行…

MySQL-视图:视图概述、使用视图注意点、视图是否影响基本表

视图 一、视图概述二、使用视图注意点三、视图操作是否影响基本表 一、视图概述 在数据库管理系统中,视图(View)是一种虚拟表,它并不实际存储数据,而是基于一个或多个实际表的查询结果。视图提供了一种对数据库中数据…

VUE——v-cloak指令

VUE——v-cloak指令 属性选择器,可以控制vue实例化完成前的dom样式 功能:利用vue实例化后v-cloak属性会消失,设置其样式 官网介绍 没用前效果:当vue没渲染完前,界面效果会看到{{aboutCloak}}字符,影响用户…

腾讯云99元一年服务器,真香购买链接来了

腾讯云服务器99元一年是真的吗?真的,只是又降价了,现在只要61元一年,配置为2核2G3M轻量应用服务器,40GB SSD盘,腾讯云百科txybk.com分享腾讯云官方活动购买链接 https://curl.qcloud.com/oRMoSucP 活动打开…

kafka进阶(二)

文章目录 前言一、Ack机制二、ISR集合总结 前言 本篇主要介绍kafka 的 Ack机制 和 ISR集合 一、Ack机制 Kafka提供了三种不同的应答机制(ACK): acks0:这是最不可靠的模式。在这种模式下,生产者不会等待来自服务器的…

linux 安装OpenRestry

一、OpenRestry官网 openRestry中文官网 openRestry英文官网 二、OpenRestry搭建 可以参考官方提供的网址进行搭建:OpenRestry安装官网 ​ 三、开始安装 1、安装依赖库 yum install libtermcap-devel ncurses-devel libevent-devel readline-devel pcre-deve…

如何在“Ubuntu 服务器上使用MariaDB配置Galera集群”?

一、 安装好三个MariaDB数据库 如何使用“Ubuntu 20.04桌面版,安装MariaDB数据库“?win10系统?-CSDN博客 二、第一个node1,修改 sudo nano /etc/mysql/conf.d/galera.cnf [mysqld] binlog_formatROW default-storage-enginei…

微信小程序uniapp+django宠物医院挂号预约系统的 现41r1t

技术栈 小程序端运行软件 微信开发者工具/hbuiderx uni-app框架:使用Vue.js开发跨平台应用的前端框架,编写一套代码,可编译到Android、小程序等平台。 后端:python 前端:vue.jselementui 框架:django/fla…

新生儿睡眠抖动:温馨抚慰宝宝的安稳梦乡

引言 新生儿的睡眠过程常常伴随着轻微的抖动,对于许多父母来说,这可能会引起一些担忧。在这篇文章中,我们将探讨新生儿睡眠抖动的原因和注意事项,帮助父母更好地理解和处理宝宝的这种行为,为宝宝提供安心的睡眠环境。…

AmzTrends x TiDB Serverless:通过云原生改造实现全局成本降低 80%

本文介绍了厦门笛卡尔数据(AmzTrends)在面临数据存储挑战时,选择将其数据分析服务迁移到 TiDB Serverless 的思路和实践。通过全托管的数据库服务,AmzTrends 实现了全局成本降低 80% 的效果,同时也充分展示了 TiDB Ser…

车辆未冲洗监测报警摄像机

车辆未冲洗监测报警摄像机是一种用于监测车辆是否完成冲洗清洁的设备,通常用于洗车场、加油站等场所,以确保每辆车都能够得到适当清洗并提供警报功能。车辆未冲洗监测报警摄像机是一种智能安全设备,专门用于监测车辆是否被清洗冲洗干净的情况…

JavaScript编程艺术:深度解析计算机程序的构造与解释【文末送书-32】

文章目录 JavaScript编程艺术:深度解析计算机程序的构造与解释第一部分:程序的构造第二部分:程序的解释第三部分:实例分析 计算机程序的构造和解释(JavaScript版)【文末送书-32】 JavaScript编程艺术&#…

微信小程序如何跳转页面

1.wx.navigateTo:用于跳转到其他页面,并保留当前页面。通过该 API 跳转后,可以通过返回按钮回到原页面。 wx.navigateTo({url: /pages/otherPage/otherPage })2.wx.redirectTo:用于跳转到其他页面,并关闭当前页面。通…

用python给喜欢的主播自动发弹幕

写在前面 发弹幕只是其中一个小小的功能,还可以自动点赞、收藏、投币、自动播放、私信等等,但是我们只演示这个,其它的不做展示。 实现步骤 先打开一个视频或者直播,F12打开开发者工具,点击network。 然后点这个清空…

STM32学习7 按键扫描

STM32学习7 按键扫描 一、实验电路介绍二、按键GPIO初始化三、扫描原理1. GPIO引脚配置2. 状态轮询3. 按键状态检测4. 循环扫描的优缺点优点:缺点: 四、一次扫描与持续扫描五、代码实现1. 头文件定义2. 函数实现3. 主体函数 一、实验电路介绍 本实验使用…

PythonStudio 控件使用常用方式(八)SpeedButton

PythonStudio是一个极强的开发Python的IDE工具,它使用的是Delphi的控件,常用的内容是与Delphi一致的。但是相关文档并一定完整。现在我试试能否逐步把它的控件常用用法写一点点,也作为PythonStudio的参考。 SpeedButton是一组互斥按钮&#…

企业如何实现跨部门和员工之间的高效沟通协同?

在当今高度竞争和信息化的商业环境中,企业内部各部门和员工之间的沟通协同效率直接影响到企业的整体运营效果。那么,企业如何实现各部门和员工之间的高效沟通协同呢? 一、建立有效沟通机制与明确部门职责 要实现各部门和员工间的高效协同&…