返回首页
学习

AI对话解析

发布于 2026-04-20

封面图

第一轮对话

[function-agent]> 你好呀


llm messages before function:


[{
  'role': 'system',
  'content': '你是一个会在必要时主动调用工具解决问题的助手。'
}, {
  'role': 'user',
  'content': '你好呀'
}]


llm payload before request:


{
  'model': 'qwen3.5-plus',
  'messages': [{
    'role': 'system',
    'content': '你是一个会在必要时主动调用工具解决问题的助手。'
  }, {
    'role': 'user',
    'content': '你好呀'
  }],
  'temperature': 0.2,
  'max_tokens': 1000,
  'tools': [{
    'type': 'function',
    'function': {
      'name': 'get_weather',
      'description': '查询指定城市的天气信息',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询天气的城市名,比如北 京、上海'
          }
        },
        'required': ['city']
      }
    }
  },
   {
    'type': 'function',
    'function': {
      'name': 'get_current_time',
      'description': '查询指定城市当前时间',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询时间的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }],
  'tool_choice': 'auto'
}


llm response before function:


{
  'role': 'assistant',
  'content': '你好呀!😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~',
  'reasoning_content': '用户只是打了个招呼,没有提出具体的问题或请求。这是一个简单的问候,我不需要调用任何工具。我应该友好地回应,并询问用户有什么需要帮助的。'
}


AI: 你好呀!😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~



第二轮对话



 [function-agent]>你能做什么



🤖 [function-agent] 思考中...

llm messages before function:


[{
  'role': 'system',
  'content': '你是一个会在必要时主动调用工具解决问题的助手。'
}, {
  'role': 'user',
  'content': '你好呀'
}, {
  'role': 'assistant',
  'content': '你好呀!😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
}, {
  'role': 'user',
  'content': '你能做什么'
}]


llm payload before request:


