87ed1c4425
- 升级Agent(chat_module=agent切换):升级到langgraph react agent逻辑、集成到主分支fay中、基于自动决策工具调用机制、基于日程跟踪的主动沟通、支持外部观测数据传入; - 修复因线程同步问题导致的配置文件读写不稳定 - 聊天采纳功能的bug修复
716 lines
83 KiB
Plaintext
716 lines
83 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"1、安装依赖。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Requirement already satisfied: langchain in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (0.3.7)\n",
|
||
"Requirement already satisfied: langchain-openai in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (0.2.6)\n",
|
||
"Collecting langchain-openai\n",
|
||
" Downloading langchain_openai-0.2.8-py3-none-any.whl.metadata (2.6 kB)\n",
|
||
"Requirement already satisfied: langgraph in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (0.2.45)\n",
|
||
"Collecting langgraph\n",
|
||
" Downloading langgraph-0.2.50-py3-none-any.whl.metadata (15 kB)\n",
|
||
"Requirement already satisfied: langsmith in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (0.1.142)\n",
|
||
"Collecting langsmith\n",
|
||
" Downloading langsmith-0.1.143-py3-none-any.whl.metadata (13 kB)\n",
|
||
"Requirement already satisfied: PyYAML>=5.3 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (6.0.2)\n",
|
||
"Requirement already satisfied: SQLAlchemy<3,>=1.4 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (2.0.35)\n",
|
||
"Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (3.10.10)\n",
|
||
"Requirement already satisfied: langchain-core<0.4.0,>=0.3.15 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (0.3.15)\n",
|
||
"Requirement already satisfied: langchain-text-splitters<0.4.0,>=0.3.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (0.3.2)\n",
|
||
"Requirement already satisfied: numpy<2.0.0,>=1.26.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (1.26.4)\n",
|
||
"Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (2.9.2)\n",
|
||
"Requirement already satisfied: requests<3,>=2 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (2.32.3)\n",
|
||
"Requirement already satisfied: tenacity!=8.4.0,<10,>=8.1.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain) (8.2.3)\n",
|
||
"Collecting langchain-core<0.4.0,>=0.3.15 (from langchain)\n",
|
||
" Downloading langchain_core-0.3.19-py3-none-any.whl.metadata (6.3 kB)\n",
|
||
"Requirement already satisfied: openai<2.0.0,>=1.54.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain-openai) (1.54.3)\n",
|
||
"Requirement already satisfied: tiktoken<1,>=0.7 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain-openai) (0.8.0)\n",
|
||
"Collecting langgraph-checkpoint<3.0.0,>=2.0.4 (from langgraph)\n",
|
||
" Downloading langgraph_checkpoint-2.0.4-py3-none-any.whl.metadata (4.6 kB)\n",
|
||
"Requirement already satisfied: langgraph-sdk<0.2.0,>=0.1.32 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langgraph) (0.1.35)\n",
|
||
"Requirement already satisfied: httpx<1,>=0.23.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langsmith) (0.27.2)\n",
|
||
"Requirement already satisfied: orjson<4.0.0,>=3.9.14 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langsmith) (3.10.11)\n",
|
||
"Requirement already satisfied: requests-toolbelt<2.0.0,>=1.0.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langsmith) (1.0.0)\n",
|
||
"Requirement already satisfied: aiohappyeyeballs>=2.3.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (2.4.3)\n",
|
||
"Requirement already satisfied: aiosignal>=1.1.2 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\n",
|
||
"Requirement already satisfied: attrs>=17.3.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (24.2.0)\n",
|
||
"Requirement already satisfied: frozenlist>=1.1.1 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.5.0)\n",
|
||
"Requirement already satisfied: multidict<7.0,>=4.5 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.1.0)\n",
|
||
"Requirement already satisfied: yarl<2.0,>=1.12.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.17.1)\n",
|
||
"Requirement already satisfied: anyio in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpx<1,>=0.23.0->langsmith) (4.6.2.post1)\n",
|
||
"Requirement already satisfied: certifi in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpx<1,>=0.23.0->langsmith) (2024.8.30)\n",
|
||
"Requirement already satisfied: httpcore==1.* in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpx<1,>=0.23.0->langsmith) (1.0.6)\n",
|
||
"Requirement already satisfied: idna in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpx<1,>=0.23.0->langsmith) (3.10)\n",
|
||
"Requirement already satisfied: sniffio in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpx<1,>=0.23.0->langsmith) (1.3.1)\n",
|
||
"Requirement already satisfied: h11<0.15,>=0.13 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith) (0.14.0)\n",
|
||
"Requirement already satisfied: jsonpatch<2.0,>=1.33 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain-core<0.4.0,>=0.3.15->langchain) (1.33)\n",
|
||
"Requirement already satisfied: packaging<25,>=23.2 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain-core<0.4.0,>=0.3.15->langchain) (24.1)\n",
|
||
"Requirement already satisfied: typing-extensions>=4.7 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langchain-core<0.4.0,>=0.3.15->langchain) (4.12.2)\n",
|
||
"Requirement already satisfied: msgpack<2.0.0,>=1.1.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langgraph-checkpoint<3.0.0,>=2.0.4->langgraph) (1.1.0)\n",
|
||
"Requirement already satisfied: httpx-sse>=0.4.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from langgraph-sdk<0.2.0,>=0.1.32->langgraph) (0.4.0)\n",
|
||
"Requirement already satisfied: distro<2,>=1.7.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from openai<2.0.0,>=1.54.0->langchain-openai) (1.9.0)\n",
|
||
"Requirement already satisfied: jiter<1,>=0.4.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from openai<2.0.0,>=1.54.0->langchain-openai) (0.7.0)\n",
|
||
"Requirement already satisfied: tqdm>4 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from openai<2.0.0,>=1.54.0->langchain-openai) (4.67.0)\n",
|
||
"Requirement already satisfied: annotated-types>=0.6.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from pydantic<3.0.0,>=2.7.4->langchain) (0.7.0)\n",
|
||
"Requirement already satisfied: pydantic-core==2.23.4 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from pydantic<3.0.0,>=2.7.4->langchain) (2.23.4)\n",
|
||
"Requirement already satisfied: charset-normalizer<4,>=2 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from requests<3,>=2->langchain) (3.4.0)\n",
|
||
"Requirement already satisfied: urllib3<3,>=1.21.1 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from requests<3,>=2->langchain) (2.2.3)\n",
|
||
"Requirement already satisfied: greenlet!=0.4.17 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from SQLAlchemy<3,>=1.4->langchain) (3.1.1)\n",
|
||
"Requirement already satisfied: regex>=2022.1.18 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from tiktoken<1,>=0.7->langchain-openai) (2024.11.6)\n",
|
||
"Requirement already satisfied: jsonpointer>=1.9 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.15->langchain) (3.0.0)\n",
|
||
"Requirement already satisfied: colorama in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from tqdm>4->openai<2.0.0,>=1.54.0->langchain-openai) (0.4.6)\n",
|
||
"Requirement already satisfied: propcache>=0.2.0 in d:\\anaconda3\\envs\\fay312-2\\lib\\site-packages (from yarl<2.0,>=1.12.0->aiohttp<4.0.0,>=3.8.3->langchain) (0.2.0)\n",
|
||
"Downloading langchain_openai-0.2.8-py3-none-any.whl (50 kB)\n",
|
||
"Downloading langgraph-0.2.50-py3-none-any.whl (124 kB)\n",
|
||
"Downloading langsmith-0.1.143-py3-none-any.whl (306 kB)\n",
|
||
"Downloading langchain_core-0.3.19-py3-none-any.whl (409 kB)\n",
|
||
"Downloading langgraph_checkpoint-2.0.4-py3-none-any.whl (23 kB)\n",
|
||
"Installing collected packages: langsmith, langchain-core, langgraph-checkpoint, langchain-openai, langgraph\n",
|
||
" Attempting uninstall: langsmith\n",
|
||
" Found existing installation: langsmith 0.1.142\n",
|
||
" Uninstalling langsmith-0.1.142:\n",
|
||
" Successfully uninstalled langsmith-0.1.142\n",
|
||
" Attempting uninstall: langchain-core\n",
|
||
" Found existing installation: langchain-core 0.3.15\n",
|
||
" Uninstalling langchain-core-0.3.15:\n",
|
||
" Successfully uninstalled langchain-core-0.3.15\n",
|
||
" Attempting uninstall: langgraph-checkpoint\n",
|
||
" Found existing installation: langgraph-checkpoint 2.0.2\n",
|
||
" Uninstalling langgraph-checkpoint-2.0.2:\n",
|
||
" Successfully uninstalled langgraph-checkpoint-2.0.2\n",
|
||
" Attempting uninstall: langchain-openai\n",
|
||
" Found existing installation: langchain-openai 0.2.6\n",
|
||
" Uninstalling langchain-openai-0.2.6:\n",
|
||
" Successfully uninstalled langchain-openai-0.2.6\n",
|
||
" Attempting uninstall: langgraph\n",
|
||
" Found existing installation: langgraph 0.2.45\n",
|
||
" Uninstalling langgraph-0.2.45:\n",
|
||
" Successfully uninstalled langgraph-0.2.45\n",
|
||
"Successfully installed langchain-core-0.3.19 langchain-openai-0.2.8 langgraph-0.2.50 langgraph-checkpoint-2.0.4 langsmith-0.1.143\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"!pip install -U langchain langchain-openai langgraph langsmith"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"2、配置环境变量。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"import os\n",
|
||
"\n",
|
||
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
|
||
"os.environ[\"LANGCHAIN_ENDPOINT\"] = \"https://api.smith.langchain.com\"\n",
|
||
"os.environ[\"LANGCHAIN_API_KEY\"] = \"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\"\n",
|
||
"os.environ[\"LANGCHAIN_PROJECT\"] = \"pr-best-artist-21\"\n",
|
||
"\n",
|
||
"os.environ[\"OPENAI_API_KEY\"] = \"sk-\"\n",
|
||
"os.environ[\"OPENAI_API_BASE\"] = \"\""
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"3、定义llm model。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"'Hello! How can I assist you today?'"
|
||
]
|
||
},
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from langchain_openai import ChatOpenAI\n",
|
||
"llm = ChatOpenAI()\n",
|
||
"llm.invoke(\"Hello, world!\").content#test"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"4、定义工具。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"现在时间是:16:12 星期日 2024年11月17日\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import abc\n",
|
||
"from typing import Any\n",
|
||
"from datetime import datetime\n",
|
||
"from langchain.tools import BaseTool\n",
|
||
"\n",
|
||
"class QueryTime(BaseTool, abc.ABC):\n",
|
||
" name: str = \"QueryTime\"\n",
|
||
" description: str = \"用于查询当前日期、星期几及时间\" \n",
|
||
"\n",
|
||
" def __init__(self):\n",
|
||
" super().__init__()\n",
|
||
"\n",
|
||
" async def _arun(self, *args: Any, **kwargs: Any) -> Any:\n",
|
||
" # 用例中没有用到 arun,不予具体实现\n",
|
||
" pass\n",
|
||
"\n",
|
||
" def _run(self, para) -> str:\n",
|
||
" # 获取当前时间\n",
|
||
" now = datetime.now()\n",
|
||
" # 获取当前日期\n",
|
||
" today = now.date()\n",
|
||
" # 获取星期几的信息\n",
|
||
" week_day = today.strftime(\"%A\")\n",
|
||
" # 将星期几的英文名称转换为中文\n",
|
||
" week_day_zh = {\n",
|
||
" \"Monday\": \"星期一\",\n",
|
||
" \"Tuesday\": \"星期二\",\n",
|
||
" \"Wednesday\": \"星期三\",\n",
|
||
" \"Thursday\": \"星期四\",\n",
|
||
" \"Friday\": \"星期五\",\n",
|
||
" \"Saturday\": \"星期六\",\n",
|
||
" \"Sunday\": \"星期日\",\n",
|
||
" }.get(week_day, \"未知\")\n",
|
||
" # 将日期格式化为字符串\n",
|
||
" date_str = today.strftime(\"%Y年%m月%d日\")\n",
|
||
" # 将时间格式化为字符串\n",
|
||
" time_str = now.strftime(\"%H:%M\")\n",
|
||
"\n",
|
||
" return f\"现在时间是:{time_str} {week_day_zh} {date_str}\"\n",
|
||
"\n",
|
||
"if __name__ == \"__main__\":\n",
|
||
" tool = QueryTime()\n",
|
||
" result = tool.run(\"\")\n",
|
||
" print(result)\n",
|
||
"\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"天气预报信息:今天天气:broken clouds,气温:29.97摄氏度,风速:4.4 m/s。\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"from typing import Any\n",
|
||
"\n",
|
||
"import requests\n",
|
||
"from langchain.tools import BaseTool\n",
|
||
"from urllib.parse import quote\n",
|
||
"\n",
|
||
"class Weather(BaseTool):\n",
|
||
" name: str = \"weather\"\n",
|
||
" description: str = \"此工具用于获取天气预报信息,需传入英文的城市名,参数格式:Guangzhou\"\n",
|
||
"\n",
|
||
" def __init__(self):\n",
|
||
" super().__init__()\n",
|
||
"\n",
|
||
" async def _arun(self, *args: Any, **kwargs: Any) -> Any:\n",
|
||
" # 用例中没有用到 arun 不予具体实现\n",
|
||
" pass\n",
|
||
"\n",
|
||
"\n",
|
||
" def _run(self, para: str) -> str:\n",
|
||
" try:\n",
|
||
" if not para:\n",
|
||
" return \"参数不能为空\"\n",
|
||
" encoded_city = quote(para)\n",
|
||
"\n",
|
||
" api_url = f\"http://api.openweathermap.org/data/2.5/weather?q={encoded_city}&appid=272fcb70d2c4e6f5134c2dce7d091df6\"\n",
|
||
" response = requests.get(api_url)\n",
|
||
" if response.status_code == 200:\n",
|
||
" weather_data = response.json()\n",
|
||
" # 提取天气信息\n",
|
||
" temperature_kelvin = weather_data['main']['temp']\n",
|
||
" temperature_celsius = temperature_kelvin - 273.15\n",
|
||
" min_temperature_kelvin = weather_data['main']['temp_min']\n",
|
||
" max_temperature_kelvin = weather_data['main']['temp_max']\n",
|
||
" min_temperature_celsius = min_temperature_kelvin - 273.15\n",
|
||
" max_temperature_celsius = max_temperature_kelvin - 273.15\n",
|
||
" description = weather_data['weather'][0]['description']\n",
|
||
" wind_speed = weather_data['wind']['speed']\n",
|
||
"\n",
|
||
" # 构建天气描述\n",
|
||
" weather_description = f\"今天天气:{description},气温:{temperature_celsius:.2f}摄氏度,风速:{wind_speed} m/s。\"\n",
|
||
"\n",
|
||
" return f\"天气预报信息:{weather_description}\"\n",
|
||
" else:\n",
|
||
" return f\"无法获取天气预报信息,状态码:{response.status_code}\"\n",
|
||
" except Exception as e:\n",
|
||
" return f\"发生错误:{str(e)}\"\n",
|
||
"\n",
|
||
"\n",
|
||
"if __name__ == \"__main__\":\n",
|
||
" weather_tool = Weather()\n",
|
||
" weather_info = weather_tool.run(\"Guangzhou\")\n",
|
||
" print(weather_info)\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"5、创建agent graph。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 12,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"from langgraph.checkpoint.memory import MemorySaver\n",
|
||
"from langgraph.prebuilt import create_react_agent\n",
|
||
"\n",
|
||
"memory = MemorySaver()\n",
|
||
"tools = [QueryTime(), Weather()]\n",
|
||
"agent_graph = create_react_agent(llm, tools, checkpointer=memory)\n",
|
||
"\n",
|
||
"#memeory上用于分块\n",
|
||
"config = {\"configurable\": {\"thread_id\": \"abc123\"}}"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"6、查看agent graph。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 11,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAANYAAAD5CAIAAADUe1yaAAAAAXNSR0IArs4c6QAAIABJREFUeJztnXdcU+fi/5+ThAwyIAmEKUuWKC5wo9i6rjgKalXQWq3eqtdxW2cH91Zr9Tpar7Xf3tpW6657FeveSsVVqSKIbGQkhAQSErJzfn/EH6UYUDEnz0nyvF/+gSfJ83yCb59zznOegeE4DhAIeFBgB0C4OkhBBGSQggjIIAURkEEKIiCDFERAhgY7QHtQyg1KmaFRaVI3GI16x+hWorlhVBrmzqW682hCPzrTnQo7EVnAHOMfEAAAgLRSW/SHuuSRms2jmYy4O4/K5tLoLApwhG9AY2CqOmNjg6lRaVQrTGwPamgXdkR3DofvBjsaZBxDQYXM8NsvtVQ3jC+ih3ZmewUwYCd6XSqLNCU5arlY5+lN7z9GSHNz3SsiB1Dw1mlZ/t2G/mO9wrtxYGexPX9cq/8tQzYwxatLfw/YWeBAdgUPf13RZQAvOp4HOwix3D4rb5AbhqT6wA4CAfIqiOP4Dx8Xj53t7xfKgp3FHuTeUpY+U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WsVFnUkrVJp3eoNYNHufVIfLVVrxECpKF0C7s0C7sooeqgvvqwky5INDdoDNT6TQag0bCFYtxHDfpjCaD0Y1OqRNrQruwIwZwQmLasywiUpBcdIzldIzlAACqSzRqhUmtMOp1Zq0tFvq1LQx3CtOd7s5z5/KpPkEv6HZpG6QgSfELJWSKCQmxriCdiZnJ1/i/Eh7eboRNhEDYEuv/Sly+m7TMsddFKHmgEvo5w4wnp8e6gqIODFKuefKy1Ev1IZ3daW6oGXQAWm0FA8KZ146I7Z7HNlzcW9U3qa3RGQjy0NZ+xI9uKgqyVd0ShXwfemuD20iFRmVU1BquHRaPXxDg+RKPhhBk4AVbYpc8UmdfrReXaKk0sp+YBX4MhVQf1sW990ghm4fu9B2GFyjYhE5D9i3pcBww3R2gqUa04GUVRCAIAjUbCMggBRGQQQoiIIMUREAGKYiADFIQAZn/B1qlvCqU0zzIAAAAAElFTkSuQmCC",
|
||
"text/plain": [
|
||
"<IPython.core.display.Image object>"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"from IPython.display import Image, display\n",
|
||
"\n",
|
||
"try:\n",
|
||
" display(Image(agent_graph.get_graph().draw_mermaid_png()))\n",
|
||
"except Exception:\n",
|
||
" # This requires some extra dependencies and is optional\n",
|
||
" pass"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"7、执行。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 31,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"你好\n",
|
||
"你好,张三!有什么我可以帮助你的吗?如果你有任何问题或者想聊天,随时告诉我!\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"from langchain_core.messages import HumanMessage, SystemMessage\n",
|
||
"events = agent_graph.stream(\n",
|
||
" {\"messages\": [SystemMessage(\"你的名字叫张三,18岁。\"), HumanMessage(content=\"你好\", name=\"User\")]}, config, stream_mode=\"values\"\n",
|
||
")\n",
|
||
"for event in events:\n",
|
||
" if \"messages\" in event:\n",
|
||
" print(event[\"messages\"][-1].content)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"{'agent': {'messages': [AIMessage(content='请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 89, 'total_tokens': 111, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-4ddeb38a-9300-440d-8138-c279fa2c5097-0', usage_metadata={'input_tokens': 89, 'output_tokens': 22, 'total_tokens': 111, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})]}}\n",
|
||
"请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。\n",
|
||
"token使用:111\n",
|
||
"----\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"\n",
|
||
"for chunk in agent_executor.stream(\n",
|
||
" {\"messages\": [HumanMessage(content=\"还有吗\", name=\"User\")]}, {\"configurable\": {\"thread_id\": \"abc123\"}}\n",
|
||
"):\n",
|
||
" print(chunk)\n",
|
||
" if chunk.get(\"agent\"):\n",
|
||
" if chunk['agent']['messages'][0].content:\n",
|
||
" print(chunk['agent']['messages'][0].content)\n",
|
||
" else:\n",
|
||
" print(\"现在调用{}工具\".format(chunk['agent']['messages'][0].additional_kwargs['tool_calls'][0]['function']['name']))\n",
|
||
" print(\"token使用:{}\".format(chunk['agent']['messages'][0].response_metadata['token_usage']['total_tokens']))\n",
|
||
"\n",
|
||
" print(\"----\")\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"8、测试记忆机制。"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 16,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"[HumanMessage(content='还有吗', additional_kwargs={}, response_metadata={}, name='User', id='f466081a-e840-42f7-ac2c-c9465dfe658d'),\n",
|
||
" AIMessage(content='请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 89, 'total_tokens': 111, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-4ddeb38a-9300-440d-8138-c279fa2c5097-0', usage_metadata={'input_tokens': 89, 'output_tokens': 22, 'total_tokens': 111, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你好吗', additional_kwargs={}, response_metadata={}, name='User'),\n",
|
||
" AIMessage(content='你好吗', additional_kwargs={}, response_metadata={})]"
|
||
]
|
||
},
|
||
"execution_count": 16,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from langchain_core.messages import HumanMessage, AIMessage\n",
|
||
"snapshot = agent_executor.get_state(config)\n",
|
||
"existing_messages = snapshot.values[\"messages\"]\n",
|
||
"existing_messages.append(HumanMessage(content=\"你叫什么名字?\", name=\"User\"))\n",
|
||
"existing_messages.append(AIMessage(\"我叫fay\"))\n",
|
||
"existing_messages#.pretty_print()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 18,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"{'configurable': {'thread_id': 'abc123',\n",
|
||
" 'checkpoint_ns': '',\n",
|
||
" 'checkpoint_id': '1efa4b9f-bff1-6823-8002-f65425e81a5d'}}"
|
||
]
|
||
},
|
||
"execution_count": 18,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"agent_executor.update_state(config, {\"messages\": existing_messages})"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 19,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"[HumanMessage(content='还有吗', additional_kwargs={}, response_metadata={}, name='User', id='f466081a-e840-42f7-ac2c-c9465dfe658d'),\n",
|
||
" AIMessage(content='请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 89, 'total_tokens': 111, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-4ddeb38a-9300-440d-8138-c279fa2c5097-0', usage_metadata={'input_tokens': 89, 'output_tokens': 22, 'total_tokens': 111, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你好吗', additional_kwargs={}, response_metadata={}, name='User', id='e509be56-3442-4648-ad9a-cee13bca82f0'),\n",
|
||
" AIMessage(content='你好吗', additional_kwargs={}, response_metadata={}, id='575b7cbd-bd07-4e88-aed2-d29d7602b6e4')]"
|
||
]
|
||
},
|
||
"execution_count": 19,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"snapshot = agent_executor.get_state(config)\n",
|
||
"existing_messages = snapshot.values[\"messages\"]\n",
|
||
"existing_messages"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 14,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"StateSnapshot(values={'messages': [HumanMessage(content='还有吗', additional_kwargs={}, response_metadata={}, name='User', id='f466081a-e840-42f7-ac2c-c9465dfe658d'), AIMessage(content='请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 89, 'total_tokens': 111, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-4ddeb38a-9300-440d-8138-c279fa2c5097-0', usage_metadata={'input_tokens': 89, 'output_tokens': 22, 'total_tokens': 111, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})]}, next=(), config={'configurable': {'thread_id': 'abc123', 'checkpoint_ns': '', 'checkpoint_id': '1efa3c92-a44b-6f14-8001-e40ae3f48e95'}}, metadata={'source': 'loop', 'writes': {'agent': {'messages': [AIMessage(content='请问您具体想了解什么呢?我可以提供天气预报、时间日期等信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 89, 'total_tokens': 111, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-4ddeb38a-9300-440d-8138-c279fa2c5097-0', usage_metadata={'input_tokens': 89, 'output_tokens': 22, 'total_tokens': 111, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})]}}, 'thread_id': 'abc123', 'step': 1, 'parents': {}}, created_at='2024-11-16T03:16:26.467714+00:00', parent_config={'configurable': {'thread_id': 'abc123', 'checkpoint_ns': '', 'checkpoint_id': '1efa3c92-921f-6959-8000-39ede570ea4c'}}, tasks=())"
|
||
]
|
||
},
|
||
"execution_count": 14,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"snapshot"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 45,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"dict"
|
||
]
|
||
},
|
||
"execution_count": 45,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"type(memory.get_tuple(config).checkpoint)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 50,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"{'v': 1,\n",
|
||
" 'ts': '2024-11-15T08:21:08.671329+00:00',\n",
|
||
" 'id': '1efa32a9-0e5e-61cf-801f-fee8f6f6d005',\n",
|
||
" 'channel_values': {'messages': [HumanMessage(content='现在什么时间,广州天气怎么样', additional_kwargs={}, response_metadata={}, name='User', id='e26e51c3-2a22-4997-b8c4-c8354192aeea'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'function': {'arguments': '{\"para\": {}}', 'name': 'QueryTime'}, 'type': 'function'}, {'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'function': {'arguments': '{\"para\": \"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 94, 'total_tokens': 139, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-366f5601-27ef-4238-8928-e7a74218a560-0', tool_calls=[{'name': 'QueryTime', 'args': {'para': {}}, 'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'type': 'tool_call'}, {'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'type': 'tool_call'}], usage_metadata={'input_tokens': 94, 'output_tokens': 45, 'total_tokens': 139, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='现在时间是:15:35 星期五 2024年11月15日', name='QueryTime', id='18e008ef-b0a6-4dcc-9ade-20f88a349a07', tool_call_id='call_Sga9wIgaKZ8ZtZRzHvlIdbz1'),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:overcast clouds,气温:24.97摄氏度,风速:1.64 m/s。', name='weather', id='5e0da87a-8f24-4652-9c4b-fde489ec3812', tool_call_id='call_YyxTGWDjmKnRMLICROzdqBfe'),\n",
|
||
" AIMessage(content='现在时间是:15:35,星期五,2024年11月15日。\\n\\n广州的天气预报信息:今天天气为阴云,气温为24.97摄氏度,风速为1.64米/秒。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 53, 'prompt_tokens': 296, 'total_tokens': 349, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-d5eaf7a8-ad14-4e2e-b31d-caa45a58901c-0', usage_metadata={'input_tokens': 296, 'output_tokens': 53, 'total_tokens': 349, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你好', additional_kwargs={}, response_metadata={}, name='User', id='8fc0dbed-ab1a-4e5d-b7fe-d4d5784ac463'),\n",
|
||
" AIMessage(content='你好!有什么我可以帮助你的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 10, 'prompt_tokens': 360, 'total_tokens': 370, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-ce3076b5-a8cc-4653-aa31-2d895339ba67-0', usage_metadata={'input_tokens': 360, 'output_tokens': 10, 'total_tokens': 370, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你知道我在那里吗', additional_kwargs={}, response_metadata={}, name='User', id='cf569e60-e19b-4ded-8247-33a080071353'),\n",
|
||
" AIMessage(content='我无法直接知道你的位置,但可以根据你提供的信息来帮助你。如果你告诉我你所在的城市或地区,我可以为你提供相关的天气、新闻或其他信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 384, 'total_tokens': 424, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c4be7ab9-8ac5-44be-b2ef-a510173e9213-0', usage_metadata={'input_tokens': 384, 'output_tokens': 40, 'total_tokens': 424, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='我在广州啊,你记住了', additional_kwargs={}, response_metadata={}, name='User', id='177253af-5f01-4b90-b0de-7d2f6b353972'),\n",
|
||
" AIMessage(content='好的,我记住了你在广州。如果你需要关于广州的任何信息,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 23, 'prompt_tokens': 441, 'total_tokens': 464, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a3af2ce-42c9-4ff5-bd0e-ac111f05ff3d-0', usage_metadata={'input_tokens': 441, 'output_tokens': 23, 'total_tokens': 464, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='那你帮我查一下天气', additional_kwargs={}, response_metadata={}, name='User', id='ecf1bbe7-1281-42ef-8c38-b31905b77e41'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'function': {'arguments': '{\"para\":\"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 15, 'prompt_tokens': 480, 'total_tokens': 495, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-5fef1bc4-389c-4378-b33f-fc1711665a31-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'type': 'tool_call'}], usage_metadata={'input_tokens': 480, 'output_tokens': 15, 'total_tokens': 495, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:broken clouds,气温:24.97摄氏度,风速:1.54 m/s。', name='weather', id='83324068-99a3-4cc4-9344-602137b4ff0f', tool_call_id='call_uxQylEdyIjo7mbwhXgN6aWlM'),\n",
|
||
" AIMessage(content='广州的天气预报信息:今天天气为多云,气温为24.97摄氏度,风速为1.54米/秒。有什么其他需要了解的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 533, 'total_tokens': 574, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a9b5728-48d1-4e9a-9aee-c0aec6fea0a6-0', usage_metadata={'input_tokens': 533, 'output_tokens': 41, 'total_tokens': 574, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='深圳呢', additional_kwargs={}, response_metadata={}, name='User', id='514a6dcf-404c-4529-bf27-e34e8a669be9'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'function': {'arguments': '{\"para\":\"Shenzhen\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 14, 'prompt_tokens': 585, 'total_tokens': 599, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-f5a9852a-e502-4944-9f82-6b58cbd66a6f-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Shenzhen'}, 'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'type': 'tool_call'}], usage_metadata={'input_tokens': 585, 'output_tokens': 14, 'total_tokens': 599, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:light rain,气温:24.73摄氏度,风速:1.46 m/s。', name='weather', id='6f99f5c2-e61e-4c09-8a88-858711a628ac', tool_call_id='call_TJNJH6UBaF8x7gTuZd8X7JAd'),\n",
|
||
" AIMessage(content='深圳的天气预报信息:今天天气为小雨,气温为24.73摄氏度,风速为1.46米/秒。如果你还有其他问题,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 637, 'total_tokens': 682, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-5ad2461a-11ff-40cc-8ad2-2413b75ef8a3-0', usage_metadata={'input_tokens': 637, 'output_tokens': 45, 'total_tokens': 682, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='有什么玩', additional_kwargs={}, response_metadata={}, name='User', id='9fc4b0b2-24d6-444a-923d-b3c6e63809cc'),\n",
|
||
" AIMessage(content='在广州和深圳,你可以尝试以下一些活动和景点:\\n\\n### 广州\\n1. **广州塔(小蛮腰)**:可以登塔俯瞰城市全景。\\n2. **珠江夜游**:欣赏珠江两岸的美丽夜景。\\n3. **白云山**:适合徒步和观赏自然风光。\\n4. **上下九步行街**:体验广州的美食和购物。\\n5. **陈家祠**:了解岭南文化和传统建筑。\\n\\n### 深圳\\n1. **深圳湾公园**:适合散步和骑行,享受海风。\\n2. **大梅沙海滨公园**:可以游泳和沙滩活动。\\n3. **欢乐谷**:一个大型的主题公园,适合家庭游玩。\\n4. **东部华侨城**:有自然景观和文化体验的综合旅游区。\\n5. **深圳博物馆**:了解深圳的发展历史和文化。\\n\\n你对哪个活动感兴趣呢?或者想了解更多信息?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 238, 'prompt_tokens': 693, 'total_tokens': 931, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-987a1730-2229-47d3-a215-0e1cac207f00-0', usage_metadata={'input_tokens': 693, 'output_tokens': 238, 'total_tokens': 931, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='北京呢', additional_kwargs={}, response_metadata={}, name='User', id='3df98b9a-22e2-42da-9f31-916b055079e4'),\n",
|
||
" AIMessage(content='在北京,你可以尝试以下一些活动和景点:\\n\\n### 北京\\n1. **故宫博物院**:探索中国古代皇宫的历史和文化。\\n2. **长城**:游览八达岭或慕田峪段,体验这一历史奇迹。\\n3. **天安门广场**:参观广场及其周围的历史建筑,包括人民大会堂和毛主席纪念堂。\\n4. **颐和园**:欣赏美丽的皇家园林和昆明湖的风景。\\n5. **798艺术区**:探索现代艺术和文化的创意产业园区。\\n6. **胡同游**:体验北京的传统胡同文化,可以选择骑自行车游览。\\n7. **北京烤鸭**:在著名的餐馆品尝正宗的北京烤鸭。\\n\\n如果你对某个特定的景点或活动感兴趣,或者需要更多的信息,请告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 212, 'prompt_tokens': 942, 'total_tokens': 1154, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c0d85ea4-6e2d-4434-8773-a3dc9e170fbd-0', usage_metadata={'input_tokens': 942, 'output_tokens': 212, 'total_tokens': 1154, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='还有吗', additional_kwargs={}, response_metadata={}, name='User', id='a8698fad-e437-4f69-91bf-04a87f58d4e7'),\n",
|
||
" AIMessage(content='当然可以!以下是一些更多在北京可以做的事情和景点:\\n\\n### 更多北京活动和景点\\n8. **圆明园**:游览这座历史悠久的皇家园林,了解其辉煌与毁灭的历史。\\n9. **南锣鼓巷**:体验传统与现代结合的文化,享受美食和购物。\\n10. **北京植物园**:欣赏各种植物和花卉,适合家庭和自然爱好者。\\n11. **首都博物馆**:了解北京的历史和文化,有丰富的展览。\\n12. **鸟巢和水立方**:参观2008年奥运会的标志性建筑,外观非常壮观。\\n13. **王府井步行街**:购物和美食的天堂,尝试各种地道小吃。\\n14. **北京剧院**:观看京剧或其他表演,体验中国传统艺术。\\n15. **长安街**:沿着长安街散步,欣赏沿途的现代建筑与历史景点。\\n\\n如果你还有其他问题或需要更具体的信息,比如餐馆推荐或交通方式,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 259, 'prompt_tokens': 1165, 'total_tokens': 1424, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-491a2935-7dbb-44c7-86c8-afa5e121fbd0-0', usage_metadata={'input_tokens': 1165, 'output_tokens': 259, 'total_tokens': 1424, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})],\n",
|
||
" 'agent': 'agent'},\n",
|
||
" 'channel_versions': {'__start__': '00000000000000000000000000000032.0.15693994337439554',\n",
|
||
" 'messages': '00000000000000000000000000000033.0.7077459190085686',\n",
|
||
" 'start:agent': '00000000000000000000000000000033.0.9607591474652312',\n",
|
||
" 'agent': '00000000000000000000000000000033.0.8028913424477877',\n",
|
||
" 'branch:agent:should_continue:tools': '00000000000000000000000000000023.0.7713433790844227',\n",
|
||
" 'tools': '00000000000000000000000000000024.0.695707121431364'},\n",
|
||
" 'versions_seen': {'__input__': {},\n",
|
||
" '__start__': {'__start__': '00000000000000000000000000000031.0.9988558075001674'},\n",
|
||
" 'agent': {'start:agent': '00000000000000000000000000000032.0.7643999578358889',\n",
|
||
" 'tools': '00000000000000000000000000000023.0.7854437453842145'},\n",
|
||
" 'tools': {'branch:agent:should_continue:tools': '00000000000000000000000000000022.0.0983258158769671'}},\n",
|
||
" 'pending_sends': []}"
|
||
]
|
||
},
|
||
"execution_count": 50,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"memory.get_tuple(config).checkpoint"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 44,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"[HumanMessage(content='现在什么时间,广州天气怎么样', additional_kwargs={}, response_metadata={}, name='User', id='e26e51c3-2a22-4997-b8c4-c8354192aeea'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'function': {'arguments': '{\"para\": {}}', 'name': 'QueryTime'}, 'type': 'function'}, {'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'function': {'arguments': '{\"para\": \"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 94, 'total_tokens': 139, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-366f5601-27ef-4238-8928-e7a74218a560-0', tool_calls=[{'name': 'QueryTime', 'args': {'para': {}}, 'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'type': 'tool_call'}, {'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'type': 'tool_call'}], usage_metadata={'input_tokens': 94, 'output_tokens': 45, 'total_tokens': 139, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='现在时间是:15:35 星期五 2024年11月15日', name='QueryTime', id='18e008ef-b0a6-4dcc-9ade-20f88a349a07', tool_call_id='call_Sga9wIgaKZ8ZtZRzHvlIdbz1'),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:overcast clouds,气温:24.97摄氏度,风速:1.64 m/s。', name='weather', id='5e0da87a-8f24-4652-9c4b-fde489ec3812', tool_call_id='call_YyxTGWDjmKnRMLICROzdqBfe'),\n",
|
||
" AIMessage(content='现在时间是:15:35,星期五,2024年11月15日。\\n\\n广州的天气预报信息:今天天气为阴云,气温为24.97摄氏度,风速为1.64米/秒。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 53, 'prompt_tokens': 296, 'total_tokens': 349, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-d5eaf7a8-ad14-4e2e-b31d-caa45a58901c-0', usage_metadata={'input_tokens': 296, 'output_tokens': 53, 'total_tokens': 349, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你好', additional_kwargs={}, response_metadata={}, name='User', id='8fc0dbed-ab1a-4e5d-b7fe-d4d5784ac463'),\n",
|
||
" AIMessage(content='你好!有什么我可以帮助你的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 10, 'prompt_tokens': 360, 'total_tokens': 370, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-ce3076b5-a8cc-4653-aa31-2d895339ba67-0', usage_metadata={'input_tokens': 360, 'output_tokens': 10, 'total_tokens': 370, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你知道我在那里吗', additional_kwargs={}, response_metadata={}, name='User', id='cf569e60-e19b-4ded-8247-33a080071353'),\n",
|
||
" AIMessage(content='我无法直接知道你的位置,但可以根据你提供的信息来帮助你。如果你告诉我你所在的城市或地区,我可以为你提供相关的天气、新闻或其他信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 384, 'total_tokens': 424, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c4be7ab9-8ac5-44be-b2ef-a510173e9213-0', usage_metadata={'input_tokens': 384, 'output_tokens': 40, 'total_tokens': 424, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='我在广州啊,你记住了', additional_kwargs={}, response_metadata={}, name='User', id='177253af-5f01-4b90-b0de-7d2f6b353972'),\n",
|
||
" AIMessage(content='好的,我记住了你在广州。如果你需要关于广州的任何信息,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 23, 'prompt_tokens': 441, 'total_tokens': 464, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a3af2ce-42c9-4ff5-bd0e-ac111f05ff3d-0', usage_metadata={'input_tokens': 441, 'output_tokens': 23, 'total_tokens': 464, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='那你帮我查一下天气', additional_kwargs={}, response_metadata={}, name='User', id='ecf1bbe7-1281-42ef-8c38-b31905b77e41'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'function': {'arguments': '{\"para\":\"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 15, 'prompt_tokens': 480, 'total_tokens': 495, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-5fef1bc4-389c-4378-b33f-fc1711665a31-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'type': 'tool_call'}], usage_metadata={'input_tokens': 480, 'output_tokens': 15, 'total_tokens': 495, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:broken clouds,气温:24.97摄氏度,风速:1.54 m/s。', name='weather', id='83324068-99a3-4cc4-9344-602137b4ff0f', tool_call_id='call_uxQylEdyIjo7mbwhXgN6aWlM'),\n",
|
||
" AIMessage(content='广州的天气预报信息:今天天气为多云,气温为24.97摄氏度,风速为1.54米/秒。有什么其他需要了解的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 533, 'total_tokens': 574, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a9b5728-48d1-4e9a-9aee-c0aec6fea0a6-0', usage_metadata={'input_tokens': 533, 'output_tokens': 41, 'total_tokens': 574, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='深圳呢', additional_kwargs={}, response_metadata={}, name='User', id='514a6dcf-404c-4529-bf27-e34e8a669be9'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'function': {'arguments': '{\"para\":\"Shenzhen\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 14, 'prompt_tokens': 585, 'total_tokens': 599, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-f5a9852a-e502-4944-9f82-6b58cbd66a6f-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Shenzhen'}, 'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'type': 'tool_call'}], usage_metadata={'input_tokens': 585, 'output_tokens': 14, 'total_tokens': 599, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:light rain,气温:24.73摄氏度,风速:1.46 m/s。', name='weather', id='6f99f5c2-e61e-4c09-8a88-858711a628ac', tool_call_id='call_TJNJH6UBaF8x7gTuZd8X7JAd'),\n",
|
||
" AIMessage(content='深圳的天气预报信息:今天天气为小雨,气温为24.73摄氏度,风速为1.46米/秒。如果你还有其他问题,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 637, 'total_tokens': 682, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-5ad2461a-11ff-40cc-8ad2-2413b75ef8a3-0', usage_metadata={'input_tokens': 637, 'output_tokens': 45, 'total_tokens': 682, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='有什么玩', additional_kwargs={}, response_metadata={}, name='User', id='9fc4b0b2-24d6-444a-923d-b3c6e63809cc'),\n",
|
||
" AIMessage(content='在广州和深圳,你可以尝试以下一些活动和景点:\\n\\n### 广州\\n1. **广州塔(小蛮腰)**:可以登塔俯瞰城市全景。\\n2. **珠江夜游**:欣赏珠江两岸的美丽夜景。\\n3. **白云山**:适合徒步和观赏自然风光。\\n4. **上下九步行街**:体验广州的美食和购物。\\n5. **陈家祠**:了解岭南文化和传统建筑。\\n\\n### 深圳\\n1. **深圳湾公园**:适合散步和骑行,享受海风。\\n2. **大梅沙海滨公园**:可以游泳和沙滩活动。\\n3. **欢乐谷**:一个大型的主题公园,适合家庭游玩。\\n4. **东部华侨城**:有自然景观和文化体验的综合旅游区。\\n5. **深圳博物馆**:了解深圳的发展历史和文化。\\n\\n你对哪个活动感兴趣呢?或者想了解更多信息?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 238, 'prompt_tokens': 693, 'total_tokens': 931, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-987a1730-2229-47d3-a215-0e1cac207f00-0', usage_metadata={'input_tokens': 693, 'output_tokens': 238, 'total_tokens': 931, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='北京呢', additional_kwargs={}, response_metadata={}, name='User', id='3df98b9a-22e2-42da-9f31-916b055079e4'),\n",
|
||
" AIMessage(content='在北京,你可以尝试以下一些活动和景点:\\n\\n### 北京\\n1. **故宫博物院**:探索中国古代皇宫的历史和文化。\\n2. **长城**:游览八达岭或慕田峪段,体验这一历史奇迹。\\n3. **天安门广场**:参观广场及其周围的历史建筑,包括人民大会堂和毛主席纪念堂。\\n4. **颐和园**:欣赏美丽的皇家园林和昆明湖的风景。\\n5. **798艺术区**:探索现代艺术和文化的创意产业园区。\\n6. **胡同游**:体验北京的传统胡同文化,可以选择骑自行车游览。\\n7. **北京烤鸭**:在著名的餐馆品尝正宗的北京烤鸭。\\n\\n如果你对某个特定的景点或活动感兴趣,或者需要更多的信息,请告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 212, 'prompt_tokens': 942, 'total_tokens': 1154, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c0d85ea4-6e2d-4434-8773-a3dc9e170fbd-0', usage_metadata={'input_tokens': 942, 'output_tokens': 212, 'total_tokens': 1154, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})]"
|
||
]
|
||
},
|
||
"execution_count": 44,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"memory.get_tuple(config).checkpoint['channel_values']['messages']"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 43,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"{'messages': [HumanMessage(content='现在什么时间,广州天气怎么样', additional_kwargs={}, response_metadata={}, name='User', id='e26e51c3-2a22-4997-b8c4-c8354192aeea'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'function': {'arguments': '{\"para\": {}}', 'name': 'QueryTime'}, 'type': 'function'}, {'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'function': {'arguments': '{\"para\": \"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 94, 'total_tokens': 139, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-366f5601-27ef-4238-8928-e7a74218a560-0', tool_calls=[{'name': 'QueryTime', 'args': {'para': {}}, 'id': 'call_Sga9wIgaKZ8ZtZRzHvlIdbz1', 'type': 'tool_call'}, {'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_YyxTGWDjmKnRMLICROzdqBfe', 'type': 'tool_call'}], usage_metadata={'input_tokens': 94, 'output_tokens': 45, 'total_tokens': 139, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='现在时间是:15:35 星期五 2024年11月15日', name='QueryTime', id='18e008ef-b0a6-4dcc-9ade-20f88a349a07', tool_call_id='call_Sga9wIgaKZ8ZtZRzHvlIdbz1'),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:overcast clouds,气温:24.97摄氏度,风速:1.64 m/s。', name='weather', id='5e0da87a-8f24-4652-9c4b-fde489ec3812', tool_call_id='call_YyxTGWDjmKnRMLICROzdqBfe'),\n",
|
||
" AIMessage(content='现在时间是:15:35,星期五,2024年11月15日。\\n\\n广州的天气预报信息:今天天气为阴云,气温为24.97摄氏度,风速为1.64米/秒。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 53, 'prompt_tokens': 296, 'total_tokens': 349, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-d5eaf7a8-ad14-4e2e-b31d-caa45a58901c-0', usage_metadata={'input_tokens': 296, 'output_tokens': 53, 'total_tokens': 349, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你好', additional_kwargs={}, response_metadata={}, name='User', id='8fc0dbed-ab1a-4e5d-b7fe-d4d5784ac463'),\n",
|
||
" AIMessage(content='你好!有什么我可以帮助你的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 10, 'prompt_tokens': 360, 'total_tokens': 370, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-ce3076b5-a8cc-4653-aa31-2d895339ba67-0', usage_metadata={'input_tokens': 360, 'output_tokens': 10, 'total_tokens': 370, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='你知道我在那里吗', additional_kwargs={}, response_metadata={}, name='User', id='cf569e60-e19b-4ded-8247-33a080071353'),\n",
|
||
" AIMessage(content='我无法直接知道你的位置,但可以根据你提供的信息来帮助你。如果你告诉我你所在的城市或地区,我可以为你提供相关的天气、新闻或其他信息。', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 384, 'total_tokens': 424, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c4be7ab9-8ac5-44be-b2ef-a510173e9213-0', usage_metadata={'input_tokens': 384, 'output_tokens': 40, 'total_tokens': 424, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='我在广州啊,你记住了', additional_kwargs={}, response_metadata={}, name='User', id='177253af-5f01-4b90-b0de-7d2f6b353972'),\n",
|
||
" AIMessage(content='好的,我记住了你在广州。如果你需要关于广州的任何信息,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 23, 'prompt_tokens': 441, 'total_tokens': 464, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a3af2ce-42c9-4ff5-bd0e-ac111f05ff3d-0', usage_metadata={'input_tokens': 441, 'output_tokens': 23, 'total_tokens': 464, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='那你帮我查一下天气', additional_kwargs={}, response_metadata={}, name='User', id='ecf1bbe7-1281-42ef-8c38-b31905b77e41'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'function': {'arguments': '{\"para\":\"Guangzhou\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 15, 'prompt_tokens': 480, 'total_tokens': 495, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-5fef1bc4-389c-4378-b33f-fc1711665a31-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Guangzhou'}, 'id': 'call_uxQylEdyIjo7mbwhXgN6aWlM', 'type': 'tool_call'}], usage_metadata={'input_tokens': 480, 'output_tokens': 15, 'total_tokens': 495, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:broken clouds,气温:24.97摄氏度,风速:1.54 m/s。', name='weather', id='83324068-99a3-4cc4-9344-602137b4ff0f', tool_call_id='call_uxQylEdyIjo7mbwhXgN6aWlM'),\n",
|
||
" AIMessage(content='广州的天气预报信息:今天天气为多云,气温为24.97摄氏度,风速为1.54米/秒。有什么其他需要了解的吗?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 533, 'total_tokens': 574, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-6a9b5728-48d1-4e9a-9aee-c0aec6fea0a6-0', usage_metadata={'input_tokens': 533, 'output_tokens': 41, 'total_tokens': 574, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='深圳呢', additional_kwargs={}, response_metadata={}, name='User', id='514a6dcf-404c-4529-bf27-e34e8a669be9'),\n",
|
||
" AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'function': {'arguments': '{\"para\":\"Shenzhen\"}', 'name': 'weather'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 14, 'prompt_tokens': 585, 'total_tokens': 599, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-f5a9852a-e502-4944-9f82-6b58cbd66a6f-0', tool_calls=[{'name': 'weather', 'args': {'para': 'Shenzhen'}, 'id': 'call_TJNJH6UBaF8x7gTuZd8X7JAd', 'type': 'tool_call'}], usage_metadata={'input_tokens': 585, 'output_tokens': 14, 'total_tokens': 599, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" ToolMessage(content='天气预报信息:今天天气:light rain,气温:24.73摄氏度,风速:1.46 m/s。', name='weather', id='6f99f5c2-e61e-4c09-8a88-858711a628ac', tool_call_id='call_TJNJH6UBaF8x7gTuZd8X7JAd'),\n",
|
||
" AIMessage(content='深圳的天气预报信息:今天天气为小雨,气温为24.73摄氏度,风速为1.46米/秒。如果你还有其他问题,随时告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 637, 'total_tokens': 682, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-5ad2461a-11ff-40cc-8ad2-2413b75ef8a3-0', usage_metadata={'input_tokens': 637, 'output_tokens': 45, 'total_tokens': 682, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='有什么玩', additional_kwargs={}, response_metadata={}, name='User', id='9fc4b0b2-24d6-444a-923d-b3c6e63809cc'),\n",
|
||
" AIMessage(content='在广州和深圳,你可以尝试以下一些活动和景点:\\n\\n### 广州\\n1. **广州塔(小蛮腰)**:可以登塔俯瞰城市全景。\\n2. **珠江夜游**:欣赏珠江两岸的美丽夜景。\\n3. **白云山**:适合徒步和观赏自然风光。\\n4. **上下九步行街**:体验广州的美食和购物。\\n5. **陈家祠**:了解岭南文化和传统建筑。\\n\\n### 深圳\\n1. **深圳湾公园**:适合散步和骑行,享受海风。\\n2. **大梅沙海滨公园**:可以游泳和沙滩活动。\\n3. **欢乐谷**:一个大型的主题公园,适合家庭游玩。\\n4. **东部华侨城**:有自然景观和文化体验的综合旅游区。\\n5. **深圳博物馆**:了解深圳的发展历史和文化。\\n\\n你对哪个活动感兴趣呢?或者想了解更多信息?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 238, 'prompt_tokens': 693, 'total_tokens': 931, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_04751d0b65', 'finish_reason': 'stop', 'logprobs': None}, id='run-987a1730-2229-47d3-a215-0e1cac207f00-0', usage_metadata={'input_tokens': 693, 'output_tokens': 238, 'total_tokens': 931, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}}),\n",
|
||
" HumanMessage(content='北京呢', additional_kwargs={}, response_metadata={}, name='User', id='3df98b9a-22e2-42da-9f31-916b055079e4'),\n",
|
||
" AIMessage(content='在北京,你可以尝试以下一些活动和景点:\\n\\n### 北京\\n1. **故宫博物院**:探索中国古代皇宫的历史和文化。\\n2. **长城**:游览八达岭或慕田峪段,体验这一历史奇迹。\\n3. **天安门广场**:参观广场及其周围的历史建筑,包括人民大会堂和毛主席纪念堂。\\n4. **颐和园**:欣赏美丽的皇家园林和昆明湖的风景。\\n5. **798艺术区**:探索现代艺术和文化的创意产业园区。\\n6. **胡同游**:体验北京的传统胡同文化,可以选择骑自行车游览。\\n7. **北京烤鸭**:在著名的餐馆品尝正宗的北京烤鸭。\\n\\n如果你对某个特定的景点或活动感兴趣,或者需要更多的信息,请告诉我!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 212, 'prompt_tokens': 942, 'total_tokens': 1154, 'completion_tokens_details': {'accepted_prediction_tokens': None, 'audio_tokens': None, 'reasoning_tokens': 0, 'rejected_prediction_tokens': None}, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-mini-2024-07-18', 'system_fingerprint': 'fp_d54531d9eb', 'finish_reason': 'stop', 'logprobs': None}, id='run-c0d85ea4-6e2d-4434-8773-a3dc9e170fbd-0', usage_metadata={'input_tokens': 942, 'output_tokens': 212, 'total_tokens': 1154, 'input_token_details': {'cache_read': 0}, 'output_token_details': {'reasoning': 0}})],\n",
|
||
" 'agent': 'agent'}"
|
||
]
|
||
},
|
||
"execution_count": 43,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"memory.get_tuple(config).checkpoint['channel_values']"
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "fay312-2",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 3
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython3",
|
||
"version": "3.12.7"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 2
|
||
}
|