大模型上下文
--------------------message0-----------------
[{'role': 'user', 'content': '帮我计算一下2加3等于几?'}]
--------------------message0-----------------
---------------message1--------------------
[{'role': 'user', 'content': '帮我计算一下2加3等于几?'}]
---------------message1--------------------
----------------messages2----------------
[{'role': 'user', 'content': '帮我计算一下2加3等于几?'}, {'content': '我来帮你计算2加3等于多少。', 'refusal': None, 'role': 'assistant', 'annotations': None, 'audio': None, 'function_call': None, 'tool_calls': [{'id': 'call_00_fUHYws51ITauAnH3THJPFu4f', 'function': {'arguments': '{"x": 2, "y": 3}', 'name': 'add_tool'}, 'type': 'function', 'index': 0}]}]
----------------messages2----------------
----------------messages3----------------
message: [{'role': 'user', 'content': '帮我计算一下2加3等于几?'}, {'content': '我来帮您计算2加3等于多少。', 'refusal': None, 'role': 'assistant', 'annotations': None, 'audio': None, 'function_call': None, 'tool_calls': [{'id': 'call_00_qsM5roOryCWNopOcruecPHcP', 'function': {'arguments': '{"x": 2, "y": 3}', 'name': 'add_tool'}, 'type': 'function', 'index': 0}]}, {'role': 'tool', 'content': '5', 'tool_call_id': 'call_00_qsM5roOryCWNopOcruecPHcP'}]
tools: [{'type': 'function', 'function': {'name': 'add_tool', 'description': '\n 有两个数字相加的加法工具\n :param x: 第一个数字\n :param y: 第二个数字\n :return: 两个数字的和\n ', 'parameters': {'properties': {'x': {'title': 'X', 'type': 'integer'}, 'y': {'title': 'Y', 'type': 'integer'}}, 'required': ['x', 'y'], 'title': 'add_toolArguments', 'type': 'object'}}}, {'type': 'function', 'function': {'name': 'sub_tool', 'description': '\n 有两个数字相减的减法工具\n :param x: 第一个数字\n :param y: 第二个数字\n :return: 两个数字的差\n ', 'parameters': {'properties': {'x': {'title': 'X', 'type': 'integer'}, 'y': {'title': 'Y', 'type': 'integer'}}, 'required': ['x', 'y'], 'title': 'sub_toolArguments', 'type': 'object'}}}]
----------------messages3----------------
==== 最终的结果: 2加3等于5。
更多推荐
所有评论(0)