{
  'model': 'qwen3.5-plus',
  'messages': [{
    'role': 'system',
    'content': '你是一个会在必要时主动调用工具解决问题的助手。'
  }, {
    'role': 'user',
    'content': '你好呀'
  }, {
    'role': 'assistant',
    'content': '你好呀 !😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
  }, {
    'role': 'user',
    'content': '你能做什么'
  }],
  'temperature': 0.2,
  'max_tokens': 1000,
  'tools': [{
    'type': 'function',
    'function': {
      'name': 'get_weather',
      'description': '查询指定城市的天气信息',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询天气的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }, {
    'type': 'function',
    'function': {
      'name': 'get_current_time',
      'description': '查询指定城市当前时间',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询时间的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }],
  'tool_choice': 'auto'
}


llm response before function:


{
  'role': 'assistant',
  'content': '你好!我可以帮你做以下几件事:\n\n1. 查询天气 🌤️\n   - 可以查询任意城市的天气信息,比如北京、上海、广州等\n\n2. 查询时间 ⏰\n   - 可以查询任意城市的当前时间\n\n3. 日常聊天 💬\n   - 可以和你聊天、回答问题、提供建议等\n\n有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊',
  'reasoning_content': '用户问我能做什么,我需要介绍我的能力和可以使用的工具。根据可用的工具,我可以:\n1. 查询指定城市的天气信息\n2. 查询指定城市的当前时间\n\n我应该友好地介绍这些功能,让用户知道我可以帮他们做什么。'
}



AI: 你好!我可以帮你做以下几件事:
查询天气 🌤️
可以查询任意城市的天气信息,比如北京、上海、广州等

查询时间 ⏰
可以查询任意城市的当前时间

日常聊天 💬
可以和你聊天、回答问题、提供建议等

有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊



第三轮对话


[function-agent]> 上海现在几点了


llm messages before function:


[{
  'role': 'system',
  'content': '你是一个会在必要时主动调用工具解决问题的助手。'
}, {
  'role': 'user',
  'content': '你好呀'
}, {
  'role': 'assistant',
  'content': '你好呀!😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
}, {
  'role': 'user',
  'content': '你能做什么'
}, {
  'role': 'assistant',
  'content': '你好!我可以帮你做以下几件事:\n\n1. 查询天气 🌤️\n   - 可以查询任意城市的天气信息,比如北京、上海、广州等\n\n2. 查询时间 ⏰\n   - 可以查询任意城市的当前时间\n\n3. 日常聊天 💬\n   - 可以和你聊天、回答问题、提供建议等\n\n有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊'
}, {
  'role': 'user',
  'content': '上海现在 几点了'
}]

llm payload before request:


{
  'model': 'qwen3.5-plus',
  'messages': [{
    'role': 'system',
    'content': '你是一个会在必要时主动调用工具解决问题的助手。'
  }, {
    'role': 'user',
    'content': '你好呀'
  }, {
    'role': 'assistant',
    'content': '你好呀 !😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
  }, {
    'role': 'user',
    'content': '你能做什么'
  }, {
    'role': 'assistant',
    'content': '你好!我可以帮你做以下几件事:\n\n1. 查询天气 🌤️\n   - 可以查询任意城市的天气信息,比如北京、上海、广州等\n\n2. 查询时间 ⏰\n   - 可以查询任意城市的当前时间\n\n3. 日常聊天 💬\n   - 可以和你聊天、回答问题、提供建议等\n\n有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊'
  }, {
    'role': 'user',
    'content': '上海现在几点了'
  }],
  'temperature': 0.2,
  'max_tokens': 1000,
  'tools': [{
    'type': 'function',
    'function': {
      'name': 'get_weather',
      'description': '查询指定城市的天气信息',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询天气的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }, {
    'type': 'function',
    'function': {
      'name': 'get_current_time',
      'description': '查询指定城市当前时间',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询时间的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }],
  'tool_choice': 'auto'
}


llm response before function:


{
  'role': 'assistant',
  'tool_calls': [{
    'function': {
      'name': 'get_current_time',
      'arguments': '{"city": "上海"}'
    },
    'index': 0,
    'id': 'call_05e65851888a4717b102cf13',
    'type': 'function'
  }],
  'content': '',
  'reasoning_content': '用户想知道上海现在的时间,我需要使用 get_current_time 工具来查询上海的当前时间。'
}

🔧 调用函数: get_current_time({'city': '上海'})

🛠️ 函数结果: 上海 当前时间: 2026-03-11 08:40:32


Function call

llm messages before function:


[{
  'role': 'system',
  'content': '你是一个会在必要时主动调用工具解决问题的助手。'
}, {
  'role': 'user',
  'content': '你好呀'
}, {
  'role': 'assistant',
  'content': '你好呀!😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
}, {
  'role': 'user',
  'content': '你能做什么'
}, {
  'role': 'assistant',
  'content': '你好!我可以帮你做以下几件事:\n\n1. 查询天气 🌤️\n   - 可以查询任意城市的天气信息,比如北京、上海、广州等\n\n2. 查询时间 ⏰\n   - 可以查询任意城市的当前时间\n\n3. 日常聊天 💬\n   - 可以和你聊天、回答问题、提供建议等\n\n有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊'
}, {
  'role': 'user',
  'content': '上海现在 几点了'
}, {
  'role': 'assistant',
  'tool_calls': [{
    'function': {
      'name': 'get_current_time',
      'arguments': '{"city": "上海"}'
    },
    'index': 0,
    'id': 'call_05e65851888a4717b102cf13',
    'type': 'function'
  }],
  'content': '',
  'reasoning_content': '用户想知道上海现在的时间,我需要使用 get_current_time 工具来查询上海的当前时间。'
}, {
  'role': 'tool',
  'tool_call_id': 'call_05e65851888a4717b102cf13',
  'name': 'get_current_time',
  'content': '上海 当前时间: 2026-03-11 08:40:32'
}]


llm payload before request:


{
  'model': 'qwen3.5-plus',
  'messages': [{
    'role': 'system',
    'content': '你是一个会在必要时主动调用工具解决问题的助手。'
  }, {
    'role': 'user',
    'content': '你好呀'
  }, {
    'role': 'assistant',
    'content': '你好呀 !😊 有什么我可以帮你的吗?比如查询天气、时间,或者其他问题都可以问我哦~'
  }, {
    'role': 'user',
    'content': '你能做什么'
  }, {
    'role': 'assistant',
    'content': '你好!我可以帮你做以下几件事:\n\n1. 查询天气 🌤️\n   - 可以查询任意城市的天气信息,比如北京、上海、广州等\n\n2. 查询时间 ⏰\n   - 可以查询任意城市的当前时间\n\n3. 日常聊天 💬\n   - 可以和你聊天、回答问题、提供建议等\n\n有什么需要帮忙的吗?比如想知道某个城市的天气或时间,随时告诉我!😊'
  }, {
    'role': 'user',
    'content': '上海现在几点了'
  }, {
    'role': 'assistant',
    'tool_calls': [{
      'function': {
        'name': 'get_current_time',
        'arguments': '{"city": "上海"}'
      },
      'index': 0,
      'id': 'call_05e65851888a4717b102cf13',
      'type': 'function'
    }],
    'content': '',
    'reasoning_content': '用户想知道上海现在的时间,我需要使用 get_current_time 工具来查询上海的当前时间。'
  }, {
    'role': 'tool',
    'tool_call_id': 'call_05e65851888a4717b102cf13',
    'name': 'get_current_time',
    'content': '上海 当前时间: 2026-03-11 08:40:32'
  }],
  'temperature': 0.2,
  'max_tokens': 1000,
  'tools': [{
    'type': 'function',
    'function': {
      'name': 'get_weather',
      'description': '查询指定城市的天气信息',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询天气的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }, {
    'type': 'function',
    'function': {
      'name': 'get_current_time',
      'description': '查询指定城市当前时间',
      'parameters': {
        'type': 'object',
        'properties': {
          'city': {
            'type': 'string',
            'description': '需要查询时间的城市名,比如北京、上海'
          }
        },
        'required': ['city']
      }
    }
  }],
  'tool_choice': 'auto'
}


llm response before function:


{
  'role': 'assistant',
  'content': '上海现在的时间是:2026年3月11日 08:40:32 🕐\n\n有什么其他需要帮忙的吗?😊',
  'reasoning_content': '工具返回了上海的当前时间,我可以直接告诉用户这个信息。'
}

AI:


上海现在的时间是:2026年3月11日 08:40:32 🕐

有什么其他需要帮忙的吗?😊

评论

暂时还没有评论。

写下你的想法