diff --git a/docs/docs/tutorials/agents.ipynb b/docs/docs/tutorials/agents.ipynb
index 1486b2fb138..ba87c5b4eee 100644
--- a/docs/docs/tutorials/agents.ipynb
+++ b/docs/docs/tutorials/agents.ipynb
@@ -47,21 +47,46 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 1,
"id": "a79bb782",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:55:52.427375Z",
+ "iopub.status.busy": "2024-09-11T23:55:52.426932Z",
+ "iopub.status.idle": "2024-09-11T23:56:04.526910Z",
+ "shell.execute_reply": "2024-09-11T23:56:04.525940Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content=\"Hello Bob! Since you didn't ask a specific question, I don't need to use any tools to respond. It's nice to meet you. San Francisco is a wonderful city with lots to see and do. I hope you're enjoying living there. Please let me know if you have any other questions!\", response_metadata={'id': 'msg_01Mmfzfs9m4XMgVzsCZYMWqH', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 271, 'output_tokens': 65}}, id='run-44c57f9c-a637-4888-b7d9-6d985031ae48-0', usage_metadata={'input_tokens': 271, 'output_tokens': 65, 'total_tokens': 336})]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content=[{'text': 'To get current weather information for your location in San Francisco, let me invoke the search tool:', 'type': 'text'}, {'id': 'toolu_01BGEyQaSz3pTq8RwUUHSRoo', 'input': {'query': 'san francisco weather'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], response_metadata={'id': 'msg_013AVSVsRLKYZjduLpJBY4us', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 347, 'output_tokens': 80}}, id='run-de7923b6-5ee2-4ebe-bd95-5aed4933d0e3-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'san francisco weather'}, 'id': 'toolu_01BGEyQaSz3pTq8RwUUHSRoo'}], usage_metadata={'input_tokens': 347, 'output_tokens': 80, 'total_tokens': 427})]}}\n",
- "----\n",
- "{'tools': {'messages': [ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1717238643, \\'localtime\\': \\'2024-06-01 3:44\\'}, \\'current\\': {\\'last_updated_epoch\\': 1717237800, \\'last_updated\\': \\'2024-06-01 03:30\\', \\'temp_c\\': 12.0, \\'temp_f\\': 53.6, \\'is_day\\': 0, \\'condition\\': {\\'text\\': \\'Mist\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/night/143.png\\', \\'code\\': 1030}, \\'wind_mph\\': 5.6, \\'wind_kph\\': 9.0, \\'wind_degree\\': 310, \\'wind_dir\\': \\'NW\\', \\'pressure_mb\\': 1013.0, \\'pressure_in\\': 29.92, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 88, \\'cloud\\': 100, \\'feelslike_c\\': 10.5, \\'feelslike_f\\': 50.8, \\'windchill_c\\': 9.3, \\'windchill_f\\': 48.7, \\'heatindex_c\\': 11.1, \\'heatindex_f\\': 51.9, \\'dewpoint_c\\': 8.8, \\'dewpoint_f\\': 47.8, \\'vis_km\\': 6.4, \\'vis_miles\\': 3.0, \\'uv\\': 1.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.1}}\"}, {\"url\": \"https://www.timeanddate.com/weather/usa/san-francisco/historic\", \"content\": \"Past Weather in San Francisco, California, USA \\\\u2014 Yesterday and Last 2 Weeks. Time/General. Weather. Time Zone. DST Changes. Sun & Moon. Weather Today Weather Hourly 14 Day Forecast Yesterday/Past Weather Climate (Averages) Currently: 68 \\\\u00b0F. Passing clouds.\"}]', name='tavily_search_results_json', tool_call_id='toolu_01BGEyQaSz3pTq8RwUUHSRoo')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='Based on the search results, the current weather in San Francisco is:\\n\\nTemperature: 53.6°F (12°C)\\nConditions: Misty\\nWind: 5.6 mph (9 kph) from the Northwest\\nHumidity: 88%\\nCloud Cover: 100% \\n\\nThe results provide detailed information like wind chill, heat index, visibility and more. It looks like a typical cool, foggy morning in San Francisco. Let me know if you need any other details about the weather where you live!', response_metadata={'id': 'msg_019WGLbaojuNdbCnqac7zaGW', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1035, 'output_tokens': 120}}, id='run-1bb68bf3-b212-4ef4-8a31-10c830421c78-0', usage_metadata={'input_tokens': 1035, 'output_tokens': 120, 'total_tokens': 1155})]}}\n",
+ "{'agent': {'messages': [AIMessage(content=\"Hello Bob! Since you didn't ask a specific question, I don't need to use any tools for this interaction. It's nice to meet you. San Francisco is a beautiful city with lots to see and do. What are some of your favorite things about living there?\", additional_kwargs={}, response_metadata={'id': 'msg_01DUsxCNBqXmWqehdU2GHGbu', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 271, 'output_tokens': 58}}, id='run-6f30ad57-10c4-4879-afde-a4f0c3a61270-0', usage_metadata={'input_tokens': 271, 'output_tokens': 58, 'total_tokens': 329})]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content=[{'text': 'Okay, to get accurate weather information for your location in San Francisco, let me use the search tool:', 'type': 'text'}, {'id': 'toolu_012wbZm5DSo7d1ukQa5axHeW', 'input': {'query': 'san francisco weather'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], additional_kwargs={}, response_metadata={'id': 'msg_01WdvAPJm97rizxzYXA87YRd', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 340, 'output_tokens': 82}}, id='run-b40173bd-c8d8-4176-9624-9880ffbe50db-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'san francisco weather'}, 'id': 'toolu_012wbZm5DSo7d1ukQa5axHeW', 'type': 'tool_call'}], usage_metadata={'input_tokens': 340, 'output_tokens': 82, 'total_tokens': 422})]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'tools': {'messages': [ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1726098945, \\'localtime\\': \\'2024-09-11 16:55\\'}, \\'current\\': {\\'last_updated_epoch\\': 1726098300, \\'last_updated\\': \\'2024-09-11 16:45\\', \\'temp_c\\': 22.8, \\'temp_f\\': 73.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Partly cloudy\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/116.png\\', \\'code\\': 1003}, \\'wind_mph\\': 18.6, \\'wind_kph\\': 29.9, \\'wind_degree\\': 290, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1011.0, \\'pressure_in\\': 29.86, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 64, \\'cloud\\': 25, \\'feelslike_c\\': 24.9, \\'feelslike_f\\': 76.9, \\'windchill_c\\': 18.4, \\'windchill_f\\': 65.1, \\'heatindex_c\\': 18.4, \\'heatindex_f\\': 65.1, \\'dewpoint_c\\': 14.8, \\'dewpoint_f\\': 58.6, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 27.3, \\'gust_kph\\': 43.9}}\"}, {\"url\": \"https://www.weathertab.com/en/d/e/11/united-states/california/san-francisco/\", \"content\": \"Our San Francisco, California Daily Weather Forecast for November 2024, developed from a specialized dynamic long-range model, provides precise daily temperature and rainfall predictions. This model, distinct from standard statistical or climatological approaches, is the result of over 50 years of dedicated private research, offering a clearer ...\"}]', name='tavily_search_results_json', tool_call_id='toolu_012wbZm5DSo7d1ukQa5axHeW', artifact={'query': 'san francisco weather', 'follow_up_questions': None, 'answer': None, 'images': [], 'results': [{'title': 'Weather in San Francisco, California, USA', 'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1726098945, 'localtime': '2024-09-11 16:55'}, 'current': {'last_updated_epoch': 1726098300, 'last_updated': '2024-09-11 16:45', 'temp_c': 22.8, 'temp_f': 73.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 18.6, 'wind_kph': 29.9, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1011.0, 'pressure_in': 29.86, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 64, 'cloud': 25, 'feelslike_c': 24.9, 'feelslike_f': 76.9, 'windchill_c': 18.4, 'windchill_f': 65.1, 'heatindex_c': 18.4, 'heatindex_f': 65.1, 'dewpoint_c': 14.8, 'dewpoint_f': 58.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.3, 'gust_kph': 43.9}}\", 'score': 0.9993334, 'raw_content': None}, {'title': 'San Francisco, CA Daily Weather Forecast for November 2024', 'url': 'https://www.weathertab.com/en/d/e/11/united-states/california/san-francisco/', 'content': 'Our San Francisco, California Daily Weather Forecast for November 2024, developed from a specialized dynamic long-range model, provides precise daily temperature and rainfall predictions. This model, distinct from standard statistical or climatological approaches, is the result of over 50 years of dedicated private research, offering a clearer ...', 'score': 0.9989183, 'raw_content': None}], 'response_time': 2.79})]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='Based on the search results, the current weather in San Francisco is partly cloudy with a temperature of around 73°F (23°C). There are some winds at around 18-29 kph from the west-northwest. The humidity is 64% and visibility is good at 16 km.\\n\\nThe results provide a detailed snapshot of the current weather conditions in San Francisco specifically for your location. Let me know if you need any other details about the weather where you live!', additional_kwargs={}, response_metadata={'id': 'msg_01JVaP8Sgf3auwHafGM31Kaq', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1028, 'output_tokens': 105}}, id='run-6f83a5a8-6dcf-4d64-8204-d3b4a3ac47e2-0', usage_metadata={'input_tokens': 1028, 'output_tokens': 105, 'total_tokens': 1133})]}}\n",
"----\n"
]
}
@@ -116,10 +141,443 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "60bb3eb1",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:04.532907Z",
+ "iopub.status.busy": "2024-09-11T23:56:04.532465Z",
+ "iopub.status.idle": "2024-09-11T23:56:13.294898Z",
+ "shell.execute_reply": "2024-09-11T23:56:13.294273Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: langchain-community in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.3.0.dev1)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain-community\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Downloading langchain_community-0.3.0.dev2-py3-none-any.whl.metadata (2.8 kB)\r\n",
+ "Requirement already satisfied: langgraph in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.2.19)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: langchain-anthropic in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.2.0.dev1)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: tavily-python in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.4.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langgraph-checkpoint-sqlite\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Downloading langgraph_checkpoint_sqlite-1.0.3-py3-none-any.whl.metadata (3.0 kB)\r\n",
+ "Requirement already satisfied: PyYAML>=5.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (6.0.2)\r\n",
+ "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (2.0.32)\r\n",
+ "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (3.10.1)\r\n",
+ "Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (0.6.7)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain<0.4.0,>=0.3.0.dev2 (from langchain-community)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Downloading langchain-0.3.0.dev2-py3-none-any.whl.metadata (7.1 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain-core<0.4.0,>=0.3.0.dev5 (from langchain-community)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Downloading langchain_core-0.3.0.dev5-py3-none-any.whl.metadata (6.1 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langsmith<0.2.0,>=0.1.112 (from langchain-community)\r\n",
+ " Downloading langsmith-0.1.118-py3-none-any.whl.metadata (13 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: numpy<2,>=1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (1.26.4)\r\n",
+ "Requirement already satisfied: pydantic-settings<3.0.0,>=2.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (2.4.0)\r\n",
+ "Requirement already satisfied: requests<3,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (2.32.3)\r\n",
+ "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-community) (8.5.0)\r\n",
+ "Requirement already satisfied: langgraph-checkpoint<2.0.0,>=1.0.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langgraph) (1.0.9)\r\n",
+ "Requirement already satisfied: anthropic<1,>=0.30.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-anthropic) (0.34.1)\r\n",
+ "Requirement already satisfied: defusedxml<0.8.0,>=0.7.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-anthropic) (0.7.1)\r\n",
+ "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-anthropic) (2.8.2)\r\n",
+ "Requirement already satisfied: tiktoken>=0.5.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tavily-python) (0.7.0)\r\n",
+ "Requirement already satisfied: httpx in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tavily-python) (0.27.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting aiosqlite<0.21.0,>=0.20.0 (from langgraph-checkpoint-sqlite)\r\n",
+ " Downloading aiosqlite-0.20.0-py3-none-any.whl.metadata (4.3 kB)\r\n",
+ "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (2.3.5)\r\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.3.1)\r\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (24.2.0)\r\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.4.1)\r\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (6.0.5)\r\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.9.4)\r\n",
+ "Requirement already satisfied: typing_extensions>=4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiosqlite<0.21.0,>=0.20.0->langgraph-checkpoint-sqlite) (4.12.2)\r\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain-anthropic) (4.4.0)\r\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain-anthropic) (1.9.0)\r\n",
+ "Requirement already satisfied: jiter<1,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain-anthropic) (0.5.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: sniffio in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain-anthropic) (1.3.1)\r\n",
+ "Requirement already satisfied: tokenizers>=0.13.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain-anthropic) (0.19.1)\r\n",
+ "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community) (3.21.3)\r\n",
+ "Requirement already satisfied: typing-inspect<1,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community) (0.9.0)\r\n",
+ "Requirement already satisfied: certifi in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx->tavily-python) (2024.7.4)\r\n",
+ "Requirement already satisfied: httpcore==1.* in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx->tavily-python) (1.0.5)\r\n",
+ "Requirement already satisfied: idna in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx->tavily-python) (3.7)\r\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpcore==1.*->httpx->tavily-python) (0.14.0)\r\n",
+ "Requirement already satisfied: langchain-text-splitters<0.4.0,>=0.3.0.dev1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain<0.4.0,>=0.3.0.dev2->langchain-community) (0.3.0.dev1)\r\n",
+ "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev5->langchain-community) (1.33)\r\n",
+ "Requirement already satisfied: packaging<25,>=23.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev5->langchain-community) (24.1)\r\n",
+ "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.112->langchain-community) (3.10.6)\r\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain-anthropic) (0.7.0)\r\n",
+ "Requirement already satisfied: pydantic-core==2.20.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain-anthropic) (2.20.1)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: python-dotenv>=0.21.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic-settings<3.0.0,>=2.4.0->langchain-community) (1.0.1)\r\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain-community) (3.3.2)\r\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain-community) (2.2.2)\r\n",
+ "Requirement already satisfied: regex>=2022.1.18 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tiktoken>=0.5.1->tavily-python) (2024.7.24)\r\n",
+ "Requirement already satisfied: jsonpointer>=1.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.0.dev5->langchain-community) (3.0.0)\r\n",
+ "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain-anthropic) (0.24.5)\r\n",
+ "Requirement already satisfied: mypy-extensions>=0.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain-community) (1.0.0)\r\n",
+ "Requirement already satisfied: filelock in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain-anthropic) (3.15.4)\r\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain-anthropic) (2024.6.1)\r\n",
+ "Requirement already satisfied: tqdm>=4.42.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain-anthropic) (4.66.5)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading langchain_community-0.3.0.dev2-py3-none-any.whl (2.3 MB)\r\n",
+ "\u001b[?25l \u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/2.3 MB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.1/2.3 MB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.5/2.3 MB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.7/2.3 MB\u001b[0m \u001b[31m8.0 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.8/2.3 MB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/2.3 MB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/2.3 MB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m\u001b[38;5;237m━━━━━━\u001b[0m \u001b[32m2.0/2.3 MB\u001b[0m \u001b[31m7.4 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━\u001b[0m \u001b[32m2.2/2.3 MB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━\u001b[0m \u001b[32m2.2/2.3 MB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━\u001b[0m \u001b[32m2.2/2.3 MB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━\u001b[0m \u001b[32m2.2/2.3 MB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m \u001b[32m2.3/2.3 MB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.3/2.3 MB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\r\n",
+ "\u001b[?25h"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading langgraph_checkpoint_sqlite-1.0.3-py3-none-any.whl (12 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading aiosqlite-0.20.0-py3-none-any.whl (15 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading langchain-0.3.0.dev2-py3-none-any.whl (1.0 MB)\r\n",
+ "\u001b[?25l \u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/1.0 MB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.5/1.0 MB\u001b[0m \u001b[31m14.3 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m13.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\r\n",
+ "\u001b[?25h"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading langchain_core-0.3.0.dev5-py3-none-any.whl (403 kB)\r\n",
+ "\u001b[?25l \u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/403.6 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;2;249;38;114m╸\u001b[0m \u001b[32m399.4/403.6 kB\u001b[0m \u001b[31m14.8 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m403.6/403.6 kB\u001b[0m \u001b[31m11.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\r\n",
+ "\u001b[?25h"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Downloading langsmith-0.1.118-py3-none-any.whl (289 kB)\r\n",
+ "\u001b[?25l"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " \u001b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/289.3 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.4/289.3 kB\u001b[0m \u001b[31m139.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.4/289.3 kB\u001b[0m \u001b[31m139.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.4/289.3 kB\u001b[0m \u001b[31m139.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r",
+ "\u001b[2K \u001b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[38;5;237m╺\u001b[0m\u001b[38;5;237m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.4/289.3 kB\u001b[0m \u001b[31m139.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r",
+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m289.3/289.3 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\r\n",
+ "\u001b[?25h"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Installing collected packages: aiosqlite, langsmith, langchain-core, langgraph-checkpoint-sqlite, langchain, langchain-community\r\n",
+ " Attempting uninstall: langsmith\r\n",
+ " Found existing installation: langsmith 0.1.98\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Uninstalling langsmith-0.1.98:\r\n",
+ " Successfully uninstalled langsmith-0.1.98\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Attempting uninstall: langchain-core\r\n",
+ " Found existing installation: langchain-core 0.3.0.dev4\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Uninstalling langchain-core-0.3.0.dev4:\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Successfully uninstalled langchain-core-0.3.0.dev4\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Attempting uninstall: langchain\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Found existing installation: langchain 0.3.0.dev1\r\n",
+ " Uninstalling langchain-0.3.0.dev1:\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Successfully uninstalled langchain-0.3.0.dev1\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Attempting uninstall: langchain-community\r\n",
+ " Found existing installation: langchain-community 0.3.0.dev1\r\n",
+ " Uninstalling langchain-community-0.3.0.dev1:\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Successfully uninstalled langchain-community-0.3.0.dev1\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\r\n",
+ "langchain-benchmarks 0.0.14 requires langchain<0.3.0,>=0.2.7, but you have langchain 0.3.0.dev2 which is incompatible.\r\n",
+ "langchain-benchmarks 0.0.14 requires langchain-community<0.3,>=0.2, but you have langchain-community 0.3.0.dev2 which is incompatible.\r\n",
+ "langchain-benchmarks 0.0.14 requires langchain-openai<0.2.0,>=0.1.14, but you have langchain-openai 0.2.0.dev2 which is incompatible.\r\n",
+ "langchain-aws 0.1.15 requires langchain-core<0.3,>=0.2.29, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-huggingface 0.0.3 requires langchain-core<0.3,>=0.1.52, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-chroma 0.1.3 requires langchain-core<0.3,>=0.1.40, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-together 0.1.5 requires langchain-core<0.3.0,>=0.2.26, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-together 0.1.5 requires langchain-openai<0.2.0,>=0.1.16, but you have langchain-openai 0.2.0.dev2 which is incompatible.\r\n",
+ "langserve 0.2.2 requires langchain-core<0.3,>=0.1, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-standard-tests 0.1.1 requires langchain-core<0.3,>=0.1.40, but you have langchain-core 0.3.0.dev5 which is incompatible.\u001b[0m\u001b[31m\r\n",
+ "\u001b[0mSuccessfully installed aiosqlite-0.20.0 langchain-0.3.0.dev2 langchain-community-0.3.0.dev2 langchain-core-0.3.0.dev5 langgraph-checkpoint-sqlite-1.0.3 langsmith-0.1.118\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install -U langchain-community langgraph langchain-anthropic tavily-python langgraph-checkpoint-sqlite"
]
@@ -185,22 +643,23 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 3,
"id": "482ce13d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:13.297865Z",
+ "iopub.status.busy": "2024-09-11T23:56:13.297661Z",
+ "iopub.status.idle": "2024-09-11T23:56:18.217269Z",
+ "shell.execute_reply": "2024-09-11T23:56:18.216685Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "[{'url': 'https://www.weatherapi.com/',\n",
- " 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1717238703, 'localtime': '2024-06-01 3:45'}, 'current': {'last_updated_epoch': 1717237800, 'last_updated': '2024-06-01 03:30', 'temp_c': 12.0, 'temp_f': 53.6, 'is_day': 0, 'condition': {'text': 'Mist', 'icon': '//cdn.weatherapi.com/weather/64x64/night/143.png', 'code': 1030}, 'wind_mph': 5.6, 'wind_kph': 9.0, 'wind_degree': 310, 'wind_dir': 'NW', 'pressure_mb': 1013.0, 'pressure_in': 29.92, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 88, 'cloud': 100, 'feelslike_c': 10.5, 'feelslike_f': 50.8, 'windchill_c': 9.3, 'windchill_f': 48.7, 'heatindex_c': 11.1, 'heatindex_f': 51.9, 'dewpoint_c': 8.8, 'dewpoint_f': 47.8, 'vis_km': 6.4, 'vis_miles': 3.0, 'uv': 1.0, 'gust_mph': 12.5, 'gust_kph': 20.1}}\"},\n",
- " {'url': 'https://www.wunderground.com/hourly/us/ca/san-francisco/date/2024-01-06',\n",
- " 'content': 'Current Weather for Popular Cities . San Francisco, CA 58 ° F Partly Cloudy; Manhattan, NY warning 51 ° F Cloudy; Schiller Park, IL (60176) warning 51 ° F Fair; Boston, MA warning 41 ° F ...'}]"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1726098811, 'localtime': '2024-09-11 16:53'}, 'current': {'last_updated_epoch': 1726098300, 'last_updated': '2024-09-11 16:45', 'temp_c': 22.8, 'temp_f': 73.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 18.6, 'wind_kph': 29.9, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1011.0, 'pressure_in': 29.86, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 64, 'cloud': 25, 'feelslike_c': 24.9, 'feelslike_f': 76.9, 'windchill_c': 18.4, 'windchill_f': 65.1, 'heatindex_c': 18.4, 'heatindex_f': 65.1, 'dewpoint_c': 14.8, 'dewpoint_f': 58.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.3, 'gust_kph': 43.9}}\"}, {'url': 'https://www.ventusky.com/san-francisco', 'content': 'San Francisco ☀ Weather forecast for 10 days, information from meteorological stations, webcams, sunrise and sunset, wind and precipitation maps for this place ... (UTC-7) / Current time: 00:36 2024/09/11 . Current Weather ; Forecast ; Sun and Moon ; 14 °C : Wind ... (23:56 2024/09/10) Weather for the next 24 hours . 01:00 02:00 03:00 04:00 ...'}]\n"
+ ]
}
],
"source": [
@@ -232,9 +691,16 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 4,
"id": "69185491",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:18.220771Z",
+ "iopub.status.busy": "2024-09-11T23:56:18.220477Z",
+ "iopub.status.idle": "2024-09-11T23:56:18.252527Z",
+ "shell.execute_reply": "2024-09-11T23:56:18.252021Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -255,14 +721,21 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 5,
"id": "c96c960b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:18.256404Z",
+ "iopub.status.busy": "2024-09-11T23:56:18.255995Z",
+ "iopub.status.idle": "2024-09-11T23:56:19.286916Z",
+ "shell.execute_reply": "2024-09-11T23:56:19.286361Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Hi there!'"
+ "'Hi there! How can I assist you today?'"
]
},
"execution_count": 5,
@@ -287,9 +760,16 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"id": "ba692a74",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:19.291542Z",
+ "iopub.status.busy": "2024-09-11T23:56:19.291217Z",
+ "iopub.status.idle": "2024-09-11T23:56:19.304547Z",
+ "shell.execute_reply": "2024-09-11T23:56:19.303936Z"
+ }
+ },
"outputs": [],
"source": [
"model_with_tools = model.bind_tools(tools)"
@@ -305,9 +785,16 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 7,
"id": "b6a7e925",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:19.308414Z",
+ "iopub.status.busy": "2024-09-11T23:56:19.308057Z",
+ "iopub.status.idle": "2024-09-11T23:56:20.205008Z",
+ "shell.execute_reply": "2024-09-11T23:56:20.204199Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -335,16 +822,23 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"id": "688b465d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:20.208435Z",
+ "iopub.status.busy": "2024-09-11T23:56:20.208079Z",
+ "iopub.status.idle": "2024-09-11T23:56:22.206268Z",
+ "shell.execute_reply": "2024-09-11T23:56:22.205657Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "ContentString: \n",
- "ToolCalls: [{'name': 'tavily_search_results_json', 'args': {'query': 'weather san francisco'}, 'id': 'toolu_01VTP7DUvSfgtYxsq9x4EwMp'}]\n"
+ "ContentString: [{'text': 'To get current weather information for San Francisco, we can use the tavily_search_results_json tool with an appropriate query:', 'type': 'text'}, {'id': 'toolu_017tgYBkVrtb7Szwfw5NzfRR', 'input': {'query': 'san francisco weather'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n",
+ "ToolCalls: [{'name': 'tavily_search_results_json', 'args': {'query': 'san francisco weather'}, 'id': 'toolu_017tgYBkVrtb7Szwfw5NzfRR', 'type': 'tool_call'}]\n"
]
}
],
@@ -390,7 +884,14 @@
"cell_type": "code",
"execution_count": 9,
"id": "89cf72b4-6046-4b47-8f27-5522d8cb8036",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:22.210683Z",
+ "iopub.status.busy": "2024-09-11T23:56:22.210388Z",
+ "iopub.status.idle": "2024-09-11T23:56:22.221551Z",
+ "shell.execute_reply": "2024-09-11T23:56:22.219961Z"
+ }
+ },
"outputs": [],
"source": [
"from langgraph.prebuilt import create_react_agent\n",
@@ -414,13 +915,20 @@
"cell_type": "code",
"execution_count": 10,
"id": "114ba50d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:22.226914Z",
+ "iopub.status.busy": "2024-09-11T23:56:22.226522Z",
+ "iopub.status.idle": "2024-09-11T23:56:24.983330Z",
+ "shell.execute_reply": "2024-09-11T23:56:24.982539Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[HumanMessage(content='hi!', id='a820fcc5-9b87-457a-9af0-f21768143ee3'),\n",
- " AIMessage(content='Hello!', response_metadata={'id': 'msg_01VbC493X1VEDyusgttiEr1z', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 264, 'output_tokens': 5}}, id='run-0e0ddae8-a85b-4bd6-947c-c36c857a4698-0', usage_metadata={'input_tokens': 264, 'output_tokens': 5, 'total_tokens': 269})]"
+ "[HumanMessage(content='hi!', additional_kwargs={}, response_metadata={}, id='7678e0ad-b6f7-4756-88b8-f5ab2a1b0f08'),\n",
+ " AIMessage(content='Hello!', additional_kwargs={}, response_metadata={'id': 'msg_01J7VUEPXtcQGgmb5qHrgtjr', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 264, 'output_tokens': 5}}, id='run-fbda63c9-e2a8-46ce-8f0b-b85fbeaafced-0', usage_metadata={'input_tokens': 264, 'output_tokens': 5, 'total_tokens': 269})]"
]
},
"execution_count": 10,
@@ -448,15 +956,22 @@
"cell_type": "code",
"execution_count": 11,
"id": "77c2f769",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:24.987514Z",
+ "iopub.status.busy": "2024-09-11T23:56:24.987206Z",
+ "iopub.status.idle": "2024-09-11T23:56:34.264393Z",
+ "shell.execute_reply": "2024-09-11T23:56:34.263684Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[HumanMessage(content='whats the weather in sf?', id='1d6c96bb-4ddb-415c-a579-a07d5264de0d'),\n",
- " AIMessage(content=[{'id': 'toolu_01Y5EK4bw2LqsQXeaUv8iueF', 'input': {'query': 'weather in san francisco'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], response_metadata={'id': 'msg_0132wQUcEduJ8UKVVVqwJzM4', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 269, 'output_tokens': 61}}, id='run-26d5e5e8-d4fd-46d2-a197-87b95b10e823-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in san francisco'}, 'id': 'toolu_01Y5EK4bw2LqsQXeaUv8iueF'}], usage_metadata={'input_tokens': 269, 'output_tokens': 61, 'total_tokens': 330}),\n",
- " ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1717238703, \\'localtime\\': \\'2024-06-01 3:45\\'}, \\'current\\': {\\'last_updated_epoch\\': 1717237800, \\'last_updated\\': \\'2024-06-01 03:30\\', \\'temp_c\\': 12.0, \\'temp_f\\': 53.6, \\'is_day\\': 0, \\'condition\\': {\\'text\\': \\'Mist\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/night/143.png\\', \\'code\\': 1030}, \\'wind_mph\\': 5.6, \\'wind_kph\\': 9.0, \\'wind_degree\\': 310, \\'wind_dir\\': \\'NW\\', \\'pressure_mb\\': 1013.0, \\'pressure_in\\': 29.92, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 88, \\'cloud\\': 100, \\'feelslike_c\\': 10.5, \\'feelslike_f\\': 50.8, \\'windchill_c\\': 9.3, \\'windchill_f\\': 48.7, \\'heatindex_c\\': 11.1, \\'heatindex_f\\': 51.9, \\'dewpoint_c\\': 8.8, \\'dewpoint_f\\': 47.8, \\'vis_km\\': 6.4, \\'vis_miles\\': 3.0, \\'uv\\': 1.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.1}}\"}, {\"url\": \"https://www.timeanddate.com/weather/usa/san-francisco/hourly\", \"content\": \"Sun & Moon. Weather Today Weather Hourly 14 Day Forecast Yesterday/Past Weather Climate (Averages) Currently: 59 \\\\u00b0F. Passing clouds. (Weather station: San Francisco International Airport, USA). See more current weather.\"}]', name='tavily_search_results_json', id='37aa1fd9-b232-4a02-bd22-bc5b9b44a22c', tool_call_id='toolu_01Y5EK4bw2LqsQXeaUv8iueF'),\n",
- " AIMessage(content='Based on the search results, here is a summary of the current weather in San Francisco:\\n\\nThe weather in San Francisco is currently misty with a temperature of around 53°F (12°C). There is complete cloud cover and moderate winds from the northwest around 5-9 mph (9-14 km/h). Humidity is high at 88%. Visibility is around 3 miles (6.4 km). \\n\\nThe results provide an hourly forecast as well as current conditions from a couple different weather sources. Let me know if you need any additional details about the San Francisco weather!', response_metadata={'id': 'msg_01BRX9mrT19nBDdHYtR7wJ92', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 920, 'output_tokens': 132}}, id='run-d0325583-3ddc-4432-b2b2-d023eb97660f-0', usage_metadata={'input_tokens': 920, 'output_tokens': 132, 'total_tokens': 1052})]"
+ "[HumanMessage(content='whats the weather in sf?', additional_kwargs={}, response_metadata={}, id='dd268fda-5e57-4bc9-a0a5-63d9e88d7659'),\n",
+ " AIMessage(content=[{'text': 'To get current weather information for San Francisco, we can use the tavily_search_results_json tool:', 'type': 'text'}, {'id': 'toolu_01FsvX6nE7wAgnuHZoWwEEDC', 'input': {'query': 'san francisco weather'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], additional_kwargs={}, response_metadata={'id': 'msg_019wc7ZgXtnqdUGavis6kNdE', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 269, 'output_tokens': 84}}, id='run-1f61d7a2-6200-4ed3-82d0-90e17e558ca4-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'san francisco weather'}, 'id': 'toolu_01FsvX6nE7wAgnuHZoWwEEDC', 'type': 'tool_call'}], usage_metadata={'input_tokens': 269, 'output_tokens': 84, 'total_tokens': 353}),\n",
+ " ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1726098811, \\'localtime\\': \\'2024-09-11 16:53\\'}, \\'current\\': {\\'last_updated_epoch\\': 1726098300, \\'last_updated\\': \\'2024-09-11 16:45\\', \\'temp_c\\': 22.8, \\'temp_f\\': 73.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Partly cloudy\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/116.png\\', \\'code\\': 1003}, \\'wind_mph\\': 18.6, \\'wind_kph\\': 29.9, \\'wind_degree\\': 290, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1011.0, \\'pressure_in\\': 29.86, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 64, \\'cloud\\': 25, \\'feelslike_c\\': 24.9, \\'feelslike_f\\': 76.9, \\'windchill_c\\': 18.4, \\'windchill_f\\': 65.1, \\'heatindex_c\\': 18.4, \\'heatindex_f\\': 65.1, \\'dewpoint_c\\': 14.8, \\'dewpoint_f\\': 58.6, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 27.3, \\'gust_kph\\': 43.9}}\"}, {\"url\": \"https://www.wunderground.com/weather/us/ca/san-francisco\", \"content\": \"San Francisco Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the San Francisco area. ... 2024 (GMT -7 ...\"}]', name='tavily_search_results_json', id='4cc945d0-15ca-4afa-87c6-6bb16cad08a2', tool_call_id='toolu_01FsvX6nE7wAgnuHZoWwEEDC', artifact={'query': 'san francisco weather', 'follow_up_questions': None, 'answer': None, 'images': [], 'results': [{'title': 'Weather in San Francisco', 'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1726098811, 'localtime': '2024-09-11 16:53'}, 'current': {'last_updated_epoch': 1726098300, 'last_updated': '2024-09-11 16:45', 'temp_c': 22.8, 'temp_f': 73.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 18.6, 'wind_kph': 29.9, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1011.0, 'pressure_in': 29.86, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 64, 'cloud': 25, 'feelslike_c': 24.9, 'feelslike_f': 76.9, 'windchill_c': 18.4, 'windchill_f': 65.1, 'heatindex_c': 18.4, 'heatindex_f': 65.1, 'dewpoint_c': 14.8, 'dewpoint_f': 58.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.3, 'gust_kph': 43.9}}\", 'score': 0.9992269, 'raw_content': None}, {'title': 'San Francisco, CA Weather Conditions | Weather Underground', 'url': 'https://www.wunderground.com/weather/us/ca/san-francisco', 'content': 'San Francisco Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the San Francisco area. ... 2024 (GMT -7 ...', 'score': 0.9984022, 'raw_content': None}], 'response_time': 2.54}),\n",
+ " AIMessage(content='The search results provide current weather conditions and forecasts for San Francisco from reputable weather sites like WeatherAPI and Weather Underground.\\n\\nThe key details from the WeatherAPI results are:\\n\\n- Current temperature: 22.8°C / 73.0°F\\n- Conditions: Partly cloudy \\n- Wind: 18.6 mph / 29.9 kph from the WNW\\n- Humidity: 64%\\n- Cloud cover: 25%\\n\\nSo in summary, as of mid-afternoon on September 11, 2024, the weather in San Francisco is partly cloudy with temperatures around 73°F, breezy winds from the northwest around 18-19 mph, and moderate humidity in the 60% range.\\n\\nThe forecasts from Weather Underground can provide additional details on the weather outlook over the next few days. Let me know if you need any other specific weather information for San Francisco!', additional_kwargs={}, response_metadata={'id': 'msg_018TRob5TkqZHLVJit3WFyf9', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 930, 'output_tokens': 206}}, id='run-3fc0fc97-5686-496c-87f4-4b6e089f593c-0', usage_metadata={'input_tokens': 930, 'output_tokens': 206, 'total_tokens': 1136})]"
]
},
"execution_count": 11,
@@ -491,19 +1006,38 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"id": "532d6557",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:34.268628Z",
+ "iopub.status.busy": "2024-09-11T23:56:34.268316Z",
+ "iopub.status.idle": "2024-09-11T23:56:43.815582Z",
+ "shell.execute_reply": "2024-09-11T23:56:43.814998Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_50Kb8zHmFqPYavQwF5TgcOH8', 'function': {'arguments': '{\\n \"query\": \"current weather in San Francisco\"\\n}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 23, 'prompt_tokens': 134, 'total_tokens': 157}, 'model_name': 'gpt-4', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-042d5feb-c2cc-4c3f-b8fd-dbc22fd0bc07-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_50Kb8zHmFqPYavQwF5TgcOH8'}])]}}\n",
- "----\n",
- "{'action': {'messages': [ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1714426906, \\'localtime\\': \\'2024-04-29 14:41\\'}, \\'current\\': {\\'last_updated_epoch\\': 1714426200, \\'last_updated\\': \\'2024-04-29 14:30\\', \\'temp_c\\': 17.8, \\'temp_f\\': 64.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Sunny\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/113.png\\', \\'code\\': 1000}, \\'wind_mph\\': 23.0, \\'wind_kph\\': 37.1, \\'wind_degree\\': 290, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1019.0, \\'pressure_in\\': 30.09, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 50, \\'cloud\\': 0, \\'feelslike_c\\': 17.8, \\'feelslike_f\\': 64.0, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 27.5, \\'gust_kph\\': 44.3}}\"}, {\"url\": \"https://world-weather.info/forecast/usa/san_francisco/april-2024/\", \"content\": \"Extended weather forecast in San Francisco. Hourly Week 10 days 14 days 30 days Year. Detailed \\\\u26a1 San Francisco Weather Forecast for April 2024 - day/night \\\\ud83c\\\\udf21\\\\ufe0f temperatures, precipitations - World-Weather.info.\"}]', name='tavily_search_results_json', id='d88320ac-3fe1-4f73-870a-3681f15f6982', tool_call_id='call_50Kb8zHmFqPYavQwF5TgcOH8')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='The current weather in San Francisco, California is sunny with a temperature of 17.8°C (64.0°F). The wind is coming from the WNW at 23.0 mph. The humidity is at 50%. [source](https://www.weatherapi.com/)', response_metadata={'token_usage': {'completion_tokens': 58, 'prompt_tokens': 602, 'total_tokens': 660}, 'model_name': 'gpt-4', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-0cd2a507-ded5-4601-afe3-3807400e9989-0')]}}\n",
+ "{'agent': {'messages': [AIMessage(content=[{'id': 'toolu_01QGkj39Dk67gbximVZPUbYL', 'input': {'query': 'weather san francisco'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], additional_kwargs={}, response_metadata={'id': 'msg_01MbDutXi5oeszaLfdURh5hm', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 269, 'output_tokens': 60}}, id='run-4e7002fd-8735-41db-b6ed-35c9d3b89ba2-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather san francisco'}, 'id': 'toolu_01QGkj39Dk67gbximVZPUbYL', 'type': 'tool_call'}], usage_metadata={'input_tokens': 269, 'output_tokens': 60, 'total_tokens': 329})]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'tools': {'messages': [ToolMessage(content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1726098811, \\'localtime\\': \\'2024-09-11 16:53\\'}, \\'current\\': {\\'last_updated_epoch\\': 1726098300, \\'last_updated\\': \\'2024-09-11 16:45\\', \\'temp_c\\': 22.8, \\'temp_f\\': 73.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Partly cloudy\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/116.png\\', \\'code\\': 1003}, \\'wind_mph\\': 18.6, \\'wind_kph\\': 29.9, \\'wind_degree\\': 290, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1011.0, \\'pressure_in\\': 29.86, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 64, \\'cloud\\': 25, \\'feelslike_c\\': 24.9, \\'feelslike_f\\': 76.9, \\'windchill_c\\': 18.4, \\'windchill_f\\': 65.1, \\'heatindex_c\\': 18.4, \\'heatindex_f\\': 65.1, \\'dewpoint_c\\': 14.8, \\'dewpoint_f\\': 58.6, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 27.3, \\'gust_kph\\': 43.9}}\"}, {\"url\": \"https://weather.com/weather/monthly/l/USCA0987:1:US\", \"content\": \"Weather.com brings you the most accurate monthly weather forecast for San Francisco, CA with average/record and high/low temperatures, precipitation and more. ... 11. 72 \\\\u00b0 57 \\\\u00b0 12. 72 \\\\u00b0 54 ...\"}]', name='tavily_search_results_json', tool_call_id='toolu_01QGkj39Dk67gbximVZPUbYL', artifact={'query': 'weather san francisco', 'follow_up_questions': None, 'answer': None, 'images': [], 'results': [{'title': 'Weather in San Francisco', 'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1726098811, 'localtime': '2024-09-11 16:53'}, 'current': {'last_updated_epoch': 1726098300, 'last_updated': '2024-09-11 16:45', 'temp_c': 22.8, 'temp_f': 73.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 18.6, 'wind_kph': 29.9, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1011.0, 'pressure_in': 29.86, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 64, 'cloud': 25, 'feelslike_c': 24.9, 'feelslike_f': 76.9, 'windchill_c': 18.4, 'windchill_f': 65.1, 'heatindex_c': 18.4, 'heatindex_f': 65.1, 'dewpoint_c': 14.8, 'dewpoint_f': 58.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.3, 'gust_kph': 43.9}}\", 'score': 0.9980327, 'raw_content': None}, {'title': 'Monthly Weather Forecast for San Francisco, CA - weather.com', 'url': 'https://weather.com/weather/monthly/l/USCA0987:1:US', 'content': 'Weather.com brings you the most accurate monthly weather forecast for San Francisco, CA with average/record and high/low temperatures, precipitation and more. ... 11. 72 ° 57 ° 12. 72 ° 54 ...', 'score': 0.98005307, 'raw_content': None}], 'response_time': 2.82})]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content=\"The search results provide current weather conditions and forecasts for San Francisco, California. Some key details:\\n\\n- The current temperature in San Francisco is around 73°F (23°C) with partly cloudy skies.\\n\\n- Wind speeds are around 18-27 mph (29-44 kph) from the west-northwest. \\n\\n- Humidity is 64% and visibility is good at 9 miles (16 km).\\n\\n- Over the next couple weeks, temperatures are expected to stay mild, ranging from highs around 72°F (22°C) to lows in the mid 50sF (12-13°C).\\n\\n- No rain is in the current forecast.\\n\\nSo in summary, it's a pleasant partly cloudy day in San Francisco with seasonable temperatures for September and breezy conditions. The weather looks to remain nice over the next couple weeks as well with no rain expected.\", additional_kwargs={}, response_metadata={'id': 'msg_01NhPksUogasTj2gjJnDq9fP', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 929, 'output_tokens': 201}}, id='run-f51adbfc-205a-48b1-be80-c76340584bc9-0', usage_metadata={'input_tokens': 929, 'output_tokens': 201, 'total_tokens': 1130})]}}\n",
"----\n"
]
}
@@ -533,20 +1067,109 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 13,
"id": "a3fb262c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:43.818990Z",
+ "iopub.status.busy": "2024-09-11T23:56:43.818711Z",
+ "iopub.status.idle": "2024-09-11T23:56:55.265129Z",
+ "shell.execute_reply": "2024-09-11T23:56:55.264594Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "--\n",
- "Starting tool: tavily_search_results_json with inputs: {'query': 'current weather in San Francisco'}\n",
+ "[{'text': 'To', 'type': 'text', 'index': 0}]|[{'text': ' get the current weather', 'type': 'text', 'index': 0}]|[{'text': ' in San Francisco,', 'type': 'text', 'index': 0}]|[{'text': ' we', 'type': 'text', 'index': 0}]|[{'text': ' can use the', 'type': 'text', 'index': 0}]|[{'text': ' Tavily search engine', 'type': 'text', 'index': 0}]|[{'text': ':', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'id': 'toolu_017QTrz3k83pjEtfWSfQjkL4', 'input': {}, 'name': 'tavily_search_results_json', 'type': 'tool_use', 'index': 1}]|[{'partial_json': '', 'type': 'tool_use', 'index': 1}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'partial_json': '{\"query\": \"s', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'an fr', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'anci', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'sc', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'o wea', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'the', 'type': 'tool_use', 'index': 1}]|[{'partial_json': 'r\"}', 'type': 'tool_use', 'index': 1}]|--\n",
+ "Starting tool: tavily_search_results_json with inputs: {'query': 'san francisco weather'}\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"Done tool: tavily_search_results_json\n",
- "Tool output was: [{'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1714427052, 'localtime': '2024-04-29 14:44'}, 'current': {'last_updated_epoch': 1714426200, 'last_updated': '2024-04-29 14:30', 'temp_c': 17.8, 'temp_f': 64.0, 'is_day': 1, 'condition': {'text': 'Sunny', 'icon': '//cdn.weatherapi.com/weather/64x64/day/113.png', 'code': 1000}, 'wind_mph': 23.0, 'wind_kph': 37.1, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1019.0, 'pressure_in': 30.09, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 50, 'cloud': 0, 'feelslike_c': 17.8, 'feelslike_f': 64.0, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.5, 'gust_kph': 44.3}}\"}, {'url': 'https://www.weathertab.com/en/c/e/04/united-states/california/san-francisco/', 'content': 'San Francisco Weather Forecast for Apr 2024 - Risk of Rain Graph. Rain Risk Graph: Monthly Overview. Bar heights indicate rain risk percentages. Yellow bars mark low-risk days, while black and grey bars signal higher risks. Grey-yellow bars act as buffers, advising to keep at least one day clear from the riskier grey and black days, guiding ...'}]\n",
- "--\n",
- "The| current| weather| in| San| Francisco|,| California|,| USA| is| sunny| with| a| temperature| of| |17|.|8|°C| (|64|.|0|°F|).| The| wind| is| blowing| from| the| W|NW| at| a| speed| of| |37|.|1| k|ph| (|23|.|0| mph|).| The| humidity| level| is| at| |50|%.| [|Source|](|https|://|www|.weather|api|.com|/)|"
+ "Tool output was: content='[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'San Francisco\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 37.78, \\'lon\\': -122.42, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1726098992, \\'localtime\\': \\'2024-09-11 16:56\\'}, \\'current\\': {\\'last_updated_epoch\\': 1726098300, \\'last_updated\\': \\'2024-09-11 16:45\\', \\'temp_c\\': 22.8, \\'temp_f\\': 73.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Partly cloudy\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/116.png\\', \\'code\\': 1003}, \\'wind_mph\\': 18.6, \\'wind_kph\\': 29.9, \\'wind_degree\\': 290, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1011.0, \\'pressure_in\\': 29.86, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 64, \\'cloud\\': 25, \\'feelslike_c\\': 24.9, \\'feelslike_f\\': 76.9, \\'windchill_c\\': 18.4, \\'windchill_f\\': 65.1, \\'heatindex_c\\': 18.4, \\'heatindex_f\\': 65.1, \\'dewpoint_c\\': 14.8, \\'dewpoint_f\\': 58.6, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 27.3, \\'gust_kph\\': 43.9}}\"}, {\"url\": \"https://www.weathertab.com/en/c/e/09/united-states/california/san-francisco/\", \"content\": \"Explore comprehensive September 2024 weather forecasts for San Francisco, including daily high and low temperatures, precipitation risks, and monthly temperature trends. Featuring detailed day-by-day forecasts, dynamic graphs of daily rain probabilities, and temperature trends to help you plan ahead. ... 5 67\\\\u00b0F 55\\\\u00b0F 19\\\\u00b0C 13\\\\u00b0C 09% 6 66\\\\u00b0F 55 ...\"}]' name='tavily_search_results_json' tool_call_id='toolu_017QTrz3k83pjEtfWSfQjkL4' artifact={'query': 'san francisco weather', 'follow_up_questions': None, 'answer': None, 'images': [], 'results': [{'title': 'Weather in San Francisco', 'url': 'https://www.weatherapi.com/', 'content': \"{'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1726098992, 'localtime': '2024-09-11 16:56'}, 'current': {'last_updated_epoch': 1726098300, 'last_updated': '2024-09-11 16:45', 'temp_c': 22.8, 'temp_f': 73.0, 'is_day': 1, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/day/116.png', 'code': 1003}, 'wind_mph': 18.6, 'wind_kph': 29.9, 'wind_degree': 290, 'wind_dir': 'WNW', 'pressure_mb': 1011.0, 'pressure_in': 29.86, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 64, 'cloud': 25, 'feelslike_c': 24.9, 'feelslike_f': 76.9, 'windchill_c': 18.4, 'windchill_f': 65.1, 'heatindex_c': 18.4, 'heatindex_f': 65.1, 'dewpoint_c': 14.8, 'dewpoint_f': 58.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 5.0, 'gust_mph': 27.3, 'gust_kph': 43.9}}\", 'score': 0.9990233, 'raw_content': None}, {'title': 'San Francisco, CA Weather Forecast September 2024: Daily Highs/Lows ...', 'url': 'https://www.weathertab.com/en/c/e/09/united-states/california/san-francisco/', 'content': 'Explore comprehensive September 2024 weather forecasts for San Francisco, including daily high and low temperatures, precipitation risks, and monthly temperature trends. Featuring detailed day-by-day forecasts, dynamic graphs of daily rain probabilities, and temperature trends to help you plan ahead. ... 5 67°F 55°F 19°C 13°C 09% 6 66°F 55 ...', 'score': 0.9975561, 'raw_content': None}], 'response_time': 2.94}\n",
+ "--\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': '\\n\\nThe', 'type': 'text', 'index': 0}]|[{'text': ' search', 'type': 'text', 'index': 0}]|[{'text': ' results provide', 'type': 'text', 'index': 0}]|[{'text': ' details on the current', 'type': 'text', 'index': 0}]|[{'text': ' weather conditions in San', 'type': 'text', 'index': 0}]|[{'text': ' Francisco, including temperature', 'type': 'text', 'index': 0}]|[{'text': ', clou', 'type': 'text', 'index': 0}]|[{'text': 'd cover, wind,', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': ' humidity an', 'type': 'text', 'index': 0}]|[{'text': 'd other', 'type': 'text', 'index': 0}]|[{'text': ' meteor', 'type': 'text', 'index': 0}]|[{'text': 'ological data.', 'type': 'text', 'index': 0}]|[{'text': '\\n\\nThe', 'type': 'text', 'index': 0}]|[{'text': ' key', 'type': 'text', 'index': 0}]|[{'text': ' details', 'type': 'text', 'index': 0}]|[{'text': ' are:\\n\\n-', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': ' Temperature', 'type': 'text', 'index': 0}]|[{'text': ': 73', 'type': 'text', 'index': 0}]|[{'text': '°F (23', 'type': 'text', 'index': 0}]|[{'text': '°C)', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': '\\n- Conditions', 'type': 'text', 'index': 0}]|[{'text': ': Partly clou', 'type': 'text', 'index': 0}]|[{'text': 'dy \\n-', 'type': 'text', 'index': 0}]|[{'text': ' Wind: ', 'type': 'text', 'index': 0}]|[{'text': '18.6 ', 'type': 'text', 'index': 0}]|[{'text': 'mph (29.', 'type': 'text', 'index': 0}]|[{'text': '9 kph', 'type': 'text', 'index': 0}]|[{'text': ') from the W', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': 'NW\\n-', 'type': 'text', 'index': 0}]|[{'text': ' Humidity: ', 'type': 'text', 'index': 0}]|[{'text': '64%\\n-', 'type': 'text', 'index': 0}]|[{'text': ' Clou', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': 'd Cover', 'type': 'text', 'index': 0}]|[{'text': ': 25%', 'type': 'text', 'index': 0}]|[{'text': '\\n\\nSo', 'type': 'text', 'index': 0}]|[{'text': ' in summary, it', 'type': 'text', 'index': 0}]|[{'text': \"'s\", 'type': 'text', 'index': 0}]|[{'text': ' a', 'type': 'text', 'index': 0}]|[{'text': ' warm', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': ' partly', 'type': 'text', 'index': 0}]|[{'text': ' cloudy day in', 'type': 'text', 'index': 0}]|[{'text': ' San Francisco with moderate', 'type': 'text', 'index': 0}]|[{'text': ' winds and humidity levels', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': '. The temperature', 'type': 'text', 'index': 0}]|[{'text': ' is around 73', 'type': 'text', 'index': 0}]|[{'text': '°F/', 'type': 'text', 'index': 0}]|[{'text': '23°C as', 'type': 'text', 'index': 0}]|[{'text': ' of late', 'type': 'text', 'index': 0}]|[{'text': ' afternoon', 'type': 'text', 'index': 0}]|[{'text': '. Let me know', 'type': 'text', 'index': 0}]|[{'text': ' if you need any', 'type': 'text', 'index': 0}]|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[{'text': ' other', 'type': 'text', 'index': 0}]|[{'text': ' details on', 'type': 'text', 'index': 0}]|[{'text': ' the SF', 'type': 'text', 'index': 0}]|[{'text': ' weather!', 'type': 'text', 'index': 0}]|"
]
}
],
@@ -601,9 +1224,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"id": "c4073e35",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:55.268274Z",
+ "iopub.status.busy": "2024-09-11T23:56:55.268025Z",
+ "iopub.status.idle": "2024-09-11T23:56:55.270694Z",
+ "shell.execute_reply": "2024-09-11T23:56:55.270239Z"
+ }
+ },
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import MemorySaver\n",
@@ -613,9 +1243,16 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 15,
"id": "e64a944e-f9ac-43cf-903c-d3d28d765377",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:55.273223Z",
+ "iopub.status.busy": "2024-09-11T23:56:55.273050Z",
+ "iopub.status.idle": "2024-09-11T23:56:55.278074Z",
+ "shell.execute_reply": "2024-09-11T23:56:55.277592Z"
+ }
+ },
"outputs": [],
"source": [
"agent_executor = create_react_agent(model, tools, checkpointer=memory)\n",
@@ -625,15 +1262,22 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 16,
"id": "a13462d0-2d02-4474-921e-15a1ba1fa274",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:55.280114Z",
+ "iopub.status.busy": "2024-09-11T23:56:55.279947Z",
+ "iopub.status.idle": "2024-09-11T23:56:57.067886Z",
+ "shell.execute_reply": "2024-09-11T23:56:57.067031Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content=\"Hello Bob! It's nice to meet you again.\", response_metadata={'id': 'msg_013C1z2ZySagEFwmU1EsysR2', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1162, 'output_tokens': 14}}, id='run-f878acfd-d195-44e8-9166-e2796317e3f8-0', usage_metadata={'input_tokens': 1162, 'output_tokens': 14, 'total_tokens': 1176})]}}\n",
+ "{'agent': {'messages': [AIMessage(content=\"Hello Bob! It's nice to meet you. I don't actually need to use any tools to respond to a simple greeting. How are you doing today?\", additional_kwargs={}, response_metadata={'id': 'msg_011osVvD1gEohDvVLUGajUyB', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 266, 'output_tokens': 35}}, id='run-9802dd41-050c-47e5-b624-c098b4b53c58-0', usage_metadata={'input_tokens': 266, 'output_tokens': 35, 'total_tokens': 301})]}}\n",
"----\n"
]
}
@@ -648,15 +1292,22 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 17,
"id": "56d8028b-5dbc-40b2-86f5-ed60631d86a3",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:57.071597Z",
+ "iopub.status.busy": "2024-09-11T23:56:57.071276Z",
+ "iopub.status.idle": "2024-09-11T23:56:58.603676Z",
+ "shell.execute_reply": "2024-09-11T23:56:58.602993Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='You mentioned your name is Bob when you introduced yourself earlier. So your name is Bob.', response_metadata={'id': 'msg_01WNwnRNGwGDRw6vRdivt6i1', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1184, 'output_tokens': 21}}, id='run-f5c0b957-8878-405a-9d4b-a7cd38efe81f-0', usage_metadata={'input_tokens': 1184, 'output_tokens': 21, 'total_tokens': 1205})]}}\n",
+ "{'agent': {'messages': [AIMessage(content='You said your name is Bob in your first message when you said \"hi im bob!\".', additional_kwargs={}, response_metadata={'id': 'msg_01L1AhTC4RkjevWQ2ktPjKkp', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 309, 'output_tokens': 22}}, id='run-f407156d-184c-499c-8207-bbc1786dc878-0', usage_metadata={'input_tokens': 309, 'output_tokens': 22, 'total_tokens': 331})]}}\n",
"----\n"
]
}
@@ -687,15 +1338,22 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 18,
"id": "24460239",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:56:58.607485Z",
+ "iopub.status.busy": "2024-09-11T23:56:58.607136Z",
+ "iopub.status.idle": "2024-09-11T23:57:00.480971Z",
+ "shell.execute_reply": "2024-09-11T23:57:00.480370Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content=\"I'm afraid I don't actually know your name. As an AI assistant without personal information about you, I don't have a specific name associated with our conversation.\", response_metadata={'id': 'msg_01NoaXNNYZKSoBncPcLkdcbo', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 267, 'output_tokens': 36}}, id='run-c9f7df3d-525a-4d8f-bbcf-a5b4a5d2e4b0-0', usage_metadata={'input_tokens': 267, 'output_tokens': 36, 'total_tokens': 303})]}}\n",
+ "{'agent': {'messages': [AIMessage(content=\"Unfortunately, I don't have enough information to know your name. As an AI assistant without personal knowledge about you, I don't have a way to look up or determine your name unless you provide it to me.\", additional_kwargs={}, response_metadata={'id': 'msg_01Pgype414fuF8cHzBu5mCsd', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 267, 'output_tokens': 46}}, id='run-bbade9ec-ca90-4f1f-bb58-c760e5c0940c-0', usage_metadata={'input_tokens': 267, 'output_tokens': 46, 'total_tokens': 313})]}}\n",
"----\n"
]
}
@@ -749,7 +1407,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.3"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/chatbot.ipynb b/docs/docs/tutorials/chatbot.ipynb
index c05db80cb74..e4dbc499730 100644
--- a/docs/docs/tutorials/chatbot.ipynb
+++ b/docs/docs/tutorials/chatbot.ipynb
@@ -117,7 +117,14 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:01.958338Z",
+ "iopub.status.busy": "2024-09-11T23:57:01.957984Z",
+ "iopub.status.idle": "2024-09-11T23:57:02.585528Z",
+ "shell.execute_reply": "2024-09-11T23:57:02.585231Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -138,12 +145,19 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:02.587214Z",
+ "iopub.status.busy": "2024-09-11T23:57:02.587084Z",
+ "iopub.status.idle": "2024-09-11T23:57:03.170281Z",
+ "shell.execute_reply": "2024-09-11T23:57:03.169964Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "AIMessage(content='Hello Bob! How can I assist you today?', response_metadata={'token_usage': {'completion_tokens': 10, 'prompt_tokens': 12, 'total_tokens': 22}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-d939617f-0c3b-45e9-a93f-13dafecbd4b5-0', usage_metadata={'input_tokens': 12, 'output_tokens': 10, 'total_tokens': 22})"
+ "AIMessage(content='Hello Bob! How can I assist you today?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 10, 'prompt_tokens': 12, 'total_tokens': 22}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-e39455b6-fed8-4acb-8853-2f3783fc2de5-0', usage_metadata={'input_tokens': 12, 'output_tokens': 10, 'total_tokens': 22})"
]
},
"execution_count": 2,
@@ -167,12 +181,19 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:03.171932Z",
+ "iopub.status.busy": "2024-09-11T23:57:03.171822Z",
+ "iopub.status.idle": "2024-09-11T23:57:03.735573Z",
+ "shell.execute_reply": "2024-09-11T23:57:03.734892Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "AIMessage(content=\"I'm sorry, I don't have access to personal information unless you provide it to me. How may I assist you today?\", response_metadata={'token_usage': {'completion_tokens': 26, 'prompt_tokens': 12, 'total_tokens': 38}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-47bc8c20-af7b-4fd2-9345-f0e9fdf18ce3-0', usage_metadata={'input_tokens': 12, 'output_tokens': 26, 'total_tokens': 38})"
+ "AIMessage(content=\"I'm sorry, I do not have the ability to know your name. You can tell me your name if you'd like.\", additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 26, 'prompt_tokens': 12, 'total_tokens': 38}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-3d94be63-b58b-4542-b6a6-86e677cf3c64-0', usage_metadata={'input_tokens': 12, 'output_tokens': 26, 'total_tokens': 38})"
]
},
"execution_count": 3,
@@ -199,12 +220,19 @@
{
"cell_type": "code",
"execution_count": 4,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:03.741545Z",
+ "iopub.status.busy": "2024-09-11T23:57:03.741077Z",
+ "iopub.status.idle": "2024-09-11T23:57:04.253562Z",
+ "shell.execute_reply": "2024-09-11T23:57:04.252989Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "AIMessage(content='Your name is Bob. How can I help you, Bob?', response_metadata={'token_usage': {'completion_tokens': 13, 'prompt_tokens': 35, 'total_tokens': 48}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-9f90291b-4df9-41dc-9ecf-1ee1081f4490-0', usage_metadata={'input_tokens': 35, 'output_tokens': 13, 'total_tokens': 48})"
+ "AIMessage(content='Your name is Bob.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 5, 'prompt_tokens': 35, 'total_tokens': 40}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-2a20b6d5-d9c8-4844-b9b6-316c862a2726-0', usage_metadata={'input_tokens': 35, 'output_tokens': 5, 'total_tokens': 40})"
]
},
"execution_count": 4,
@@ -251,8 +279,75 @@
{
"cell_type": "code",
"execution_count": 5,
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:04.257534Z",
+ "iopub.status.busy": "2024-09-11T23:57:04.257242Z",
+ "iopub.status.idle": "2024-09-11T23:57:05.441201Z",
+ "shell.execute_reply": "2024-09-11T23:57:05.440612Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: langchain_community in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.3.0.dev2)\r\n",
+ "Requirement already satisfied: PyYAML>=5.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (6.0.2)\r\n",
+ "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (2.0.32)\r\n",
+ "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (3.10.1)\r\n",
+ "Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (0.6.7)\r\n",
+ "Requirement already satisfied: langchain<0.4.0,>=0.3.0.dev2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (0.3.0.dev2)\r\n",
+ "Requirement already satisfied: langchain-core<0.4.0,>=0.3.0.dev5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (0.3.0.dev5)\r\n",
+ "Requirement already satisfied: langsmith<0.2.0,>=0.1.112 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (0.1.118)\r\n",
+ "Requirement already satisfied: numpy<2,>=1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (1.26.4)\r\n",
+ "Requirement already satisfied: pydantic-settings<3.0.0,>=2.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (2.4.0)\r\n",
+ "Requirement already satisfied: requests<3,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (2.32.3)\r\n",
+ "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_community) (8.5.0)\r\n",
+ "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (2.3.5)\r\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.3.1)\r\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (24.2.0)\r\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.4.1)\r\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (6.0.5)\r\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain_community) (1.9.4)\r\n",
+ "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain_community) (3.21.3)\r\n",
+ "Requirement already satisfied: typing-inspect<1,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain_community) (0.9.0)\r\n",
+ "Requirement already satisfied: langchain-text-splitters<0.4.0,>=0.3.0.dev1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain<0.4.0,>=0.3.0.dev2->langchain_community) (0.3.0.dev1)\r\n",
+ "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain<0.4.0,>=0.3.0.dev2->langchain_community) (2.8.2)\r\n",
+ "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev5->langchain_community) (1.33)\r\n",
+ "Requirement already satisfied: packaging<25,>=23.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev5->langchain_community) (24.1)\r\n",
+ "Requirement already satisfied: typing-extensions>=4.7 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev5->langchain_community) (4.12.2)\r\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.112->langchain_community) (0.27.0)\r\n",
+ "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.112->langchain_community) (3.10.6)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: python-dotenv>=0.21.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic-settings<3.0.0,>=2.4.0->langchain_community) (1.0.1)\r\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain_community) (3.3.2)\r\n",
+ "Requirement already satisfied: idna<4,>=2.5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain_community) (3.7)\r\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain_community) (2.2.2)\r\n",
+ "Requirement already satisfied: certifi>=2017.4.17 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langchain_community) (2024.7.4)\r\n",
+ "Requirement already satisfied: anyio in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (4.4.0)\r\n",
+ "Requirement already satisfied: httpcore==1.* in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (1.0.5)\r\n",
+ "Requirement already satisfied: sniffio in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (1.3.1)\r\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith<0.2.0,>=0.1.112->langchain_community) (0.14.0)\r\n",
+ "Requirement already satisfied: jsonpointer>=1.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.0.dev5->langchain_community) (3.0.0)\r\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain<0.4.0,>=0.3.0.dev2->langchain_community) (0.7.0)\r\n",
+ "Requirement already satisfied: pydantic-core==2.20.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain<0.4.0,>=0.3.0.dev2->langchain_community) (2.20.1)\r\n",
+ "Requirement already satisfied: mypy-extensions>=0.3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain_community) (1.0.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install langchain_community"
]
@@ -267,7 +362,14 @@
{
"cell_type": "code",
"execution_count": 6,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:05.444036Z",
+ "iopub.status.busy": "2024-09-11T23:57:05.443585Z",
+ "iopub.status.idle": "2024-09-11T23:57:05.450133Z",
+ "shell.execute_reply": "2024-09-11T23:57:05.449723Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.chat_history import (\n",
@@ -298,7 +400,14 @@
{
"cell_type": "code",
"execution_count": 7,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:05.452170Z",
+ "iopub.status.busy": "2024-09-11T23:57:05.452014Z",
+ "iopub.status.idle": "2024-09-11T23:57:05.454530Z",
+ "shell.execute_reply": "2024-09-11T23:57:05.453976Z"
+ }
+ },
"outputs": [],
"source": [
"config = {\"configurable\": {\"session_id\": \"abc2\"}}"
@@ -307,12 +416,19 @@
{
"cell_type": "code",
"execution_count": 8,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:05.456164Z",
+ "iopub.status.busy": "2024-09-11T23:57:05.456009Z",
+ "iopub.status.idle": "2024-09-11T23:57:06.036991Z",
+ "shell.execute_reply": "2024-09-11T23:57:06.036657Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Hi Bob! How can I assist you today?'"
+ "'Hello Bob! How can I assist you today?'"
]
},
"execution_count": 8,
@@ -332,12 +448,19 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:06.038534Z",
+ "iopub.status.busy": "2024-09-11T23:57:06.038435Z",
+ "iopub.status.idle": "2024-09-11T23:57:06.457932Z",
+ "shell.execute_reply": "2024-09-11T23:57:06.456611Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Your name is Bob. How can I help you today, Bob?'"
+ "'Your name is Bob.'"
]
},
"execution_count": 9,
@@ -364,12 +487,19 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:06.469705Z",
+ "iopub.status.busy": "2024-09-11T23:57:06.469266Z",
+ "iopub.status.idle": "2024-09-11T23:57:07.293900Z",
+ "shell.execute_reply": "2024-09-11T23:57:07.293272Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "\"I'm sorry, I cannot determine your name as I am an AI assistant and do not have access to that information.\""
+ "\"I'm sorry, I do not have access to personal information such as your name. Can I help you with anything else?\""
]
},
"execution_count": 10,
@@ -398,12 +528,19 @@
{
"cell_type": "code",
"execution_count": 11,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:07.298020Z",
+ "iopub.status.busy": "2024-09-11T23:57:07.297724Z",
+ "iopub.status.idle": "2024-09-11T23:57:07.814884Z",
+ "shell.execute_reply": "2024-09-11T23:57:07.814295Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Your name is Bob. How can I assist you today, Bob?'"
+ "'Your name is Bob.'"
]
},
"execution_count": 11,
@@ -445,7 +582,14 @@
{
"cell_type": "code",
"execution_count": 12,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:07.818756Z",
+ "iopub.status.busy": "2024-09-11T23:57:07.818484Z",
+ "iopub.status.idle": "2024-09-11T23:57:07.823113Z",
+ "shell.execute_reply": "2024-09-11T23:57:07.822576Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
@@ -473,12 +617,19 @@
{
"cell_type": "code",
"execution_count": 13,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:07.826830Z",
+ "iopub.status.busy": "2024-09-11T23:57:07.826561Z",
+ "iopub.status.idle": "2024-09-11T23:57:08.334793Z",
+ "shell.execute_reply": "2024-09-11T23:57:08.334208Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Hello Bob! How can I assist you today?'"
+ "'Hello, Bob! How can I assist you today?'"
]
},
"execution_count": 13,
@@ -502,7 +653,14 @@
{
"cell_type": "code",
"execution_count": 14,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:08.338564Z",
+ "iopub.status.busy": "2024-09-11T23:57:08.338279Z",
+ "iopub.status.idle": "2024-09-11T23:57:08.342585Z",
+ "shell.execute_reply": "2024-09-11T23:57:08.341929Z"
+ }
+ },
"outputs": [],
"source": [
"with_message_history = RunnableWithMessageHistory(chain, get_session_history)"
@@ -511,7 +669,14 @@
{
"cell_type": "code",
"execution_count": 15,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:08.346378Z",
+ "iopub.status.busy": "2024-09-11T23:57:08.346115Z",
+ "iopub.status.idle": "2024-09-11T23:57:08.349110Z",
+ "shell.execute_reply": "2024-09-11T23:57:08.348601Z"
+ }
+ },
"outputs": [],
"source": [
"config = {\"configurable\": {\"session_id\": \"abc5\"}}"
@@ -520,7 +685,14 @@
{
"cell_type": "code",
"execution_count": 16,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:08.352730Z",
+ "iopub.status.busy": "2024-09-11T23:57:08.352433Z",
+ "iopub.status.idle": "2024-09-11T23:57:08.861254Z",
+ "shell.execute_reply": "2024-09-11T23:57:08.860293Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -545,12 +717,19 @@
{
"cell_type": "code",
"execution_count": 17,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:08.867747Z",
+ "iopub.status.busy": "2024-09-11T23:57:08.867266Z",
+ "iopub.status.idle": "2024-09-11T23:57:09.388588Z",
+ "shell.execute_reply": "2024-09-11T23:57:09.387667Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Your name is Jim.'"
+ "'Your name is Jim. How can I help you further, Jim?'"
]
},
"execution_count": 17,
@@ -577,7 +756,14 @@
{
"cell_type": "code",
"execution_count": 18,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:09.393757Z",
+ "iopub.status.busy": "2024-09-11T23:57:09.393390Z",
+ "iopub.status.idle": "2024-09-11T23:57:09.400224Z",
+ "shell.execute_reply": "2024-09-11T23:57:09.399530Z"
+ }
+ },
"outputs": [],
"source": [
"prompt = ChatPromptTemplate.from_messages(\n",
@@ -603,7 +789,14 @@
{
"cell_type": "code",
"execution_count": 19,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:09.405818Z",
+ "iopub.status.busy": "2024-09-11T23:57:09.405194Z",
+ "iopub.status.idle": "2024-09-11T23:57:10.021094Z",
+ "shell.execute_reply": "2024-09-11T23:57:10.020526Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -634,7 +827,14 @@
{
"cell_type": "code",
"execution_count": 20,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:10.024644Z",
+ "iopub.status.busy": "2024-09-11T23:57:10.024402Z",
+ "iopub.status.idle": "2024-09-11T23:57:10.028308Z",
+ "shell.execute_reply": "2024-09-11T23:57:10.027524Z"
+ }
+ },
"outputs": [],
"source": [
"with_message_history = RunnableWithMessageHistory(\n",
@@ -647,7 +847,14 @@
{
"cell_type": "code",
"execution_count": 21,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:10.033627Z",
+ "iopub.status.busy": "2024-09-11T23:57:10.033161Z",
+ "iopub.status.idle": "2024-09-11T23:57:10.037328Z",
+ "shell.execute_reply": "2024-09-11T23:57:10.036426Z"
+ }
+ },
"outputs": [],
"source": [
"config = {\"configurable\": {\"session_id\": \"abc11\"}}"
@@ -656,7 +863,14 @@
{
"cell_type": "code",
"execution_count": 22,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:10.042031Z",
+ "iopub.status.busy": "2024-09-11T23:57:10.041699Z",
+ "iopub.status.idle": "2024-09-11T23:57:10.963560Z",
+ "shell.execute_reply": "2024-09-11T23:57:10.962634Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -681,12 +895,19 @@
{
"cell_type": "code",
"execution_count": 23,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:10.968049Z",
+ "iopub.status.busy": "2024-09-11T23:57:10.967633Z",
+ "iopub.status.idle": "2024-09-11T23:57:11.502520Z",
+ "shell.execute_reply": "2024-09-11T23:57:11.501770Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Tu nombre es Todd.'"
+ "'Tu nombre es Todd. ¿Hay algo más en lo que pueda ayudarte?'"
]
},
"execution_count": 23,
@@ -728,18 +949,25 @@
{
"cell_type": "code",
"execution_count": 24,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:11.507905Z",
+ "iopub.status.busy": "2024-09-11T23:57:11.507505Z",
+ "iopub.status.idle": "2024-09-11T23:57:11.675031Z",
+ "shell.execute_reply": "2024-09-11T23:57:11.674802Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[SystemMessage(content=\"you're a good assistant\"),\n",
- " HumanMessage(content='whats 2 + 2'),\n",
- " AIMessage(content='4'),\n",
- " HumanMessage(content='thanks'),\n",
- " AIMessage(content='no problem!'),\n",
- " HumanMessage(content='having fun?'),\n",
- " AIMessage(content='yes!')]"
+ "[SystemMessage(content=\"you're a good assistant\", additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='whats 2 + 2', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content='4', additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='thanks', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content='no problem!', additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='having fun?', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content='yes!', additional_kwargs={}, response_metadata={})]"
]
},
"execution_count": 24,
@@ -788,12 +1016,19 @@
{
"cell_type": "code",
"execution_count": 25,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:11.676461Z",
+ "iopub.status.busy": "2024-09-11T23:57:11.676371Z",
+ "iopub.status.idle": "2024-09-11T23:57:12.270724Z",
+ "shell.execute_reply": "2024-09-11T23:57:12.270134Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "\"I'm sorry, but I don't have access to your personal information. How can I assist you today?\""
+ "\"I'm sorry, but I don't have access to your personal information, including your name.\""
]
},
"execution_count": 25,
@@ -831,12 +1066,19 @@
{
"cell_type": "code",
"execution_count": 26,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:12.274665Z",
+ "iopub.status.busy": "2024-09-11T23:57:12.274381Z",
+ "iopub.status.idle": "2024-09-11T23:57:12.819147Z",
+ "shell.execute_reply": "2024-09-11T23:57:12.818592Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'You asked \"what\\'s 2 + 2?\"'"
+ "'You asked \"whats 2 + 2\"'"
]
},
"execution_count": 26,
@@ -864,7 +1106,14 @@
{
"cell_type": "code",
"execution_count": 27,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:12.824658Z",
+ "iopub.status.busy": "2024-09-11T23:57:12.824379Z",
+ "iopub.status.idle": "2024-09-11T23:57:12.828559Z",
+ "shell.execute_reply": "2024-09-11T23:57:12.827912Z"
+ }
+ },
"outputs": [],
"source": [
"with_message_history = RunnableWithMessageHistory(\n",
@@ -879,12 +1128,19 @@
{
"cell_type": "code",
"execution_count": 28,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:12.833415Z",
+ "iopub.status.busy": "2024-09-11T23:57:12.832996Z",
+ "iopub.status.idle": "2024-09-11T23:57:13.582059Z",
+ "shell.execute_reply": "2024-09-11T23:57:13.581471Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "\"I'm sorry, I don't have access to that information. How can I assist you today?\""
+ "\"I'm sorry, I don't have access to personal information. How can I assist you today?\""
]
},
"execution_count": 28,
@@ -914,12 +1170,19 @@
{
"cell_type": "code",
"execution_count": 29,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:13.587349Z",
+ "iopub.status.busy": "2024-09-11T23:57:13.586776Z",
+ "iopub.status.idle": "2024-09-11T23:57:14.659574Z",
+ "shell.execute_reply": "2024-09-11T23:57:14.658925Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "\"You haven't asked a math problem yet. Feel free to ask any math-related question you have, and I'll be happy to help you with it.\""
+ "\"You haven't asked a specific math problem yet. Feel free to ask any math-related question, and I'll be happy to help you with it!\""
]
},
"execution_count": 29,
@@ -962,13 +1225,20 @@
{
"cell_type": "code",
"execution_count": 30,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:14.663381Z",
+ "iopub.status.busy": "2024-09-11T23:57:14.663044Z",
+ "iopub.status.idle": "2024-09-11T23:57:15.371992Z",
+ "shell.execute_reply": "2024-09-11T23:57:15.371402Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "|Hi| Todd|!| Sure|,| here|'s| a| joke| for| you|:| Why| couldn|'t| the| bicycle| find| its| way| home|?| Because| it| lost| its| bearings|!| 😄||"
+ "|Hi| Todd|!| Sure|,| here|'s| a| joke| for| you|:| Why| did| the| scare|crow| win| an| award|?| Because| he| was| outstanding| in| his| field|!|😄||"
]
}
],
@@ -1019,7 +1289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.4"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/classification.ipynb b/docs/docs/tutorials/classification.ipynb
index 2df9b4a1a53..a977e0ed5db 100644
--- a/docs/docs/tutorials/classification.ipynb
+++ b/docs/docs/tutorials/classification.ipynb
@@ -44,10 +44,25 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "dc5cbb6f",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:16.873320Z",
+ "iopub.status.busy": "2024-09-11T23:57:16.872819Z",
+ "iopub.status.idle": "2024-09-11T23:57:18.012832Z",
+ "shell.execute_reply": "2024-09-11T23:57:18.012329Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install --upgrade --quiet langchain langchain-openai\n",
"\n",
@@ -66,9 +81,16 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 2,
"id": "39f3ce3e",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:18.015394Z",
+ "iopub.status.busy": "2024-09-11T23:57:18.015133Z",
+ "iopub.status.idle": "2024-09-11T23:57:18.565130Z",
+ "shell.execute_reply": "2024-09-11T23:57:18.564841Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.prompts import ChatPromptTemplate\n",
@@ -105,9 +127,16 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 3,
"id": "5509b6a6",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:18.566823Z",
+ "iopub.status.busy": "2024-09-11T23:57:18.566711Z",
+ "iopub.status.idle": "2024-09-11T23:57:19.423289Z",
+ "shell.execute_reply": "2024-09-11T23:57:19.419991Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -115,7 +144,7 @@
"Classification(sentiment='positive', aggressiveness=1, language='Spanish')"
]
},
- "execution_count": 6,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@@ -135,17 +164,24 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 4,
"id": "9154474c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:19.439694Z",
+ "iopub.status.busy": "2024-09-11T23:57:19.439293Z",
+ "iopub.status.idle": "2024-09-11T23:57:20.402176Z",
+ "shell.execute_reply": "2024-09-11T23:57:20.401386Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "{'sentiment': 'negative', 'aggressiveness': 8, 'language': 'Spanish'}"
+ "{'sentiment': 'enojado', 'aggressiveness': 8, 'language': 'es'}"
]
},
- "execution_count": 13,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -194,9 +230,16 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 5,
"id": "6a5f7961",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:20.407033Z",
+ "iopub.status.busy": "2024-09-11T23:57:20.406600Z",
+ "iopub.status.idle": "2024-09-11T23:57:20.413899Z",
+ "shell.execute_reply": "2024-09-11T23:57:20.413271Z"
+ }
+ },
"outputs": [],
"source": [
"class Classification(BaseModel):\n",
@@ -213,9 +256,16 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 6,
"id": "e5a5881f",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:20.417183Z",
+ "iopub.status.busy": "2024-09-11T23:57:20.416765Z",
+ "iopub.status.idle": "2024-09-11T23:57:20.445406Z",
+ "shell.execute_reply": "2024-09-11T23:57:20.444935Z"
+ }
+ },
"outputs": [],
"source": [
"tagging_prompt = ChatPromptTemplate.from_template(\n",
@@ -246,9 +296,16 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 7,
"id": "d9b9d53d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:20.448514Z",
+ "iopub.status.busy": "2024-09-11T23:57:20.448312Z",
+ "iopub.status.idle": "2024-09-11T23:57:20.963163Z",
+ "shell.execute_reply": "2024-09-11T23:57:20.960440Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -256,7 +313,7 @@
"Classification(sentiment='happy', aggressiveness=1, language='spanish')"
]
},
- "execution_count": 17,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -268,9 +325,16 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 8,
"id": "1c12fa00",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:20.967716Z",
+ "iopub.status.busy": "2024-09-11T23:57:20.967312Z",
+ "iopub.status.idle": "2024-09-11T23:57:21.448086Z",
+ "shell.execute_reply": "2024-09-11T23:57:21.446763Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -278,7 +342,7 @@
"Classification(sentiment='sad', aggressiveness=5, language='spanish')"
]
},
- "execution_count": 18,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -290,17 +354,24 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 9,
"id": "0bdfcb05",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:21.451860Z",
+ "iopub.status.busy": "2024-09-11T23:57:21.451514Z",
+ "iopub.status.idle": "2024-09-11T23:57:22.261267Z",
+ "shell.execute_reply": "2024-09-11T23:57:22.260665Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "Classification(sentiment='neutral', aggressiveness=2, language='english')"
+ "Classification(sentiment='happy', aggressiveness=1, language='english')"
]
},
- "execution_count": 19,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -348,7 +419,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/data_generation.ipynb b/docs/docs/tutorials/data_generation.ipynb
index 606ed357610..b68728bef80 100644
--- a/docs/docs/tutorials/data_generation.ipynb
+++ b/docs/docs/tutorials/data_generation.ipynb
@@ -51,10 +51,25 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "a0377478",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:23.823193Z",
+ "iopub.status.busy": "2024-09-11T23:57:23.822727Z",
+ "iopub.status.idle": "2024-09-11T23:57:26.254350Z",
+ "shell.execute_reply": "2024-09-11T23:57:26.253986Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install --upgrade --quiet langchain langchain_experimental langchain-openai\n",
"# Set env var OPENAI_API_KEY or load from a .env file:\n",
@@ -85,9 +100,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "291bad6e",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:26.256259Z",
+ "iopub.status.busy": "2024-09-11T23:57:26.256117Z",
+ "iopub.status.idle": "2024-09-11T23:57:26.258425Z",
+ "shell.execute_reply": "2024-09-11T23:57:26.258205Z"
+ }
+ },
"outputs": [],
"source": [
"class MedicalBilling(BaseModel):\n",
@@ -114,9 +136,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"id": "b989b792",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:26.259791Z",
+ "iopub.status.busy": "2024-09-11T23:57:26.259713Z",
+ "iopub.status.idle": "2024-09-11T23:57:26.261432Z",
+ "shell.execute_reply": "2024-09-11T23:57:26.261228Z"
+ }
+ },
"outputs": [],
"source": [
"examples = [\n",
@@ -146,9 +175,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"id": "ea6e042e",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:26.262729Z",
+ "iopub.status.busy": "2024-09-11T23:57:26.262649Z",
+ "iopub.status.idle": "2024-09-11T23:57:26.264455Z",
+ "shell.execute_reply": "2024-09-11T23:57:26.264266Z"
+ }
+ },
"outputs": [],
"source": [
"OPENAI_TEMPLATE = PromptTemplate(input_variables=[\"example\"], template=\"{example}\")\n",
@@ -180,9 +216,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"id": "1b9ba911",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:26.265653Z",
+ "iopub.status.busy": "2024-09-11T23:57:26.265572Z",
+ "iopub.status.idle": "2024-09-11T23:57:26.356136Z",
+ "shell.execute_reply": "2024-09-11T23:57:26.355830Z"
+ }
+ },
"outputs": [],
"source": [
"synthetic_data_generator = create_openai_data_generator(\n",
@@ -205,9 +248,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"id": "a424c890",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:26.357764Z",
+ "iopub.status.busy": "2024-09-11T23:57:26.357684Z",
+ "iopub.status.idle": "2024-09-11T23:57:36.394571Z",
+ "shell.execute_reply": "2024-09-11T23:57:36.393790Z"
+ }
+ },
"outputs": [],
"source": [
"synthetic_results = synthetic_data_generator.generate(\n",
@@ -235,9 +285,15 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"id": "9e715d94",
"metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:36.401241Z",
+ "iopub.status.busy": "2024-09-11T23:57:36.400739Z",
+ "iopub.status.idle": "2024-09-11T23:57:36.414171Z",
+ "shell.execute_reply": "2024-09-11T23:57:36.413523Z"
+ },
"scrolled": true
},
"outputs": [],
@@ -251,9 +307,15 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 8,
"id": "94fccedd",
"metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:36.419214Z",
+ "iopub.status.busy": "2024-09-11T23:57:36.418901Z",
+ "iopub.status.idle": "2024-09-11T23:57:36.459893Z",
+ "shell.execute_reply": "2024-09-11T23:57:36.459401Z"
+ },
"scrolled": true
},
"outputs": [],
@@ -265,19 +327,34 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 9,
"id": "4314c3ea",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:36.462316Z",
+ "iopub.status.busy": "2024-09-11T23:57:36.462156Z",
+ "iopub.status.idle": "2024-09-11T23:57:37.272924Z",
+ "shell.execute_reply": "2024-09-11T23:57:37.272185Z"
+ }
+ },
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/4j/2rz3865x6qg07tx43146py8h0000gn/T/ipykernel_60345/1337896113.py:1: LangChainDeprecationWarning: The method `Chain.__call__` was deprecated in langchain 0.1.0 and will be removed in 1.0. Use invoke instead.\n",
+ " chain({\"fields\": [\"blue\", \"yellow\"], \"preferences\": {}})\n"
+ ]
+ },
{
"data": {
"text/plain": [
"{'fields': ['blue', 'yellow'],\n",
" 'preferences': {},\n",
- " 'text': 'The vibrant blue sky contrasted beautifully with the bright yellow sun, creating a stunning display of colors that instantly lifted the spirits of all who gazed upon it.'}"
+ " 'text': 'The vibrant blue sky contrasted beautifully with the bright yellow sun, creating a stunning display of colors in the early morning sky.'}"
]
},
- "execution_count": 4,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -288,19 +365,26 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 10,
"id": "b116c487",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:37.276385Z",
+ "iopub.status.busy": "2024-09-11T23:57:37.275915Z",
+ "iopub.status.idle": "2024-09-11T23:57:38.219883Z",
+ "shell.execute_reply": "2024-09-11T23:57:38.219246Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
"{'fields': {'colors': ['blue', 'yellow']},\n",
" 'preferences': {'style': 'Make it in a style of a weather forecast.'},\n",
- " 'text': \"Good morning! Today's weather forecast brings a beautiful combination of colors to the sky, with hues of blue and yellow gently blending together like a mesmerizing painting.\"}"
+ " 'text': \"In today's weather forecast, expect a vibrant mix of blue and yellow colors painting the sky in a stunning display of contrast and beauty.\"}"
]
},
- "execution_count": 5,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -316,19 +400,26 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 11,
"id": "ff823394",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:38.223479Z",
+ "iopub.status.busy": "2024-09-11T23:57:38.222976Z",
+ "iopub.status.idle": "2024-09-11T23:57:38.992683Z",
+ "shell.execute_reply": "2024-09-11T23:57:38.992087Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
"{'fields': {'actor': 'Tom Hanks', 'movies': ['Forrest Gump', 'Green Mile']},\n",
" 'preferences': None,\n",
- " 'text': 'Tom Hanks, the renowned actor known for his incredible versatility and charm, has graced the silver screen in unforgettable movies such as \"Forrest Gump\" and \"Green Mile\".'}"
+ " 'text': 'Tom Hanks, known for his iconic roles in movies such as \"Forrest Gump\" and \"Green Mile\", has captivated audiences worldwide with his incredible talent and versatility as an actor.'}"
]
},
- "execution_count": 8,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -344,9 +435,15 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 12,
"id": "1ea1ad5b",
"metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:38.996445Z",
+ "iopub.status.busy": "2024-09-11T23:57:38.996046Z",
+ "iopub.status.idle": "2024-09-11T23:57:40.051128Z",
+ "shell.execute_reply": "2024-09-11T23:57:40.050568Z"
+ },
"scrolled": true
},
"outputs": [
@@ -356,10 +453,10 @@
"{'fields': [{'actor': 'Tom Hanks', 'movies': ['Forrest Gump', 'Green Mile']},\n",
" {'actor': 'Mads Mikkelsen', 'movies': ['Hannibal', 'Another round']}],\n",
" 'preferences': {'minimum_length': 200, 'style': 'gossip'},\n",
- " 'text': 'Did you know that Tom Hanks, the beloved Hollywood actor known for his roles in \"Forrest Gump\" and \"Green Mile\", has shared the screen with the talented Mads Mikkelsen, who gained international acclaim for his performances in \"Hannibal\" and \"Another round\"? These two incredible actors have brought their exceptional skills and captivating charisma to the big screen, delivering unforgettable performances that have enthralled audiences around the world. Whether it\\'s Hanks\\' endearing portrayal of Forrest Gump or Mikkelsen\\'s chilling depiction of Hannibal Lecter, these movies have solidified their places in cinematic history, leaving a lasting impact on viewers and cementing their status as true icons of the silver screen.'}"
+ " 'text': 'Tom Hanks, known for his iconic roles in movies such as \"Forrest Gump\" and \"Green Mile\", has captivated audiences with his emotional depth and versatility, while Mads Mikkelsen, the charismatic star of \"Hannibal\" and \"Another round\", has garnered critical acclaim for his intense and captivating performances on screen.'}"
]
},
- "execution_count": 9,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -394,9 +491,16 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 13,
"id": "94e98bc4",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:40.055542Z",
+ "iopub.status.busy": "2024-09-11T23:57:40.055177Z",
+ "iopub.status.idle": "2024-09-11T23:57:41.887759Z",
+ "shell.execute_reply": "2024-09-11T23:57:41.887093Z"
+ }
+ },
"outputs": [],
"source": [
"inp = [\n",
@@ -428,9 +532,16 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 14,
"id": "478eaca4",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:41.893613Z",
+ "iopub.status.busy": "2024-09-11T23:57:41.893141Z",
+ "iopub.status.idle": "2024-09-11T23:57:41.906525Z",
+ "shell.execute_reply": "2024-09-11T23:57:41.902242Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -442,7 +553,7 @@
" 'Toy Story',\n",
" 'Catch Me If You Can']},\n",
" 'preferences': {'style': 'informal', 'minimal length': 500},\n",
- " 'text': 'Tom Hanks, the versatile and charismatic actor, has graced the silver screen in numerous iconic films including the heartwarming and inspirational \"Forrest Gump,\" the intense and gripping war drama \"Saving Private Ryan,\" the emotionally charged and thought-provoking \"The Green Mile,\" the beloved animated classic \"Toy Story,\" and the thrilling and captivating true story adaptation \"Catch Me If You Can.\" With his impressive range and genuine talent, Hanks continues to captivate audiences worldwide, leaving an indelible mark on the world of cinema.'},\n",
+ " 'text': 'Tom Hanks, known for his iconic roles in films such as \"Forrest Gump\", \"Saving Private Ryan\", \"The Green Mile\", \"Toy Story\", and \"Catch Me If You Can\", has captivated audiences worldwide with his versatility and charm on the big screen.'},\n",
" {'fields': {'Actor': 'Tom Hardy',\n",
" 'Film': ['Inception',\n",
" 'The Dark Knight Rises',\n",
@@ -450,10 +561,10 @@
" 'The Revenant',\n",
" 'Dunkirk']},\n",
" 'preferences': {'style': 'informal', 'minimal length': 500},\n",
- " 'text': 'Tom Hardy, the versatile actor known for his intense performances, has graced the silver screen in numerous iconic films, including \"Inception,\" \"The Dark Knight Rises,\" \"Mad Max: Fury Road,\" \"The Revenant,\" and \"Dunkirk.\" Whether he\\'s delving into the depths of the subconscious mind, donning the mask of the infamous Bane, or navigating the treacherous wasteland as the enigmatic Max Rockatansky, Hardy\\'s commitment to his craft is always evident. From his breathtaking portrayal of the ruthless Eames in \"Inception\" to his captivating transformation into the ferocious Max in \"Mad Max: Fury Road,\" Hardy\\'s dynamic range and magnetic presence captivate audiences and leave an indelible mark on the world of cinema. In his most physically demanding role to date, he endured the harsh conditions of the freezing wilderness as he portrayed the rugged frontiersman John Fitzgerald in \"The Revenant,\" earning him critical acclaim and an Academy Award nomination. In Christopher Nolan\\'s war epic \"Dunkirk,\" Hardy\\'s stoic and heroic portrayal of Royal Air Force pilot Farrier showcases his ability to convey deep emotion through nuanced performances. With his chameleon-like ability to inhabit a wide range of characters and his unwavering commitment to his craft, Tom Hardy has undoubtedly solidified his place as one of the most talented and sought-after actors of his generation.'}]"
+ " 'text': 'Tom Hardy, known for his roles in films such as \"Inception,\" \"The Dark Knight Rises,\" \"Mad Max: Fury Road,\" \"The Revenant,\" and \"Dunkirk,\" has captivated audiences worldwide with his intense performances and undeniable talent on the big screen.'}]"
]
},
- "execution_count": 11,
+ "execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -473,9 +584,16 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 15,
"id": "03c6a375",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:41.911680Z",
+ "iopub.status.busy": "2024-09-11T23:57:41.911247Z",
+ "iopub.status.idle": "2024-09-11T23:57:41.917632Z",
+ "shell.execute_reply": "2024-09-11T23:57:41.916154Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import List\n",
@@ -489,9 +607,16 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 16,
"id": "9461d225",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:41.922453Z",
+ "iopub.status.busy": "2024-09-11T23:57:41.922180Z",
+ "iopub.status.idle": "2024-09-11T23:57:41.927976Z",
+ "shell.execute_reply": "2024-09-11T23:57:41.926855Z"
+ }
+ },
"outputs": [],
"source": [
"class Actor(BaseModel):\n",
@@ -509,17 +634,32 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 17,
"id": "8a5528d2",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:41.930929Z",
+ "iopub.status.busy": "2024-09-11T23:57:41.930613Z",
+ "iopub.status.idle": "2024-09-11T23:57:42.982165Z",
+ "shell.execute_reply": "2024-09-11T23:57:42.981556Z"
+ }
+ },
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/4j/2rz3865x6qg07tx43146py8h0000gn/T/ipykernel_60345/1937598790.py:11: LangChainDeprecationWarning: The method `BaseLLM.__call__` was deprecated in langchain-core 0.1.7 and will be removed in 1.0. Use invoke instead.\n",
+ " output = llm(_input.to_string())\n"
+ ]
+ },
{
"data": {
"text/plain": [
"Actor(Actor='Tom Hanks', Film=['Forrest Gump', 'Saving Private Ryan', 'The Green Mile', 'Toy Story', 'Catch Me If You Can'])"
]
},
- "execution_count": 14,
+ "execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
@@ -543,9 +683,16 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 18,
"id": "926a7eed",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:42.986158Z",
+ "iopub.status.busy": "2024-09-11T23:57:42.985871Z",
+ "iopub.status.idle": "2024-09-11T23:57:42.994408Z",
+ "shell.execute_reply": "2024-09-11T23:57:42.993390Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -553,7 +700,7 @@
"True"
]
},
- "execution_count": 15,
+ "execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@@ -572,17 +719,34 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 19,
"id": "523bb584",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:42.997570Z",
+ "iopub.status.busy": "2024-09-11T23:57:42.997367Z",
+ "iopub.status.idle": "2024-09-11T23:57:43.757567Z",
+ "shell.execute_reply": "2024-09-11T23:57:43.756930Z"
+ }
+ },
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/4j/2rz3865x6qg07tx43146py8h0000gn/T/ipykernel_60345/4290255188.py:1: LangChainDeprecationWarning: LangChain has introduced a method called `with_structured_output` thatis available on ChatModels capable of tool calling.You can read more about the method here: . Please follow our extraction use case documentation for more guidelineson how to do information extraction with LLMs.. If you notice other issues, please provide feedback here:\n",
+ " extractor = create_extraction_chain_pydantic(pydantic_schema=Actor, llm=model)\n",
+ "/var/folders/4j/2rz3865x6qg07tx43146py8h0000gn/T/ipykernel_60345/4290255188.py:2: LangChainDeprecationWarning: The method `Chain.run` was deprecated in langchain 0.1.0 and will be removed in 1.0. Use invoke instead.\n",
+ " extracted = extractor.run(dataset[1][\"text\"])\n"
+ ]
+ },
{
"data": {
"text/plain": [
"[Actor(Actor='Tom Hardy', Film=['Inception', 'The Dark Knight Rises', 'Mad Max: Fury Road', 'The Revenant', 'Dunkirk'])]"
]
},
- "execution_count": 16,
+ "execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
@@ -595,9 +759,16 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 20,
"id": "f8451c2b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:43.760934Z",
+ "iopub.status.busy": "2024-09-11T23:57:43.760683Z",
+ "iopub.status.idle": "2024-09-11T23:57:43.765576Z",
+ "shell.execute_reply": "2024-09-11T23:57:43.765059Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -605,7 +776,7 @@
"True"
]
},
- "execution_count": 17,
+ "execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
@@ -639,7 +810,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/extraction.ipynb b/docs/docs/tutorials/extraction.ipynb
index f99034d358d..f3beecd5296 100644
--- a/docs/docs/tutorials/extraction.ipynb
+++ b/docs/docs/tutorials/extraction.ipynb
@@ -108,9 +108,16 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 1,
"id": "c141084c-fb94-4093-8d6a-81175d688e40",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:45.032457Z",
+ "iopub.status.busy": "2024-09-11T23:57:45.032143Z",
+ "iopub.status.idle": "2024-09-11T23:57:45.124021Z",
+ "shell.execute_reply": "2024-09-11T23:57:45.123671Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import Optional\n",
@@ -159,9 +166,16 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 2,
"id": "a5e490f6-35ad-455e-8ae4-2bae021583ff",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:45.126017Z",
+ "iopub.status.busy": "2024-09-11T23:57:45.125856Z",
+ "iopub.status.idle": "2024-09-11T23:57:45.409657Z",
+ "shell.execute_reply": "2024-09-11T23:57:45.409299Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import Optional\n",
@@ -202,19 +216,17 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 3,
"id": "04d846a6-d5cb-4009-ac19-61e3aac0177e",
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/Users/harrisonchase/workplace/langchain/libs/core/langchain_core/_api/beta_decorator.py:87: LangChainBetaWarning: The method `ChatMistralAI.with_structured_output` is in beta. It is actively being worked on, so the API may change.\n",
- " warn_beta(\n"
- ]
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:45.411307Z",
+ "iopub.status.busy": "2024-09-11T23:57:45.411226Z",
+ "iopub.status.idle": "2024-09-11T23:57:45.557156Z",
+ "shell.execute_reply": "2024-09-11T23:57:45.556804Z"
}
- ],
+ },
+ "outputs": [],
"source": [
"from langchain_mistralai import ChatMistralAI\n",
"\n",
@@ -233,17 +245,24 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 4,
"id": "13165ac8-a1dc-44ce-a6ed-f52b577473e4",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:45.558861Z",
+ "iopub.status.busy": "2024-09-11T23:57:45.558771Z",
+ "iopub.status.idle": "2024-09-11T23:57:47.759853Z",
+ "shell.execute_reply": "2024-09-11T23:57:47.759229Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "Person(name='Alan Smith', hair_color='blond', height_in_meters='1.83')"
+ "Person(name='Alan Smith', hair_color='blond', height_in_meters='1.8288')"
]
},
- "execution_count": 8,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -283,9 +302,16 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 5,
"id": "591a0c16-7a17-4883-91ee-0d6d2fdb265c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:47.764059Z",
+ "iopub.status.busy": "2024-09-11T23:57:47.763673Z",
+ "iopub.status.idle": "2024-09-11T23:57:47.777370Z",
+ "shell.execute_reply": "2024-09-11T23:57:47.776480Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import List, Optional\n",
@@ -332,17 +358,24 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 6,
"id": "cf7062cc-1d1d-4a37-9122-509d1b87f0a6",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:47.781013Z",
+ "iopub.status.busy": "2024-09-11T23:57:47.780516Z",
+ "iopub.status.idle": "2024-09-11T23:57:52.047501Z",
+ "shell.execute_reply": "2024-09-11T23:57:52.046956Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "Data(people=[Person(name='Jeff', hair_color=None, height_in_meters=None), Person(name='Anna', hair_color=None, height_in_meters=None)])"
+ "Data(people=[Person(name='Jeff', hair_color='black', height_in_meters='1.8288'), Person(name='Anna', hair_color='black', height_in_meters=None)])"
]
},
- "execution_count": 10,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -407,7 +440,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/graph.ipynb b/docs/docs/tutorials/graph.ipynb
index e5a3134c7ca..cd27382c815 100644
--- a/docs/docs/tutorials/graph.ipynb
+++ b/docs/docs/tutorials/graph.ipynb
@@ -41,9 +41,24 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 1,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:53.421468Z",
+ "iopub.status.busy": "2024-09-11T23:57:53.420592Z",
+ "iopub.status.idle": "2024-09-11T23:57:55.224356Z",
+ "shell.execute_reply": "2024-09-11T23:57:55.223589Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install --upgrade --quiet langchain langchain-community langchain-openai neo4j"
]
@@ -57,14 +72,26 @@
},
{
"cell_type": "code",
- "execution_count": 1,
- "metadata": {},
+ "execution_count": 2,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:55.227361Z",
+ "iopub.status.busy": "2024-09-11T23:57:55.227156Z",
+ "iopub.status.idle": "2024-09-11T23:57:55.359909Z",
+ "shell.execute_reply": "2024-09-11T23:57:55.359651Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- " ········\n"
+ "ename": "StdinNotImplementedError",
+ "evalue": "getpass was called, but this frontend does not support input requests.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mStdinNotImplementedError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[2], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgetpass\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOPENAI_API_KEY\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mgetpass\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetpass\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# Uncomment the below to use LangSmith. Not required.\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass()\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;66;03m# os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/ipykernel/kernelbase.py:1256\u001b[0m, in \u001b[0;36mKernel.getpass\u001b[0;34m(self, prompt, stream)\u001b[0m\n\u001b[1;32m 1254\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_allow_stdin:\n\u001b[1;32m 1255\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgetpass was called, but this frontend does not support input requests.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 1256\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m StdinNotImplementedError(msg)\n\u001b[1;32m 1257\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m stream \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mwarnings\u001b[39;00m\n",
+ "\u001b[0;31mStdinNotImplementedError\u001b[0m: getpass was called, but this frontend does not support input requests."
]
}
],
@@ -89,8 +116,15 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {},
+ "execution_count": 3,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:55.361597Z",
+ "iopub.status.busy": "2024-09-11T23:57:55.361505Z",
+ "iopub.status.idle": "2024-09-11T23:57:55.363319Z",
+ "shell.execute_reply": "2024-09-11T23:57:55.363066Z"
+ }
+ },
"outputs": [],
"source": [
"os.environ[\"NEO4J_URI\"] = \"bolt://localhost:7687\"\n",
@@ -107,18 +141,51 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {},
+ "execution_count": 4,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:55.364707Z",
+ "iopub.status.busy": "2024-09-11T23:57:55.364612Z",
+ "iopub.status.idle": "2024-09-11T23:57:56.315114Z",
+ "shell.execute_reply": "2024-09-11T23:57:56.314786Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "[]"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "ValueError",
+ "evalue": "Could not connect to Neo4j database. Please ensure that the url is correct",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mConnectionRefusedError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py:528\u001b[0m, in \u001b[0;36mBoltSocket._connect\u001b[0;34m(cls, resolved_address, timeout, keep_alive)\u001b[0m\n\u001b[1;32m 527\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m[#0000] C: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, resolved_address)\n\u001b[0;32m--> 528\u001b[0m \u001b[43ms\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresolved_address\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 529\u001b[0m s\u001b[38;5;241m.\u001b[39msettimeout(t)\n",
+ "\u001b[0;31mConnectionRefusedError\u001b[0m: [Errno 61] Connection refused",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mServiceUnavailable\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py:690\u001b[0m, in \u001b[0;36mBoltSocket.connect\u001b[0;34m(cls, address, tcp_timeout, deadline, custom_resolver, ssl_context, keep_alive)\u001b[0m\n\u001b[1;32m 689\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 690\u001b[0m s \u001b[38;5;241m=\u001b[39m \u001b[43mBoltSocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresolved_address\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtcp_timeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 691\u001b[0m \u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 692\u001b[0m s \u001b[38;5;241m=\u001b[39m BoltSocket\u001b[38;5;241m.\u001b[39m_secure(s, resolved_address\u001b[38;5;241m.\u001b[39m_host_name,\n\u001b[1;32m 693\u001b[0m ssl_context)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py:546\u001b[0m, in \u001b[0;36mBoltSocket._connect\u001b[0;34m(cls, resolved_address, timeout, keep_alive)\u001b[0m\n\u001b[1;32m 545\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(error, \u001b[38;5;167;01mOSError\u001b[39;00m):\n\u001b[0;32m--> 546\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ServiceUnavailable(\n\u001b[1;32m 547\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFailed to establish connection to \u001b[39m\u001b[38;5;132;01m{!r}\u001b[39;00m\u001b[38;5;124m (reason \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 548\u001b[0m \u001b[38;5;241m.\u001b[39mformat(resolved_address, error)\n\u001b[1;32m 549\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merror\u001b[39;00m\n\u001b[1;32m 550\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n",
+ "\u001b[0;31mServiceUnavailable\u001b[0m: Failed to establish connection to ResolvedIPv6Address(('::1', 7687, 0, 0)) (reason [Errno 61] Connection refused)",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mServiceUnavailable\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/graphs/neo4j_graph.py:379\u001b[0m, in \u001b[0;36mNeo4jGraph.__init__\u001b[0;34m(self, url, username, password, database, timeout, sanitize, refresh_schema, driver_config, enhanced_schema)\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 379\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_driver\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mverify_connectivity\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 380\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m neo4j\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mServiceUnavailable:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/driver.py:1067\u001b[0m, in \u001b[0;36mDriver.verify_connectivity\u001b[0;34m(self, **config)\u001b[0m\n\u001b[1;32m 1066\u001b[0m session_config \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_session_config(config)\n\u001b[0;32m-> 1067\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_server_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43msession_config\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/driver.py:1281\u001b[0m, in \u001b[0;36mDriver._get_server_info\u001b[0;34m(self, session_config)\u001b[0m\n\u001b[1;32m 1280\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_session(session_config) \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[0;32m-> 1281\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_server_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/work/session.py:172\u001b[0m, in \u001b[0;36mSession._get_server_info\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 171\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\n\u001b[0;32m--> 172\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mREAD_ACCESS\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mliveness_check_timeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 173\u001b[0m server_info \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mserver_info\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/work/session.py:130\u001b[0m, in \u001b[0;36mSession._connect\u001b[0;34m(self, access_mode, **acquire_kwargs)\u001b[0m\n\u001b[1;32m 129\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 130\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 131\u001b[0m \u001b[43m \u001b[49m\u001b[43maccess_mode\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43macquire_kwargs\u001b[49m\n\u001b[1;32m 132\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 133\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mCancelledError:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/work/workspace.py:182\u001b[0m, in \u001b[0;36mWorkspace._connect\u001b[0;34m(self, access_mode, auth, **acquire_kwargs)\u001b[0m\n\u001b[1;32m 181\u001b[0m acquire_kwargs_\u001b[38;5;241m.\u001b[39mupdate(acquire_kwargs)\n\u001b[0;32m--> 182\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43macquire\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43macquire_kwargs_\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection_access_mode \u001b[38;5;241m=\u001b[39m access_mode\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py:526\u001b[0m, in \u001b[0;36mBoltPool.acquire\u001b[0;34m(self, access_mode, timeout, database, bookmarks, auth, liveness_check_timeout)\u001b[0m\n\u001b[1;32m 525\u001b[0m deadline \u001b[38;5;241m=\u001b[39m Deadline\u001b[38;5;241m.\u001b[39mfrom_timeout_or_deadline(timeout)\n\u001b[0;32m--> 526\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_acquire\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 527\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdeadline\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mliveness_check_timeout\u001b[49m\n\u001b[1;32m 528\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py:313\u001b[0m, in \u001b[0;36mIOPool._acquire\u001b[0;34m(self, address, auth, deadline, liveness_check_timeout)\u001b[0m\n\u001b[1;32m 312\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m[#0000] _: trying to hand out new connection\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 313\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mconnection_creator\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py:163\u001b[0m, in \u001b[0;36mIOPool._acquire_new_later..connection_creator\u001b[0;34m()\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 163\u001b[0m connection \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopener\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 164\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdeadline\u001b[49m\n\u001b[1;32m 165\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 166\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ServiceUnavailable:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/io/_pool.py:500\u001b[0m, in \u001b[0;36mBoltPool.open..opener\u001b[0;34m(addr, auth_manager, deadline)\u001b[0m\n\u001b[1;32m 499\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mopener\u001b[39m(addr, auth_manager, deadline):\n\u001b[0;32m--> 500\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mBolt\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 501\u001b[0m \u001b[43m \u001b[49m\u001b[43maddr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauth_manager\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth_manager\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdeadline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdeadline\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 502\u001b[0m \u001b[43m \u001b[49m\u001b[43mrouting_context\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpool_config\u001b[49m\n\u001b[1;32m 503\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_sync/io/_bolt.py:405\u001b[0m, in \u001b[0;36mBolt.open\u001b[0;34m(cls, address, auth_manager, deadline, routing_context, pool_config)\u001b[0m\n\u001b[1;32m 402\u001b[0m deadline \u001b[38;5;241m=\u001b[39m Deadline(\u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 404\u001b[0m s, protocol_version, handshake, data \u001b[38;5;241m=\u001b[39m \\\n\u001b[0;32m--> 405\u001b[0m \u001b[43mBoltSocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 406\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 407\u001b[0m \u001b[43m \u001b[49m\u001b[43mtcp_timeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnection_timeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 408\u001b[0m \u001b[43m \u001b[49m\u001b[43mdeadline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdeadline\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 409\u001b[0m \u001b[43m \u001b[49m\u001b[43mcustom_resolver\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresolver\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 410\u001b[0m \u001b[43m \u001b[49m\u001b[43mssl_context\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_ssl_context\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 411\u001b[0m \u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpool_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkeep_alive\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 412\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 414\u001b[0m pool_config\u001b[38;5;241m.\u001b[39mprotocol_version \u001b[38;5;241m=\u001b[39m protocol_version\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/neo4j/_async_compat/network/_bolt_socket.py:718\u001b[0m, in \u001b[0;36mBoltSocket.connect\u001b[0;34m(cls, address, tcp_timeout, deadline, custom_resolver, ssl_context, keep_alive)\u001b[0m\n\u001b[1;32m 717\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 718\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ServiceUnavailable(\n\u001b[1;32m 719\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCouldn\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt connect to \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m (resolved to \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m):\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m (\n\u001b[1;32m 720\u001b[0m \u001b[38;5;28mstr\u001b[39m(address), \u001b[38;5;28mtuple\u001b[39m(\u001b[38;5;28mmap\u001b[39m(\u001b[38;5;28mstr\u001b[39m, resolved_addresses)),\n\u001b[1;32m 721\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[38;5;28mmap\u001b[39m(\u001b[38;5;28mstr\u001b[39m, errors))\n\u001b[1;32m 722\u001b[0m )\n\u001b[1;32m 723\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merrors\u001b[39;00m[\u001b[38;5;241m0\u001b[39m]\n",
+ "\u001b[0;31mServiceUnavailable\u001b[0m: Couldn't connect to localhost:7687 (resolved to ()):\nFailed to establish connection to ResolvedIPv6Address(('::1', 7687, 0, 0)) (reason [Errno 61] Connection refused)\nFailed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 61] Connection refused)",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[4], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_community\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgraphs\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Neo4jGraph\n\u001b[0;32m----> 3\u001b[0m graph \u001b[38;5;241m=\u001b[39m \u001b[43mNeo4jGraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Import movie information\u001b[39;00m\n\u001b[1;32m 7\u001b[0m movies_query \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;124mLOAD CSV WITH HEADERS FROM \u001b[39m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://raw.githubusercontent.com/tomasonjo/blog-datasets/main/movies/movies_small.csv\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;124m MERGE (m)-[:IN_GENRE]->(g))\u001b[39m\n\u001b[1;32m 24\u001b[0m \u001b[38;5;124m\"\"\"\u001b[39m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/graphs/neo4j_graph.py:381\u001b[0m, in \u001b[0;36mNeo4jGraph.__init__\u001b[0;34m(self, url, username, password, database, timeout, sanitize, refresh_schema, driver_config, enhanced_schema)\u001b[0m\n\u001b[1;32m 379\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_driver\u001b[38;5;241m.\u001b[39mverify_connectivity()\n\u001b[1;32m 380\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m neo4j\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mServiceUnavailable:\n\u001b[0;32m--> 381\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 382\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not connect to Neo4j database. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 383\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPlease ensure that the url is correct\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 384\u001b[0m )\n\u001b[1;32m 385\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m neo4j\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mAuthError:\n\u001b[1;32m 386\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 387\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not connect to Neo4j database. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 388\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPlease ensure that the username and password are correct\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 389\u001b[0m )\n",
+ "\u001b[0;31mValueError\u001b[0m: Could not connect to Neo4j database. Please ensure that the url is correct"
+ ]
}
],
"source": [
@@ -161,19 +228,25 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "metadata": {},
+ "execution_count": 5,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:56.316701Z",
+ "iopub.status.busy": "2024-09-11T23:57:56.316604Z",
+ "iopub.status.idle": "2024-09-11T23:57:56.322891Z",
+ "shell.execute_reply": "2024-09-11T23:57:56.322627Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Node properties are the following:\n",
- "Movie {imdbRating: FLOAT, id: STRING, released: DATE, title: STRING},Person {name: STRING},Genre {name: STRING},Chunk {id: STRING, question: STRING, query: STRING, text: STRING, embedding: LIST}\n",
- "Relationship properties are the following:\n",
- "\n",
- "The relationships are the following:\n",
- "(:Movie)-[:IN_GENRE]->(:Genre),(:Person)-[:DIRECTED]->(:Movie),(:Person)-[:ACTED_IN]->(:Movie)\n"
+ "ename": "NameError",
+ "evalue": "name 'graph' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mgraph\u001b[49m\u001b[38;5;241m.\u001b[39mrefresh_schema()\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(graph\u001b[38;5;241m.\u001b[39mschema)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'graph' is not defined"
]
}
],
@@ -200,35 +273,26 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "metadata": {},
+ "execution_count": 6,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:56.324172Z",
+ "iopub.status.busy": "2024-09-11T23:57:56.324102Z",
+ "iopub.status.idle": "2024-09-11T23:57:56.641305Z",
+ "shell.execute_reply": "2024-09-11T23:57:56.641053Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
- "Generated Cypher:\n",
- "\u001b[32;1m\u001b[1;3mMATCH (:Movie {title: \"Casino\"})<-[:ACTED_IN]-(actor:Person)\n",
- "RETURN actor.name\u001b[0m\n",
- "Full Context:\n",
- "\u001b[32;1m\u001b[1;3m[{'actor.name': 'Joe Pesci'}, {'actor.name': 'Robert De Niro'}, {'actor.name': 'Sharon Stone'}, {'actor.name': 'James Woods'}]\u001b[0m\n",
- "\n",
- "\u001b[1m> Finished chain.\u001b[0m\n"
+ "ename": "NameError",
+ "evalue": "name 'graph' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ChatOpenAI\n\u001b[1;32m 4\u001b[0m llm \u001b[38;5;241m=\u001b[39m ChatOpenAI(model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgpt-3.5-turbo\u001b[39m\u001b[38;5;124m\"\u001b[39m, temperature\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m)\n\u001b[0;32m----> 5\u001b[0m chain \u001b[38;5;241m=\u001b[39m GraphCypherQAChain\u001b[38;5;241m.\u001b[39mfrom_llm(graph\u001b[38;5;241m=\u001b[39m\u001b[43mgraph\u001b[49m, llm\u001b[38;5;241m=\u001b[39mllm, verbose\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 6\u001b[0m response \u001b[38;5;241m=\u001b[39m chain\u001b[38;5;241m.\u001b[39minvoke({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mquery\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat was the cast of the Casino?\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n\u001b[1;32m 7\u001b[0m response\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'graph' is not defined"
]
- },
- {
- "data": {
- "text/plain": [
- "{'query': 'What was the cast of the Casino?',\n",
- " 'result': 'The cast of Casino included Joe Pesci, Robert De Niro, Sharon Stone, and James Woods.'}"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
}
],
"source": [
@@ -252,35 +316,26 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "metadata": {},
+ "execution_count": 7,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:56.642778Z",
+ "iopub.status.busy": "2024-09-11T23:57:56.642680Z",
+ "iopub.status.idle": "2024-09-11T23:57:56.649774Z",
+ "shell.execute_reply": "2024-09-11T23:57:56.649528Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
- "Generated Cypher:\n",
- "\u001b[32;1m\u001b[1;3mMATCH (:Movie {title: \"Casino\"})<-[:ACTED_IN]-(actor:Person)\n",
- "RETURN actor.name\u001b[0m\n",
- "Full Context:\n",
- "\u001b[32;1m\u001b[1;3m[{'actor.name': 'Joe Pesci'}, {'actor.name': 'Robert De Niro'}, {'actor.name': 'Sharon Stone'}, {'actor.name': 'James Woods'}]\u001b[0m\n",
- "\n",
- "\u001b[1m> Finished chain.\u001b[0m\n"
+ "ename": "NameError",
+ "evalue": "name 'graph' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[7], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m chain \u001b[38;5;241m=\u001b[39m GraphCypherQAChain\u001b[38;5;241m.\u001b[39mfrom_llm(\n\u001b[0;32m----> 2\u001b[0m graph\u001b[38;5;241m=\u001b[39m\u001b[43mgraph\u001b[49m, llm\u001b[38;5;241m=\u001b[39mllm, verbose\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, validate_cypher\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 3\u001b[0m )\n\u001b[1;32m 4\u001b[0m response \u001b[38;5;241m=\u001b[39m chain\u001b[38;5;241m.\u001b[39minvoke({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mquery\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat was the cast of the Casino?\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n\u001b[1;32m 5\u001b[0m response\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'graph' is not defined"
]
- },
- {
- "data": {
- "text/plain": [
- "{'query': 'What was the cast of the Casino?',\n",
- " 'result': 'The cast of Casino included Joe Pesci, Robert De Niro, Sharon Stone, and James Woods.'}"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
}
],
"source": [
@@ -329,7 +384,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/llm_chain.ipynb b/docs/docs/tutorials/llm_chain.ipynb
index ef6c92e6561..23fae60ecdf 100644
--- a/docs/docs/tutorials/llm_chain.ipynb
+++ b/docs/docs/tutorials/llm_chain.ipynb
@@ -108,7 +108,14 @@
"cell_type": "code",
"execution_count": 1,
"id": "e4b41234",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:57.851066Z",
+ "iopub.status.busy": "2024-09-11T23:57:57.850818Z",
+ "iopub.status.idle": "2024-09-11T23:57:58.411740Z",
+ "shell.execute_reply": "2024-09-11T23:57:58.411456Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -129,17 +136,24 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 2,
"id": "1b2481f0",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:58.413429Z",
+ "iopub.status.busy": "2024-09-11T23:57:58.413322Z",
+ "iopub.status.idle": "2024-09-11T23:57:59.200228Z",
+ "shell.execute_reply": "2024-09-11T23:57:59.199854Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "AIMessage(content='ciao!', response_metadata={'token_usage': {'completion_tokens': 3, 'prompt_tokens': 20, 'total_tokens': 23}, 'model_name': 'gpt-4', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-fc5d7c88-9615-48ab-a3c7-425232b562c5-0')"
+ "AIMessage(content='Ciao!', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 3, 'prompt_tokens': 20, 'total_tokens': 23}, 'model_name': 'gpt-4-0613', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-89171739-061c-4acf-8615-5d93972b3a44-0', usage_metadata={'input_tokens': 20, 'output_tokens': 3, 'total_tokens': 23})"
]
},
- "execution_count": 16,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -159,7 +173,9 @@
"cell_type": "markdown",
"id": "f83373db",
"metadata": {},
- "source": "If we've enabled LangSmith, we can see that this run is logged to LangSmith, and can see the [LangSmith trace](https://smith.langchain.com/public/88baa0b2-7c1a-4d09-ba30-a47985dde2ea/r)"
+ "source": [
+ "If we've enabled LangSmith, we can see that this run is logged to LangSmith, and can see the [LangSmith trace](https://smith.langchain.com/public/88baa0b2-7c1a-4d09-ba30-a47985dde2ea/r)"
+ ]
},
{
"cell_type": "markdown",
@@ -175,9 +191,16 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 3,
"id": "d7ae9c58",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:59.202336Z",
+ "iopub.status.busy": "2024-09-11T23:57:59.202018Z",
+ "iopub.status.idle": "2024-09-11T23:57:59.204640Z",
+ "shell.execute_reply": "2024-09-11T23:57:59.204283Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.output_parsers import StrOutputParser\n",
@@ -195,9 +218,16 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 4,
"id": "6bacb837",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:57:59.206583Z",
+ "iopub.status.busy": "2024-09-11T23:57:59.206451Z",
+ "iopub.status.idle": "2024-09-11T23:58:00.106043Z",
+ "shell.execute_reply": "2024-09-11T23:58:00.105333Z"
+ }
+ },
"outputs": [],
"source": [
"result = model.invoke(messages)"
@@ -205,17 +235,24 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 5,
"id": "efb8da87",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:00.111086Z",
+ "iopub.status.busy": "2024-09-11T23:58:00.110701Z",
+ "iopub.status.idle": "2024-09-11T23:58:00.134213Z",
+ "shell.execute_reply": "2024-09-11T23:58:00.133823Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Ciao!'"
+ "'ciao!'"
]
},
- "execution_count": 19,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -236,9 +273,16 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 6,
"id": "9449cfa6",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:00.136135Z",
+ "iopub.status.busy": "2024-09-11T23:58:00.135917Z",
+ "iopub.status.idle": "2024-09-11T23:58:00.138276Z",
+ "shell.execute_reply": "2024-09-11T23:58:00.137951Z"
+ }
+ },
"outputs": [],
"source": [
"chain = model | parser"
@@ -246,9 +290,16 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 7,
"id": "3e82f933",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:00.139901Z",
+ "iopub.status.busy": "2024-09-11T23:58:00.139775Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.411069Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.410535Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -256,7 +307,7 @@
"'Ciao!'"
]
},
- "execution_count": 21,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -292,9 +343,16 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 8,
"id": "3e73cc20",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.414591Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.414140Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.417537Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.417026Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.prompts import ChatPromptTemplate"
@@ -310,9 +368,16 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 9,
"id": "fd75ecde",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.422202Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.421945Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.425647Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.425286Z"
+ }
+ },
"outputs": [],
"source": [
"system_template = \"Translate the following into {language}:\""
@@ -328,9 +393,16 @@
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": 10,
"id": "88e566f3",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.427744Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.427543Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.430568Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.430162Z"
+ }
+ },
"outputs": [],
"source": [
"prompt_template = ChatPromptTemplate.from_messages(\n",
@@ -348,17 +420,24 @@
},
{
"cell_type": "code",
- "execution_count": 27,
+ "execution_count": 11,
"id": "f781b3cb",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.432620Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.432429Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.445445Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.445009Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "ChatPromptValue(messages=[SystemMessage(content='Translate the following into italian:'), HumanMessage(content='hi')])"
+ "ChatPromptValue(messages=[SystemMessage(content='Translate the following into italian:', additional_kwargs={}, response_metadata={}), HumanMessage(content='hi', additional_kwargs={}, response_metadata={})])"
]
},
- "execution_count": 27,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -379,18 +458,25 @@
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": 12,
"id": "2159b619",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.447548Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.447405Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.450230Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.449796Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[SystemMessage(content='Translate the following into italian:'),\n",
- " HumanMessage(content='hi')]"
+ "[SystemMessage(content='Translate the following into italian:', additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='hi', additional_kwargs={}, response_metadata={})]"
]
},
- "execution_count": 28,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -411,9 +497,16 @@
},
{
"cell_type": "code",
- "execution_count": 29,
+ "execution_count": 13,
"id": "6c6beb4b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.452051Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.451907Z",
+ "iopub.status.idle": "2024-09-11T23:58:01.454011Z",
+ "shell.execute_reply": "2024-09-11T23:58:01.453767Z"
+ }
+ },
"outputs": [],
"source": [
"chain = prompt_template | model | parser"
@@ -421,9 +514,16 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 14,
"id": "3e45595a",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:01.455428Z",
+ "iopub.status.busy": "2024-09-11T23:58:01.455344Z",
+ "iopub.status.idle": "2024-09-11T23:58:02.026582Z",
+ "shell.execute_reply": "2024-09-11T23:58:02.026024Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -431,7 +531,7 @@
"'ciao'"
]
},
- "execution_count": 30,
+ "execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -539,19 +639,45 @@
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 15,
"id": "85174643",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:02.035601Z",
+ "iopub.status.busy": "2024-09-11T23:58:02.035129Z",
+ "iopub.status.idle": "2024-09-11T23:58:02.703074Z",
+ "shell.execute_reply": "2024-09-11T23:58:02.702732Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "'Ciao'"
- ]
- },
- "execution_count": 31,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "RuntimeError",
+ "evalue": "no validator found for , see `arbitrary_types_allowed` in Config",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[15], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RemoteRunnable\n\u001b[1;32m 3\u001b[0m remote_chain \u001b[38;5;241m=\u001b[39m RemoteRunnable(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttp://localhost:8000/chain/\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 4\u001b[0m remote_chain\u001b[38;5;241m.\u001b[39minvoke({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlanguage\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mitalian\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhi\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langserve/__init__.py:7\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;124;03m\"\"\"Main entrypoint into package.\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \n\u001b[1;32m 3\u001b[0m \u001b[38;5;124;03mThis is the ONLY public interface into the package. All other modules are\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;124;03mto be considered private and subject to change without notice.\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mapi_handler\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m APIHandler\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mclient\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RemoteRunnable\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mschema\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CustomUserType\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langserve/api_handler.py:62\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpydantic_v1\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m BaseModel, Field, ValidationError, create_model\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mschema\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 52\u001b[0m BatchResponseMetadata,\n\u001b[1;32m 53\u001b[0m CustomUserType,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 60\u001b[0m PublicTraceLinkCreateRequest,\n\u001b[1;32m 61\u001b[0m )\n\u001b[0;32m---> 62\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mserialization\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m WellKnownLCSerializer\n\u001b[1;32m 63\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvalidation\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 64\u001b[0m BatchBaseResponse,\n\u001b[1;32m 65\u001b[0m BatchRequestShallowValidator,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 76\u001b[0m create_stream_request_model,\n\u001b[1;32m 77\u001b[0m )\n\u001b[1;32m 78\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mversion\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m __version__\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langserve/serialization.py:43\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_core\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprompts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbase\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m StringPromptValue\n\u001b[1;32m 42\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpydantic_v1\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m BaseModel, ValidationError\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangserve\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvalidation\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CallbackEvent\n\u001b[1;32m 45\u001b[0m logger \u001b[38;5;241m=\u001b[39m logging\u001b[38;5;241m.\u001b[39mgetLogger(\u001b[38;5;18m__name__\u001b[39m)\n\u001b[1;32m 48\u001b[0m \u001b[38;5;129m@lru_cache\u001b[39m(maxsize\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1_000\u001b[39m) \u001b[38;5;66;03m# Will accommodate up to 1_000 different error messages\u001b[39;00m\n\u001b[1;32m 49\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_log_error_message_once\u001b[39m(error_message: \u001b[38;5;28mstr\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langserve/validation.py:482\u001b[0m\n\u001b[1;32m 478\u001b[0m kwargs: Any \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 479\u001b[0m \u001b[38;5;28mtype\u001b[39m: Literal[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mon_tool_error\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mon_tool_error\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 482\u001b[0m \u001b[38;5;28;43;01mclass\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;21;43;01mOnChatModelStart\u001b[39;49;00m\u001b[43m(\u001b[49m\u001b[43mBaseModel\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 483\u001b[0m \u001b[38;5;250;43m \u001b[39;49m\u001b[38;5;124;43;03m\"\"\"On Chat Model Start Callback Event.\"\"\"\u001b[39;49;00m\n\u001b[1;32m 485\u001b[0m \u001b[43m \u001b[49m\u001b[43mserialized\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mAny\u001b[49m\u001b[43m]\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/main.py:197\u001b[0m, in \u001b[0;36mModelMetaclass.__new__\u001b[0;34m(mcs, name, bases, namespace, **kwargs)\u001b[0m\n\u001b[1;32m 189\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 190\u001b[0m is_untouched(value)\n\u001b[1;32m 191\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m ann_type \u001b[38;5;241m!=\u001b[39m PyObject\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 194\u001b[0m )\n\u001b[1;32m 195\u001b[0m ):\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[0;32m--> 197\u001b[0m fields[ann_name] \u001b[38;5;241m=\u001b[39m \u001b[43mModelField\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mann_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43mannotation\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mann_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43mclass_validators\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_validators\u001b[49m\u001b[43m(\u001b[49m\u001b[43mann_name\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m ann_name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m namespace \u001b[38;5;129;01mand\u001b[39;00m config\u001b[38;5;241m.\u001b[39munderscore_attrs_are_private:\n\u001b[1;32m 205\u001b[0m private_attributes[ann_name] \u001b[38;5;241m=\u001b[39m PrivateAttr()\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:504\u001b[0m, in \u001b[0;36mModelField.infer\u001b[0;34m(cls, name, value, annotation, class_validators, config)\u001b[0m\n\u001b[1;32m 501\u001b[0m required \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 502\u001b[0m annotation \u001b[38;5;241m=\u001b[39m get_annotation_from_field_info(annotation, field_info, name, config\u001b[38;5;241m.\u001b[39mvalidate_assignment)\n\u001b[0;32m--> 504\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 505\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 506\u001b[0m \u001b[43m \u001b[49m\u001b[43mtype_\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mannotation\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 507\u001b[0m \u001b[43m \u001b[49m\u001b[43malias\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfield_info\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43malias\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 508\u001b[0m \u001b[43m \u001b[49m\u001b[43mclass_validators\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclass_validators\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefault\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 510\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefault_factory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfield_info\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault_factory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 511\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequired\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequired\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43mfield_info\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfield_info\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 514\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:434\u001b[0m, in \u001b[0;36mModelField.__init__\u001b[0;34m(self, name, type_, class_validators, model_config, default, default_factory, required, final, alias, field_info)\u001b[0m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape: \u001b[38;5;28mint\u001b[39m \u001b[38;5;241m=\u001b[39m SHAPE_SINGLETON\n\u001b[1;32m 433\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config\u001b[38;5;241m.\u001b[39mprepare_field(\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m--> 434\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprepare\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:550\u001b[0m, in \u001b[0;36mModelField.prepare\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 545\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m ForwardRef \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m DeferredType:\n\u001b[1;32m 546\u001b[0m \u001b[38;5;66;03m# self.type_ is currently a ForwardRef and there's nothing we can do now,\u001b[39;00m\n\u001b[1;32m 547\u001b[0m \u001b[38;5;66;03m# user will need to call model.update_forward_refs()\u001b[39;00m\n\u001b[1;32m 548\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 550\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_type_analysis\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 551\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequired \u001b[38;5;129;01mis\u001b[39;00m Undefined:\n\u001b[1;32m 552\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequired \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:756\u001b[0m, in \u001b[0;36mModelField._type_analysis\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 753\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFields of type \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00morigin\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m are not supported.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 755\u001b[0m \u001b[38;5;66;03m# type_ has been refined eg. as the type of a List and sub_fields needs to be populated\u001b[39;00m\n\u001b[0;32m--> 756\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msub_fields \u001b[38;5;241m=\u001b[39m [\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_create_sub_type\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtype_\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m]\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:806\u001b[0m, in \u001b[0;36mModelField._create_sub_type\u001b[0;34m(self, type_, name, for_keys)\u001b[0m\n\u001b[1;32m 791\u001b[0m class_validators \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 792\u001b[0m k: Validator(\n\u001b[1;32m 793\u001b[0m func\u001b[38;5;241m=\u001b[39mv\u001b[38;5;241m.\u001b[39mfunc,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 801\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m v\u001b[38;5;241m.\u001b[39meach_item\n\u001b[1;32m 802\u001b[0m }\n\u001b[1;32m 804\u001b[0m field_info, _ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_field_info(name, type_, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config)\n\u001b[0;32m--> 806\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;18;43m__class__\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 807\u001b[0m \u001b[43m \u001b[49m\u001b[43mtype_\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtype_\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 808\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 809\u001b[0m \u001b[43m \u001b[49m\u001b[43mclass_validators\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclass_validators\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 810\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel_config\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 811\u001b[0m \u001b[43m \u001b[49m\u001b[43mfield_info\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfield_info\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 812\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:434\u001b[0m, in \u001b[0;36mModelField.__init__\u001b[0;34m(self, name, type_, class_validators, model_config, default, default_factory, required, final, alias, field_info)\u001b[0m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape: \u001b[38;5;28mint\u001b[39m \u001b[38;5;241m=\u001b[39m SHAPE_SINGLETON\n\u001b[1;32m 433\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config\u001b[38;5;241m.\u001b[39mprepare_field(\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m--> 434\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprepare\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:550\u001b[0m, in \u001b[0;36mModelField.prepare\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 545\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m ForwardRef \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m DeferredType:\n\u001b[1;32m 546\u001b[0m \u001b[38;5;66;03m# self.type_ is currently a ForwardRef and there's nothing we can do now,\u001b[39;00m\n\u001b[1;32m 547\u001b[0m \u001b[38;5;66;03m# user will need to call model.update_forward_refs()\u001b[39;00m\n\u001b[1;32m 548\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 550\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_type_analysis\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 551\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequired \u001b[38;5;129;01mis\u001b[39;00m Undefined:\n\u001b[1;32m 552\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequired \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:756\u001b[0m, in \u001b[0;36mModelField._type_analysis\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 753\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFields of type \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00morigin\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m are not supported.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 755\u001b[0m \u001b[38;5;66;03m# type_ has been refined eg. as the type of a List and sub_fields needs to be populated\u001b[39;00m\n\u001b[0;32m--> 756\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msub_fields \u001b[38;5;241m=\u001b[39m [\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_create_sub_type\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtype_\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m]\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:806\u001b[0m, in \u001b[0;36mModelField._create_sub_type\u001b[0;34m(self, type_, name, for_keys)\u001b[0m\n\u001b[1;32m 791\u001b[0m class_validators \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 792\u001b[0m k: Validator(\n\u001b[1;32m 793\u001b[0m func\u001b[38;5;241m=\u001b[39mv\u001b[38;5;241m.\u001b[39mfunc,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 801\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m v\u001b[38;5;241m.\u001b[39meach_item\n\u001b[1;32m 802\u001b[0m }\n\u001b[1;32m 804\u001b[0m field_info, _ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_field_info(name, type_, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config)\n\u001b[0;32m--> 806\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;18;43m__class__\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 807\u001b[0m \u001b[43m \u001b[49m\u001b[43mtype_\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtype_\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 808\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 809\u001b[0m \u001b[43m \u001b[49m\u001b[43mclass_validators\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclass_validators\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 810\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel_config\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 811\u001b[0m \u001b[43m \u001b[49m\u001b[43mfield_info\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfield_info\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 812\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:434\u001b[0m, in \u001b[0;36mModelField.__init__\u001b[0;34m(self, name, type_, class_validators, model_config, default, default_factory, required, final, alias, field_info)\u001b[0m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape: \u001b[38;5;28mint\u001b[39m \u001b[38;5;241m=\u001b[39m SHAPE_SINGLETON\n\u001b[1;32m 433\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config\u001b[38;5;241m.\u001b[39mprepare_field(\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m--> 434\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprepare\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:555\u001b[0m, in \u001b[0;36mModelField.prepare\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 553\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault \u001b[38;5;129;01mis\u001b[39;00m Undefined \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_factory \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 554\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 555\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpopulate_validators\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/fields.py:829\u001b[0m, in \u001b[0;36mModelField.populate_validators\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 825\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msub_fields \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape \u001b[38;5;241m==\u001b[39m SHAPE_GENERIC:\n\u001b[1;32m 826\u001b[0m get_validators \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__get_validators__\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 827\u001b[0m v_funcs \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 828\u001b[0m \u001b[38;5;241m*\u001b[39m[v\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;28;01mfor\u001b[39;00m v \u001b[38;5;129;01min\u001b[39;00m class_validators_ \u001b[38;5;28;01mif\u001b[39;00m v\u001b[38;5;241m.\u001b[39meach_item \u001b[38;5;129;01mand\u001b[39;00m v\u001b[38;5;241m.\u001b[39mpre],\n\u001b[0;32m--> 829\u001b[0m \u001b[38;5;241m*\u001b[39m(get_validators() \u001b[38;5;28;01mif\u001b[39;00m get_validators \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(find_validators(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_config))),\n\u001b[1;32m 830\u001b[0m \u001b[38;5;241m*\u001b[39m[v\u001b[38;5;241m.\u001b[39mfunc \u001b[38;5;28;01mfor\u001b[39;00m v \u001b[38;5;129;01min\u001b[39;00m class_validators_ \u001b[38;5;28;01mif\u001b[39;00m v\u001b[38;5;241m.\u001b[39meach_item \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m v\u001b[38;5;241m.\u001b[39mpre],\n\u001b[1;32m 831\u001b[0m )\n\u001b[1;32m 832\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalidators \u001b[38;5;241m=\u001b[39m prep_validators(v_funcs)\n\u001b[1;32m 834\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpre_validators \u001b[38;5;241m=\u001b[39m []\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/v1/validators.py:765\u001b[0m, in \u001b[0;36mfind_validators\u001b[0;34m(type_, config)\u001b[0m\n\u001b[1;32m 763\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m make_arbitrary_type_validator(type_)\n\u001b[1;32m 764\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 765\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mno validator found for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtype_\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, see `arbitrary_types_allowed` in Config\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
+ "\u001b[0;31mRuntimeError\u001b[0m: no validator found for , see `arbitrary_types_allowed` in Config"
+ ]
}
],
"source": [
@@ -620,7 +746,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/local_rag.ipynb b/docs/docs/tutorials/local_rag.ipynb
index bdff9dfdfcf..e2ee050fc7e 100644
--- a/docs/docs/tutorials/local_rag.ipynb
+++ b/docs/docs/tutorials/local_rag.ipynb
@@ -45,10 +45,81 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "a7dc1ec5",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:03.971331Z",
+ "iopub.status.busy": "2024-09-11T23:58:03.971026Z",
+ "iopub.status.idle": "2024-09-11T23:58:08.602515Z",
+ "shell.execute_reply": "2024-09-11T23:58:08.601849Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\r\n",
+ "langchain-groq 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-google-genai 2.0.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-openai 0.2.0.dev2 requires langchain-core<0.4.0,>=0.3.0.dev1, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-together 0.1.5 requires langchain-openai<0.2.0,>=0.1.16, but you have langchain-openai 0.2.0.dev2 which is incompatible.\r\n",
+ "langchain-anthropic 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-text-splitters 0.3.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev1, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-community 0.3.0.dev2 requires langchain-core<0.4.0,>=0.3.0.dev5, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-mistralai 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-google-vertexai 2.0.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-experimental 0.3.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain 0.3.0.dev2 requires langchain-core<0.4.0,>=0.3.0.dev5, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-ollama 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\u001b[0m\u001b[31m\r\n",
+ "\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\r\n",
+ "langchain-aws 0.1.15 requires langchain-core<0.3,>=0.2.29, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-huggingface 0.0.3 requires langchain-core<0.3,>=0.1.52, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-chroma 0.1.3 requires langchain-core<0.3,>=0.1.40, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-together 0.1.5 requires langchain-core<0.3.0,>=0.2.26, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-together 0.1.5 requires langchain-openai<0.2.0,>=0.1.16, but you have langchain-openai 0.2.0.dev2 which is incompatible.\r\n",
+ "langserve 0.2.2 requires langchain-core<0.3,>=0.1, but you have langchain-core 0.3.0.dev5 which is incompatible.\r\n",
+ "langchain-standard-tests 0.1.1 requires langchain-core<0.3,>=0.1.40, but you have langchain-core 0.3.0.dev5 which is incompatible.\u001b[0m\u001b[31m\r\n",
+ "\u001b[0m"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "UsageError: Line magic function `%` not found.\n"
+ ]
+ }
+ ],
"source": [
"# Document loading, retrieval methods and text splitting\n",
"%pip install -qU langchain langchain_community\n",
@@ -85,10 +156,25 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "f8cf5765",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:08.605863Z",
+ "iopub.status.busy": "2024-09-11T23:58:08.605663Z",
+ "iopub.status.idle": "2024-09-11T23:58:09.444197Z",
+ "shell.execute_reply": "2024-09-11T23:58:09.443913Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "USER_AGENT environment variable not set, consider setting it to identify your requests.\n"
+ ]
+ }
+ ],
"source": [
"from langchain_community.document_loaders import WebBaseLoader\n",
"from langchain_text_splitters import RecursiveCharacterTextSplitter\n",
@@ -112,8 +198,54 @@
"cell_type": "code",
"execution_count": 3,
"id": "fdce8923",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:09.445939Z",
+ "iopub.status.busy": "2024-09-11T23:58:09.445810Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.686819Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.686471Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "ConnectError",
+ "evalue": "[Errno 61] Connection refused",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:69\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 69\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:233\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 232\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[0;32m--> 233\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:216\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_close_connections(closing)\n\u001b[0;32m--> 216\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;66;03m# Return the response. Note that in this case we still have to manage\u001b[39;00m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;66;03m# the point at which the response is closed.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:196\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 194\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 195\u001b[0m \u001b[38;5;66;03m# Send the request on the assigned connection.\u001b[39;00m\n\u001b[0;32m--> 196\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 197\u001b[0m \u001b[43m \u001b[49m\u001b[43mpool_request\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[1;32m 200\u001b[0m \u001b[38;5;66;03m# In some cases a connection may initially be available to\u001b[39;00m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;66;03m# handle a request, but then become unavailable.\u001b[39;00m\n\u001b[1;32m 202\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;66;03m# In this case we clear the connection and try again.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:99\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connect_failed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 99\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mhandle_request(request)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:76\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 76\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m ssl_object \u001b[38;5;241m=\u001b[39m stream\u001b[38;5;241m.\u001b[39mget_extra_info(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mssl_object\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:122\u001b[0m, in \u001b[0;36mHTTPConnection._connect\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mconnect_tcp\u001b[39m\u001b[38;5;124m\"\u001b[39m, logger, request, kwargs) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[0;32m--> 122\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_network_backend\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect_tcp\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 123\u001b[0m trace\u001b[38;5;241m.\u001b[39mreturn_value \u001b[38;5;241m=\u001b[39m stream\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_backends/sync.py:205\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address, socket_options)\u001b[0m\n\u001b[1;32m 200\u001b[0m exc_map: ExceptionMapping \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 201\u001b[0m socket\u001b[38;5;241m.\u001b[39mtimeout: ConnectTimeout,\n\u001b[1;32m 202\u001b[0m \u001b[38;5;167;01mOSError\u001b[39;00m: ConnectError,\n\u001b[1;32m 203\u001b[0m }\n\u001b[0;32m--> 205\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexc_map\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 206\u001b[0m \u001b[43m \u001b[49m\u001b[43msock\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:158\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 158\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 159\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 160\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 161\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_exceptions.py:14\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(exc, from_exc):\n\u001b[0;32m---> 14\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m to_exc(exc) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n",
+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[3], line 6\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_ollama\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m OllamaEmbeddings\n\u001b[1;32m 4\u001b[0m local_embeddings \u001b[38;5;241m=\u001b[39m OllamaEmbeddings(model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnomic-embed-text\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 6\u001b[0m vectorstore \u001b[38;5;241m=\u001b[39m \u001b[43mChroma\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_documents\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdocuments\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mall_splits\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43membedding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_embeddings\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:1128\u001b[0m, in \u001b[0;36mChroma.from_documents\u001b[0;34m(cls, documents, embedding, ids, collection_name, persist_directory, client_settings, client, collection_metadata, **kwargs)\u001b[0m\n\u001b[1;32m 1126\u001b[0m texts \u001b[38;5;241m=\u001b[39m [doc\u001b[38;5;241m.\u001b[39mpage_content \u001b[38;5;28;01mfor\u001b[39;00m doc \u001b[38;5;129;01min\u001b[39;00m documents]\n\u001b[1;32m 1127\u001b[0m metadatas \u001b[38;5;241m=\u001b[39m [doc\u001b[38;5;241m.\u001b[39mmetadata \u001b[38;5;28;01mfor\u001b[39;00m doc \u001b[38;5;129;01min\u001b[39;00m documents]\n\u001b[0;32m-> 1128\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_texts\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1129\u001b[0m \u001b[43m \u001b[49m\u001b[43mtexts\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtexts\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1130\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43membedding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1131\u001b[0m \u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1132\u001b[0m \u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1133\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1134\u001b[0m \u001b[43m \u001b[49m\u001b[43mpersist_directory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpersist_directory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1135\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient_settings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient_settings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1136\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1137\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_metadata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_metadata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1138\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1139\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:1089\u001b[0m, in \u001b[0;36mChroma.from_texts\u001b[0;34m(cls, texts, embedding, metadatas, ids, collection_name, persist_directory, client_settings, client, collection_metadata, **kwargs)\u001b[0m\n\u001b[1;32m 1083\u001b[0m chroma_collection\u001b[38;5;241m.\u001b[39madd_texts(\n\u001b[1;32m 1084\u001b[0m texts\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m3\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m batch[\u001b[38;5;241m3\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m [],\n\u001b[1;32m 1085\u001b[0m metadatas\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m batch[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 1086\u001b[0m ids\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 1087\u001b[0m )\n\u001b[1;32m 1088\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1089\u001b[0m \u001b[43mchroma_collection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_texts\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtexts\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtexts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mids\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1090\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m chroma_collection\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:508\u001b[0m, in \u001b[0;36mChroma.add_texts\u001b[0;34m(self, texts, metadatas, ids, **kwargs)\u001b[0m\n\u001b[1;32m 506\u001b[0m texts \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(texts)\n\u001b[1;32m 507\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_embedding_function \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 508\u001b[0m embeddings \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_embedding_function\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43membed_documents\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtexts\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m metadatas:\n\u001b[1;32m 510\u001b[0m \u001b[38;5;66;03m# fill metadatas with empty dicts if somebody\u001b[39;00m\n\u001b[1;32m 511\u001b[0m \u001b[38;5;66;03m# did not specify metadata for all texts\u001b[39;00m\n\u001b[1;32m 512\u001b[0m length_diff \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(texts) \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mlen\u001b[39m(metadatas)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_ollama/embeddings.py:159\u001b[0m, in \u001b[0;36mOllamaEmbeddings.embed_documents\u001b[0;34m(self, texts)\u001b[0m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21membed_documents\u001b[39m(\u001b[38;5;28mself\u001b[39m, texts: List[\u001b[38;5;28mstr\u001b[39m]) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m List[List[\u001b[38;5;28mfloat\u001b[39m]]:\n\u001b[1;32m 158\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Embed search docs.\"\"\"\u001b[39;00m\n\u001b[0;32m--> 159\u001b[0m embedded_docs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43membed\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtexts\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124membeddings\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 160\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m embedded_docs\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/ollama/_client.py:262\u001b[0m, in \u001b[0;36mClient.embed\u001b[0;34m(self, model, input, truncate, options, keep_alive)\u001b[0m\n\u001b[1;32m 259\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m model:\n\u001b[1;32m 260\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m RequestError(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmust provide a model\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m--> 262\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 263\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mPOST\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 264\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m/api/embed\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 265\u001b[0m \u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m{\u001b[49m\n\u001b[1;32m 266\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmodel\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 267\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43minput\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 268\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtruncate\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtruncate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 269\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43moptions\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mkeep_alive\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mkeep_alive\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 271\u001b[0m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 272\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mjson()\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/ollama/_client.py:70\u001b[0m, in \u001b[0;36mClient._request\u001b[0;34m(self, method, url, **kwargs)\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_request\u001b[39m(\u001b[38;5;28mself\u001b[39m, method: \u001b[38;5;28mstr\u001b[39m, url: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m httpx\u001b[38;5;241m.\u001b[39mResponse:\n\u001b[0;32m---> 70\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 72\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 73\u001b[0m response\u001b[38;5;241m.\u001b[39mraise_for_status()\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:827\u001b[0m, in \u001b[0;36mClient.request\u001b[0;34m(self, method, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)\u001b[0m\n\u001b[1;32m 812\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(message, \u001b[38;5;167;01mDeprecationWarning\u001b[39;00m)\n\u001b[1;32m 814\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_request(\n\u001b[1;32m 815\u001b[0m method\u001b[38;5;241m=\u001b[39mmethod,\n\u001b[1;32m 816\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 825\u001b[0m extensions\u001b[38;5;241m=\u001b[39mextensions,\n\u001b[1;32m 826\u001b[0m )\n\u001b[0;32m--> 827\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:914\u001b[0m, in \u001b[0;36mClient.send\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 906\u001b[0m follow_redirects \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 907\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfollow_redirects\n\u001b[1;32m 908\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(follow_redirects, UseClientDefault)\n\u001b[1;32m 909\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m follow_redirects\n\u001b[1;32m 910\u001b[0m )\n\u001b[1;32m 912\u001b[0m auth \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_build_request_auth(request, auth)\n\u001b[0;32m--> 914\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_auth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 915\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 916\u001b[0m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 917\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 918\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 919\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 920\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 921\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:942\u001b[0m, in \u001b[0;36mClient._send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 939\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[1;32m 941\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 942\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_redirects\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 943\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 944\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 945\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhistory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 946\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 947\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 948\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:979\u001b[0m, in \u001b[0;36mClient._send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrequest\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[1;32m 977\u001b[0m hook(request)\n\u001b[0;32m--> 979\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_single_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 980\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 981\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mresponse\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:1015\u001b[0m, in \u001b[0;36mClient._send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1010\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 1011\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAttempted to send an async request with a sync Client instance.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1012\u001b[0m )\n\u001b[1;32m 1014\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request\u001b[38;5;241m=\u001b[39mrequest):\n\u001b[0;32m-> 1015\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mtransport\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1017\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 1019\u001b[0m response\u001b[38;5;241m.\u001b[39mrequest \u001b[38;5;241m=\u001b[39m request\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:232\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(request\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 220\u001b[0m req \u001b[38;5;241m=\u001b[39m httpcore\u001b[38;5;241m.\u001b[39mRequest(\n\u001b[1;32m 221\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 222\u001b[0m url\u001b[38;5;241m=\u001b[39mhttpcore\u001b[38;5;241m.\u001b[39mURL(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 230\u001b[0m extensions\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 231\u001b[0m )\n\u001b[0;32m--> 232\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_httpcore_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mresp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n",
+ "File \u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:158\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 156\u001b[0m value \u001b[38;5;241m=\u001b[39m typ()\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 158\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 159\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 160\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 161\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n\u001b[1;32m 163\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m value\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:86\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 85\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(exc)\n\u001b[0;32m---> 86\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m mapped_exc(message) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n",
+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused"
+ ]
+ }
+ ],
"source": [
"from langchain_chroma import Chroma\n",
"from langchain_ollama import OllamaEmbeddings\n",
@@ -135,17 +267,25 @@
"cell_type": "code",
"execution_count": 4,
"id": "b0c55e98",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.688396Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.688295Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.695964Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.695742Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "4"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[4], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m question \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat are the approaches to Task Decomposition?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 2\u001b[0m docs \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(question)\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mlen\u001b[39m(docs)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
+ ]
}
],
"source": [
@@ -158,17 +298,25 @@
"cell_type": "code",
"execution_count": 5,
"id": "32b43339",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.697189Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.697105Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.703181Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.702969Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "Document(metadata={'description': 'Building agents with LLM (large language model) as its core controller is a cool concept. Several proof-of-concepts demos, such as AutoGPT, GPT-Engineer and BabyAGI, serve as inspiring examples. The potentiality of LLM extends beyond generating well-written copies, stories, essays and programs; it can be framed as a powerful general problem solver.\\nAgent System Overview In a LLM-powered autonomous agent system, LLM functions as the agent’s brain, complemented by several key components:', 'language': 'en', 'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'title': \"LLM Powered Autonomous Agents | Lil'Log\"}, page_content='Task decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.')"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'docs' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdocs\u001b[49m[\u001b[38;5;241m0\u001b[39m]\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'docs' is not defined"
+ ]
}
],
"source": [
@@ -187,7 +335,14 @@
"cell_type": "code",
"execution_count": 6,
"id": "af1176bb-d52a-4cf0-b983-8b7433d45b4f",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.704389Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.704287Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.717651Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.717409Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_ollama import ChatOllama\n",
@@ -209,59 +364,55 @@
"cell_type": "code",
"execution_count": 7,
"id": "bf0162e0-8c41-4344-88ae-ff2bbaeb12eb",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.719044Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.718971Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.851361Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.851002Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "**The scene is set: a packed arena, the crowd on their feet. In the blue corner, we have Stephen Colbert, aka \"The O'Reilly Factor\" himself. In the red corner, the challenger, John Oliver. The judges are announced as Tina Fey, Larry Wilmore, and Patton Oswalt. The crowd roars as the two opponents face off.**\n",
- "\n",
- "**Stephen Colbert (aka \"The Truth with a Twist\"):**\n",
- "Yo, I'm the king of satire, the one they all fear\n",
- "My show's on late, but my jokes are clear\n",
- "I skewer the politicians, with precision and might\n",
- "They tremble at my wit, day and night\n",
- "\n",
- "**John Oliver:**\n",
- "Hold up, Stevie boy, you may have had your time\n",
- "But I'm the new kid on the block, with a different prime\n",
- "Time to wake up from that 90s coma, son\n",
- "My show's got bite, and my facts are never done\n",
- "\n",
- "**Stephen Colbert:**\n",
- "Oh, so you think you're the one, with the \"Last Week\" crown\n",
- "But your jokes are stale, like the ones I wore down\n",
- "I'm the master of absurdity, the lord of the spin\n",
- "You're just a British import, trying to fit in\n",
- "\n",
- "**John Oliver:**\n",
- "Stevie, my friend, you may have been the first\n",
- "But I've got the skill and the wit, that's never blurred\n",
- "My show's not afraid, to take on the fray\n",
- "I'm the one who'll make you think, come what may\n",
- "\n",
- "**Stephen Colbert:**\n",
- "Well, it's time for a showdown, like two old friends\n",
- "Let's see whose satire reigns supreme, till the very end\n",
- "But I've got a secret, that might just seal your fate\n",
- "My humor's contagious, and it's already too late!\n",
- "\n",
- "**John Oliver:**\n",
- "Bring it on, Stevie! I'm ready for you\n",
- "I'll take on your jokes, and show them what to do\n",
- "My sarcasm's sharp, like a scalpel in the night\n",
- "You're just a relic of the past, without a fight\n",
- "\n",
- "**The judges deliberate, weighing the rhymes and the flow. Finally, they announce their decision:**\n",
- "\n",
- "Tina Fey: I've got to go with John Oliver. His jokes were sharper, and his delivery was smoother.\n",
- "\n",
- "Larry Wilmore: Agreed! But Stephen Colbert's still got that old-school charm.\n",
- "\n",
- "Patton Oswalt: You know what? It's a tie. Both of them brought the heat!\n",
- "\n",
- "**The crowd goes wild as both opponents take a bow. The rap battle may be over, but the satire war is just beginning...\n"
+ "ename": "ConnectError",
+ "evalue": "[Errno 61] Connection refused",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:69\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 69\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:233\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 232\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[0;32m--> 233\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:216\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 215\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_close_connections(closing)\n\u001b[0;32m--> 216\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;66;03m# Return the response. Note that in this case we still have to manage\u001b[39;00m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;66;03m# the point at which the response is closed.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:196\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 194\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 195\u001b[0m \u001b[38;5;66;03m# Send the request on the assigned connection.\u001b[39;00m\n\u001b[0;32m--> 196\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 197\u001b[0m \u001b[43m \u001b[49m\u001b[43mpool_request\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[1;32m 200\u001b[0m \u001b[38;5;66;03m# In some cases a connection may initially be available to\u001b[39;00m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;66;03m# handle a request, but then become unavailable.\u001b[39;00m\n\u001b[1;32m 202\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;66;03m# In this case we clear the connection and try again.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:99\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connect_failed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 99\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mhandle_request(request)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:76\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 76\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m ssl_object \u001b[38;5;241m=\u001b[39m stream\u001b[38;5;241m.\u001b[39mget_extra_info(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mssl_object\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_sync/connection.py:122\u001b[0m, in \u001b[0;36mHTTPConnection._connect\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mconnect_tcp\u001b[39m\u001b[38;5;124m\"\u001b[39m, logger, request, kwargs) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[0;32m--> 122\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_network_backend\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect_tcp\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 123\u001b[0m trace\u001b[38;5;241m.\u001b[39mreturn_value \u001b[38;5;241m=\u001b[39m stream\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_backends/sync.py:205\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address, socket_options)\u001b[0m\n\u001b[1;32m 200\u001b[0m exc_map: ExceptionMapping \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 201\u001b[0m socket\u001b[38;5;241m.\u001b[39mtimeout: ConnectTimeout,\n\u001b[1;32m 202\u001b[0m \u001b[38;5;167;01mOSError\u001b[39;00m: ConnectError,\n\u001b[1;32m 203\u001b[0m }\n\u001b[0;32m--> 205\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexc_map\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 206\u001b[0m \u001b[43m \u001b[49m\u001b[43msock\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:158\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 158\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 159\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 160\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 161\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpcore/_exceptions.py:14\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(exc, from_exc):\n\u001b[0;32m---> 14\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m to_exc(exc) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n",
+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m response_message \u001b[38;5;241m=\u001b[39m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minvoke\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSimulate a rap battle between Stephen Colbert and John Oliver\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\n\u001b[1;32m 3\u001b[0m \u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(response_message\u001b[38;5;241m.\u001b[39mcontent)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:281\u001b[0m, in \u001b[0;36mBaseChatModel.invoke\u001b[0;34m(self, input, config, stop, **kwargs)\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minvoke\u001b[39m(\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 272\u001b[0m \u001b[38;5;28minput\u001b[39m: LanguageModelInput,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 276\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 277\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m BaseMessage:\n\u001b[1;32m 278\u001b[0m config \u001b[38;5;241m=\u001b[39m ensure_config(config)\n\u001b[1;32m 279\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(\n\u001b[1;32m 280\u001b[0m ChatGeneration,\n\u001b[0;32m--> 281\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerate_prompt\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 282\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_convert_input\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 283\u001b[0m \u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 284\u001b[0m \u001b[43m \u001b[49m\u001b[43mcallbacks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcallbacks\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 285\u001b[0m \u001b[43m \u001b[49m\u001b[43mtags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtags\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 286\u001b[0m \u001b[43m \u001b[49m\u001b[43mmetadata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmetadata\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 287\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrun_name\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 288\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpop\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrun_id\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 289\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 290\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mgenerations[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 291\u001b[0m )\u001b[38;5;241m.\u001b[39mmessage\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:781\u001b[0m, in \u001b[0;36mBaseChatModel.generate_prompt\u001b[0;34m(self, prompts, stop, callbacks, **kwargs)\u001b[0m\n\u001b[1;32m 773\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgenerate_prompt\u001b[39m(\n\u001b[1;32m 774\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 775\u001b[0m prompts: List[PromptValue],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 779\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m LLMResult:\n\u001b[1;32m 780\u001b[0m prompt_messages \u001b[38;5;241m=\u001b[39m [p\u001b[38;5;241m.\u001b[39mto_messages() \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m prompts]\n\u001b[0;32m--> 781\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprompt_messages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcallbacks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcallbacks\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:638\u001b[0m, in \u001b[0;36mBaseChatModel.generate\u001b[0;34m(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)\u001b[0m\n\u001b[1;32m 636\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_managers:\n\u001b[1;32m 637\u001b[0m run_managers[i]\u001b[38;5;241m.\u001b[39mon_llm_error(e, response\u001b[38;5;241m=\u001b[39mLLMResult(generations\u001b[38;5;241m=\u001b[39m[]))\n\u001b[0;32m--> 638\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 639\u001b[0m flattened_outputs \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 640\u001b[0m LLMResult(generations\u001b[38;5;241m=\u001b[39m[res\u001b[38;5;241m.\u001b[39mgenerations], llm_output\u001b[38;5;241m=\u001b[39mres\u001b[38;5;241m.\u001b[39mllm_output) \u001b[38;5;66;03m# type: ignore[list-item]\u001b[39;00m\n\u001b[1;32m 641\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m results\n\u001b[1;32m 642\u001b[0m ]\n\u001b[1;32m 643\u001b[0m llm_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_combine_llm_outputs([res\u001b[38;5;241m.\u001b[39mllm_output \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m results])\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:628\u001b[0m, in \u001b[0;36mBaseChatModel.generate\u001b[0;34m(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)\u001b[0m\n\u001b[1;32m 625\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(messages):\n\u001b[1;32m 626\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 627\u001b[0m results\u001b[38;5;241m.\u001b[39mappend(\n\u001b[0;32m--> 628\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_with_cache\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 629\u001b[0m \u001b[43m \u001b[49m\u001b[43mm\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 630\u001b[0m \u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 631\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrun_managers\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mrun_managers\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 632\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 633\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 634\u001b[0m )\n\u001b[1;32m 635\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 636\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_managers:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:850\u001b[0m, in \u001b[0;36mBaseChatModel._generate_with_cache\u001b[0;34m(self, messages, stop, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 848\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 849\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_generate)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_manager\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m--> 850\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 851\u001b[0m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrun_manager\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 852\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 853\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 854\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_generate(messages, stop\u001b[38;5;241m=\u001b[39mstop, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_ollama/chat_models.py:642\u001b[0m, in \u001b[0;36mChatOllama._generate\u001b[0;34m(self, messages, stop, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 635\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_generate\u001b[39m(\n\u001b[1;32m 636\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 637\u001b[0m messages: List[BaseMessage],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 640\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 641\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ChatResult:\n\u001b[0;32m--> 642\u001b[0m final_chunk \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_chat_stream_with_aggregation\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 643\u001b[0m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mverbose\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 644\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 645\u001b[0m generation_info \u001b[38;5;241m=\u001b[39m final_chunk\u001b[38;5;241m.\u001b[39mgeneration_info\n\u001b[1;32m 646\u001b[0m chat_generation \u001b[38;5;241m=\u001b[39m ChatGeneration(\n\u001b[1;32m 647\u001b[0m message\u001b[38;5;241m=\u001b[39mAIMessage(\n\u001b[1;32m 648\u001b[0m content\u001b[38;5;241m=\u001b[39mfinal_chunk\u001b[38;5;241m.\u001b[39mtext,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 652\u001b[0m generation_info\u001b[38;5;241m=\u001b[39mgeneration_info,\n\u001b[1;32m 653\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_ollama/chat_models.py:543\u001b[0m, in \u001b[0;36mChatOllama._chat_stream_with_aggregation\u001b[0;34m(self, messages, stop, run_manager, verbose, **kwargs)\u001b[0m\n\u001b[1;32m 534\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_chat_stream_with_aggregation\u001b[39m(\n\u001b[1;32m 535\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 536\u001b[0m messages: List[BaseMessage],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 540\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 541\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ChatGenerationChunk:\n\u001b[1;32m 542\u001b[0m final_chunk \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 543\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mstream_resp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_create_chat_stream\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 544\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mstream_resp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 545\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunk\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mChatGenerationChunk\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 546\u001b[0m \u001b[43m \u001b[49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mAIMessageChunk\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 547\u001b[0m \u001b[43m \u001b[49m\u001b[43mcontent\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 560\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 561\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_ollama/chat_models.py:525\u001b[0m, in \u001b[0;36mChatOllama._create_chat_stream\u001b[0;34m(self, messages, stop, **kwargs)\u001b[0m\n\u001b[1;32m 515\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39mchat(\n\u001b[1;32m 516\u001b[0m model\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 517\u001b[0m messages\u001b[38;5;241m=\u001b[39mollama_messages,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 522\u001b[0m tools\u001b[38;5;241m=\u001b[39mkwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtools\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 523\u001b[0m )\n\u001b[1;32m 524\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 525\u001b[0m \u001b[38;5;28;01myield from\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39mchat(\n\u001b[1;32m 526\u001b[0m model\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 527\u001b[0m messages\u001b[38;5;241m=\u001b[39mollama_messages,\n\u001b[1;32m 528\u001b[0m stream\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[1;32m 529\u001b[0m options\u001b[38;5;241m=\u001b[39mOptions(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moptions\u001b[39m\u001b[38;5;124m\"\u001b[39m]),\n\u001b[1;32m 530\u001b[0m keep_alive\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mkeep_alive\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 531\u001b[0m \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mformat\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 532\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/ollama/_client.py:80\u001b[0m, in \u001b[0;36mClient._stream\u001b[0;34m(self, method, url, **kwargs)\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_stream\u001b[39m(\u001b[38;5;28mself\u001b[39m, method: \u001b[38;5;28mstr\u001b[39m, url: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Iterator[Mapping[\u001b[38;5;28mstr\u001b[39m, Any]]:\n\u001b[0;32m---> 80\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mas\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mr\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 81\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mtry\u001b[39;49;00m\u001b[43m:\u001b[49m\n\u001b[1;32m 82\u001b[0m \u001b[43m \u001b[49m\u001b[43mr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:137\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__enter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 135\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39margs, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkwds, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfunc\n\u001b[1;32m 136\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 137\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mnext\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen)\n\u001b[1;32m 138\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m:\n\u001b[1;32m 139\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgenerator didn\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt yield\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:870\u001b[0m, in \u001b[0;36mClient.stream\u001b[0;34m(self, method, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)\u001b[0m\n\u001b[1;32m 847\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 848\u001b[0m \u001b[38;5;124;03mAlternative to `httpx.request()` that streams the response body\u001b[39;00m\n\u001b[1;32m 849\u001b[0m \u001b[38;5;124;03minstead of loading it into memory at once.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 855\u001b[0m \u001b[38;5;124;03m[0]: /quickstart#streaming-responses\u001b[39;00m\n\u001b[1;32m 856\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 857\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_request(\n\u001b[1;32m 858\u001b[0m method\u001b[38;5;241m=\u001b[39mmethod,\n\u001b[1;32m 859\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 868\u001b[0m extensions\u001b[38;5;241m=\u001b[39mextensions,\n\u001b[1;32m 869\u001b[0m )\n\u001b[0;32m--> 870\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 871\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 872\u001b[0m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 873\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 874\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 875\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 876\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 877\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m response\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:914\u001b[0m, in \u001b[0;36mClient.send\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 906\u001b[0m follow_redirects \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 907\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfollow_redirects\n\u001b[1;32m 908\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(follow_redirects, UseClientDefault)\n\u001b[1;32m 909\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m follow_redirects\n\u001b[1;32m 910\u001b[0m )\n\u001b[1;32m 912\u001b[0m auth \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_build_request_auth(request, auth)\n\u001b[0;32m--> 914\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_auth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 915\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 916\u001b[0m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 917\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 918\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 919\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 920\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 921\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:942\u001b[0m, in \u001b[0;36mClient._send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 939\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[1;32m 941\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 942\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_redirects\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 943\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 944\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 945\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhistory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 946\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 947\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 948\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:979\u001b[0m, in \u001b[0;36mClient._send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrequest\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[1;32m 977\u001b[0m hook(request)\n\u001b[0;32m--> 979\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_single_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 980\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 981\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mresponse\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_client.py:1015\u001b[0m, in \u001b[0;36mClient._send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1010\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 1011\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAttempted to send an async request with a sync Client instance.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1012\u001b[0m )\n\u001b[1;32m 1014\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request\u001b[38;5;241m=\u001b[39mrequest):\n\u001b[0;32m-> 1015\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mtransport\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1017\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 1019\u001b[0m response\u001b[38;5;241m.\u001b[39mrequest \u001b[38;5;241m=\u001b[39m request\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:232\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(request\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 220\u001b[0m req \u001b[38;5;241m=\u001b[39m httpcore\u001b[38;5;241m.\u001b[39mRequest(\n\u001b[1;32m 221\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 222\u001b[0m url\u001b[38;5;241m=\u001b[39mhttpcore\u001b[38;5;241m.\u001b[39mURL(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 230\u001b[0m extensions\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 231\u001b[0m )\n\u001b[0;32m--> 232\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_httpcore_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mresp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n",
+ "File \u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:158\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 156\u001b[0m value \u001b[38;5;241m=\u001b[39m typ()\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 158\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 159\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 160\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 161\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 162\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n\u001b[1;32m 163\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m value\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/httpx/_transports/default.py:86\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 85\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(exc)\n\u001b[0;32m---> 86\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m mapped_exc(message) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n",
+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused"
]
}
],
@@ -289,17 +440,25 @@
"cell_type": "code",
"execution_count": 8,
"id": "18a3716d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.853211Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.853093Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.861779Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.861515Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "'The main themes in these documents are:\\n\\n1. **Task Decomposition**: The process of breaking down complex tasks into smaller, manageable subgoals is crucial for efficient task handling.\\n2. **Autonomous Agent System**: A system powered by Large Language Models (LLMs) that can perform planning, reflection, and refinement to improve the quality of final results.\\n3. **Challenges in Planning and Decomposition**:\\n\\t* Long-term planning and task decomposition are challenging for LLMs.\\n\\t* Adjusting plans when faced with unexpected errors is difficult for LLMs.\\n\\t* Humans learn from trial and error, making them more robust than LLMs in certain situations.\\n\\nOverall, the documents highlight the importance of task decomposition and planning in autonomous agent systems powered by LLMs, as well as the challenges that still need to be addressed.'"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[8], line 19\u001b[0m\n\u001b[1;32m 15\u001b[0m chain \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdocs\u001b[39m\u001b[38;5;124m\"\u001b[39m: format_docs} \u001b[38;5;241m|\u001b[39m prompt \u001b[38;5;241m|\u001b[39m model \u001b[38;5;241m|\u001b[39m StrOutputParser()\n\u001b[1;32m 17\u001b[0m question \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat are the approaches to Task Decomposition?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 19\u001b[0m docs \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(question)\n\u001b[1;32m 21\u001b[0m chain\u001b[38;5;241m.\u001b[39minvoke(docs)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
+ ]
}
],
"source": [
@@ -340,17 +499,25 @@
"cell_type": "code",
"execution_count": 9,
"id": "67cefb46-acd3-4c2a-a8f6-b62c7c3e30dc",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.863194Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.863120Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.870442Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.870180Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "'Task decomposition can be done through (1) simple prompting using LLM, (2) task-specific instructions, or (3) human inputs. This approach helps break down large tasks into smaller, manageable subgoals for efficient handling of complex tasks. It enables agents to plan ahead and improve the quality of final results through reflection and refinement.'"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[9], line 25\u001b[0m\n\u001b[1;32m 16\u001b[0m chain \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 17\u001b[0m RunnablePassthrough\u001b[38;5;241m.\u001b[39massign(context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m \u001b[38;5;28minput\u001b[39m: format_docs(\u001b[38;5;28minput\u001b[39m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontext\u001b[39m\u001b[38;5;124m\"\u001b[39m]))\n\u001b[1;32m 18\u001b[0m \u001b[38;5;241m|\u001b[39m rag_prompt\n\u001b[1;32m 19\u001b[0m \u001b[38;5;241m|\u001b[39m model\n\u001b[1;32m 20\u001b[0m \u001b[38;5;241m|\u001b[39m StrOutputParser()\n\u001b[1;32m 21\u001b[0m )\n\u001b[1;32m 23\u001b[0m question \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat are the approaches to Task Decomposition?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 25\u001b[0m docs \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(question)\n\u001b[1;32m 27\u001b[0m \u001b[38;5;66;03m# Run\u001b[39;00m\n\u001b[1;32m 28\u001b[0m chain\u001b[38;5;241m.\u001b[39minvoke({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontext\u001b[39m\u001b[38;5;124m\"\u001b[39m: docs, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mquestion\u001b[39m\u001b[38;5;124m\"\u001b[39m: question})\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
+ ]
}
],
"source": [
@@ -398,8 +565,27 @@
"cell_type": "code",
"execution_count": 10,
"id": "86c7a349",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.871745Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.871666Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.877535Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.877352Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m retriever \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39mas_retriever()\n\u001b[1;32m 3\u001b[0m qa_chain \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 4\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontext\u001b[39m\u001b[38;5;124m\"\u001b[39m: retriever \u001b[38;5;241m|\u001b[39m format_docs, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mquestion\u001b[39m\u001b[38;5;124m\"\u001b[39m: RunnablePassthrough()}\n\u001b[1;32m 5\u001b[0m \u001b[38;5;241m|\u001b[39m rag_prompt\n\u001b[1;32m 6\u001b[0m \u001b[38;5;241m|\u001b[39m model\n\u001b[1;32m 7\u001b[0m \u001b[38;5;241m|\u001b[39m StrOutputParser()\n\u001b[1;32m 8\u001b[0m )\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
+ ]
+ }
+ ],
"source": [
"retriever = vectorstore.as_retriever()\n",
"\n",
@@ -415,17 +601,25 @@
"cell_type": "code",
"execution_count": 11,
"id": "112ca227",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:10.878687Z",
+ "iopub.status.busy": "2024-09-11T23:58:10.878623Z",
+ "iopub.status.idle": "2024-09-11T23:58:10.884126Z",
+ "shell.execute_reply": "2024-09-11T23:58:10.883931Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "'Task decomposition can be done through (1) simple prompting in Large Language Models (LLM), (2) using task-specific instructions, or (3) with human inputs. This process involves breaking down large tasks into smaller, manageable subgoals for efficient handling of complex tasks.'"
- ]
- },
- "execution_count": 11,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'qa_chain' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[11], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m question \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat are the approaches to Task Decomposition?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 3\u001b[0m \u001b[43mqa_chain\u001b[49m\u001b[38;5;241m.\u001b[39minvoke(question)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'qa_chain' is not defined"
+ ]
}
],
"source": [
@@ -467,7 +661,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.5"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/pdf_qa.ipynb b/docs/docs/tutorials/pdf_qa.ipynb
index 294562b7daf..5acc48a3fd2 100644
--- a/docs/docs/tutorials/pdf_qa.ipynb
+++ b/docs/docs/tutorials/pdf_qa.ipynb
@@ -48,9 +48,24 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 1,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:12.610632Z",
+ "iopub.status.busy": "2024-09-11T23:58:12.610282Z",
+ "iopub.status.idle": "2024-09-11T23:58:14.134964Z",
+ "shell.execute_reply": "2024-09-11T23:58:14.134445Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install -qU pypdf langchain_community"
]
@@ -58,7 +73,14 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:14.137583Z",
+ "iopub.status.busy": "2024-09-11T23:58:14.137376Z",
+ "iopub.status.idle": "2024-09-11T23:58:19.219663Z",
+ "shell.execute_reply": "2024-09-11T23:58:19.219392Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -82,7 +104,14 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:19.221066Z",
+ "iopub.status.busy": "2024-09-11T23:58:19.220961Z",
+ "iopub.status.idle": "2024-09-11T23:58:19.222956Z",
+ "shell.execute_reply": "2024-09-11T23:58:19.222676Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -128,9 +157,68 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 4,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:19.224264Z",
+ "iopub.status.busy": "2024-09-11T23:58:19.224190Z",
+ "iopub.status.idle": "2024-09-11T23:58:20.309723Z",
+ "shell.execute_reply": "2024-09-11T23:58:20.309316Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: langchain_anthropic in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.2.0.dev1)\r\n",
+ "Requirement already satisfied: anthropic<1,>=0.30.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_anthropic) (0.34.1)\r\n",
+ "Requirement already satisfied: defusedxml<0.8.0,>=0.7.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_anthropic) (0.7.1)\r\n",
+ "Requirement already satisfied: langchain-core<0.4.0,>=0.3.0.dev4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_anthropic) (0.3.0.dev5)\r\n",
+ "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_anthropic) (2.8.2)\r\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (4.4.0)\r\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (1.9.0)\r\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (0.27.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: jiter<1,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (0.5.0)\r\n",
+ "Requirement already satisfied: sniffio in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (1.3.1)\r\n",
+ "Requirement already satisfied: tokenizers>=0.13.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (0.19.1)\r\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anthropic<1,>=0.30.0->langchain_anthropic) (4.12.2)\r\n",
+ "Requirement already satisfied: PyYAML>=5.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (6.0.2)\r\n",
+ "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (1.33)\r\n",
+ "Requirement already satisfied: langsmith<0.2.0,>=0.1.117 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (0.1.118)\r\n",
+ "Requirement already satisfied: packaging<25,>=23.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (24.1)\r\n",
+ "Requirement already satisfied: tenacity!=8.4.0,<9.0.0,>=8.1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (8.5.0)\r\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain_anthropic) (0.7.0)\r\n",
+ "Requirement already satisfied: pydantic-core==2.20.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.7.4->langchain_anthropic) (2.20.1)\r\n",
+ "Requirement already satisfied: idna>=2.8 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anyio<5,>=3.5.0->anthropic<1,>=0.30.0->langchain_anthropic) (3.7)\r\n",
+ "Requirement already satisfied: certifi in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->anthropic<1,>=0.30.0->langchain_anthropic) (2024.7.4)\r\n",
+ "Requirement already satisfied: httpcore==1.* in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx<1,>=0.23.0->anthropic<1,>=0.30.0->langchain_anthropic) (1.0.5)\r\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->anthropic<1,>=0.30.0->langchain_anthropic) (0.14.0)\r\n",
+ "Requirement already satisfied: jsonpointer>=1.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (3.0.0)\r\n",
+ "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.117->langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (3.10.6)\r\n",
+ "Requirement already satisfied: requests<3,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langsmith<0.2.0,>=0.1.117->langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (2.32.3)\r\n",
+ "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain_anthropic) (0.24.5)\r\n",
+ "Requirement already satisfied: filelock in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain_anthropic) (3.15.4)\r\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain_anthropic) (2024.6.1)\r\n",
+ "Requirement already satisfied: tqdm>=4.42.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.0->anthropic<1,>=0.30.0->langchain_anthropic) (4.66.5)\r\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langsmith<0.2.0,>=0.1.117->langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (3.3.2)\r\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests<3,>=2->langsmith<0.2.0,>=0.1.117->langchain-core<0.4.0,>=0.3.0.dev4->langchain_anthropic) (2.2.2)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# | output: false\n",
"# | echo: false\n",
@@ -150,9 +238,226 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
+ "execution_count": 5,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:20.311503Z",
+ "iopub.status.busy": "2024-09-11T23:58:20.311388Z",
+ "iopub.status.idle": "2024-09-11T23:58:22.231610Z",
+ "shell.execute_reply": "2024-09-11T23:58:22.231061Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: langchain_chroma in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.1.3)\r\n",
+ "Requirement already satisfied: langchain_openai in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (0.2.0.dev2)\r\n",
+ "Requirement already satisfied: chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_chroma) (0.5.3)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: fastapi<1,>=0.95.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_chroma) (0.112.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain-core<0.3,>=0.1.40 (from langchain_chroma)\r\n",
+ " Using cached langchain_core-0.2.39-py3-none-any.whl.metadata (6.2 kB)\r\n",
+ "Requirement already satisfied: numpy<2,>=1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_chroma) (1.26.4)\r\n",
+ "INFO: pip is looking at multiple versions of langchain-openai to determine which version is compatible with other requirements. This could take a while.\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain_openai\r\n",
+ " Using cached langchain_openai-0.2.0.dev1-py3-none-any.whl.metadata (2.6 kB)\r\n",
+ " Using cached langchain_openai-0.2.0.dev0-py3-none-any.whl.metadata (2.6 kB)\r\n",
+ " Using cached langchain_openai-0.1.23-py3-none-any.whl.metadata (2.6 kB)\r\n",
+ "Requirement already satisfied: openai<2.0.0,>=1.40.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_openai) (1.40.1)\r\n",
+ "Requirement already satisfied: tiktoken<1,>=0.7 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain_openai) (0.7.0)\r\n",
+ "Requirement already satisfied: build>=1.0.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.2.1)\r\n",
+ "Requirement already satisfied: requests>=2.28 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.32.3)\r\n",
+ "Requirement already satisfied: pydantic>=1.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.8.2)\r\n",
+ "Requirement already satisfied: chroma-hnswlib==0.7.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.7.3)\r\n",
+ "Requirement already satisfied: uvicorn>=0.18.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.23.2)\r\n",
+ "Requirement already satisfied: posthog>=2.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.5.0)\r\n",
+ "Requirement already satisfied: typing-extensions>=4.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.12.2)\r\n",
+ "Requirement already satisfied: onnxruntime>=1.14.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.18.1)\r\n",
+ "Requirement already satisfied: opentelemetry-api>=1.2.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.26.0)\r\n",
+ "Requirement already satisfied: opentelemetry-exporter-otlp-proto-grpc>=1.2.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.26.0)\r\n",
+ "Requirement already satisfied: opentelemetry-instrumentation-fastapi>=0.41b0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.47b0)\r\n",
+ "Requirement already satisfied: opentelemetry-sdk>=1.2.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.26.0)\r\n",
+ "Requirement already satisfied: tokenizers>=0.13.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.19.1)\r\n",
+ "Requirement already satisfied: pypika>=0.48.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.48.9)\r\n",
+ "Requirement already satisfied: tqdm>=4.65.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.66.5)\r\n",
+ "Requirement already satisfied: overrides>=7.3.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (7.7.0)\r\n",
+ "Requirement already satisfied: importlib-resources in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (6.4.2)\r\n",
+ "Requirement already satisfied: grpcio>=1.58.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.66.0)\r\n",
+ "Requirement already satisfied: bcrypt>=4.0.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.2.0)\r\n",
+ "Requirement already satisfied: typer>=0.9.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.9.4)\r\n",
+ "Requirement already satisfied: kubernetes>=28.1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (30.1.0)\r\n",
+ "Requirement already satisfied: tenacity>=8.2.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (8.5.0)\r\n",
+ "Requirement already satisfied: PyYAML>=6.0.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (6.0.2)\r\n",
+ "Requirement already satisfied: mmh3>=4.0.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.1.0)\r\n",
+ "Requirement already satisfied: orjson>=3.9.12 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.10.6)\r\n",
+ "Requirement already satisfied: httpx>=0.27.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.27.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: starlette<0.38.0,>=0.37.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from fastapi<1,>=0.95.2->langchain_chroma) (0.37.2)\r\n",
+ "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.3,>=0.1.40->langchain_chroma) (1.33)\r\n",
+ "Requirement already satisfied: langsmith<0.2.0,>=0.1.112 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.3,>=0.1.40->langchain_chroma) (0.1.118)\r\n",
+ "Requirement already satisfied: packaging<25,>=23.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from langchain-core<0.3,>=0.1.40->langchain_chroma) (24.1)\r\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from openai<2.0.0,>=1.40.0->langchain_openai) (4.4.0)\r\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from openai<2.0.0,>=1.40.0->langchain_openai) (1.9.0)\r\n",
+ "Requirement already satisfied: jiter<1,>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from openai<2.0.0,>=1.40.0->langchain_openai) (0.5.0)\r\n",
+ "Requirement already satisfied: sniffio in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from openai<2.0.0,>=1.40.0->langchain_openai) (1.3.1)\r\n",
+ "Requirement already satisfied: regex>=2022.1.18 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tiktoken<1,>=0.7->langchain_openai) (2024.7.24)\r\n",
+ "Requirement already satisfied: idna>=2.8 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from anyio<5,>=3.5.0->openai<2.0.0,>=1.40.0->langchain_openai) (3.7)\r\n",
+ "Requirement already satisfied: pyproject_hooks in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from build>=1.0.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.1.0)\r\n",
+ "Requirement already satisfied: certifi in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx>=0.27.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2024.7.4)\r\n",
+ "Requirement already satisfied: httpcore==1.* in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpx>=0.27.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.0.5)\r\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from httpcore==1.*->httpx>=0.27.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.14.0)\r\n",
+ "Requirement already satisfied: jsonpointer>=1.9 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.3,>=0.1.40->langchain_chroma) (3.0.0)\r\n",
+ "Requirement already satisfied: six>=1.9.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.16.0)\r\n",
+ "Requirement already satisfied: python-dateutil>=2.5.3 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.9.0.post0)\r\n",
+ "Requirement already satisfied: google-auth>=1.0.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.33.0)\r\n",
+ "Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.8.0)\r\n",
+ "Requirement already satisfied: requests-oauthlib in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.0.0)\r\n",
+ "Requirement already satisfied: oauthlib>=3.2.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.2.2)\r\n",
+ "Requirement already satisfied: urllib3>=1.24.2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.2.2)\r\n",
+ "Requirement already satisfied: coloredlogs in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (15.0.1)\r\n",
+ "Requirement already satisfied: flatbuffers in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (24.3.25)\r\n",
+ "Requirement already satisfied: protobuf in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.25.4)\r\n",
+ "Requirement already satisfied: sympy in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.13.2)\r\n",
+ "Requirement already satisfied: deprecated>=1.2.6 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-api>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.2.14)\r\n",
+ "Requirement already satisfied: importlib-metadata<=8.0.0,>=6.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-api>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (8.0.0)\r\n",
+ "Requirement already satisfied: googleapis-common-protos~=1.52 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.63.2)\r\n",
+ "Requirement already satisfied: opentelemetry-exporter-otlp-proto-common==1.26.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.26.0)\r\n",
+ "Requirement already satisfied: opentelemetry-proto==1.26.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.26.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: opentelemetry-instrumentation-asgi==0.47b0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.47b0)\r\n",
+ "Requirement already satisfied: opentelemetry-instrumentation==0.47b0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.47b0)\r\n",
+ "Requirement already satisfied: opentelemetry-semantic-conventions==0.47b0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.47b0)\r\n",
+ "Requirement already satisfied: opentelemetry-util-http==0.47b0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.47b0)\r\n",
+ "Requirement already satisfied: setuptools>=16.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation==0.47b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (70.3.0)\r\n",
+ "Requirement already satisfied: wrapt<2.0.0,>=1.0.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation==0.47b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.16.0)\r\n",
+ "Requirement already satisfied: asgiref~=3.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from opentelemetry-instrumentation-asgi==0.47b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.8.1)\r\n",
+ "Requirement already satisfied: monotonic>=1.5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from posthog>=2.4.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.6)\r\n",
+ "Requirement already satisfied: backoff>=1.10.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from posthog>=2.4.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.2.1)\r\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic>=1.9->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.7.0)\r\n",
+ "Requirement already satisfied: pydantic-core==2.20.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pydantic>=1.9->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2.20.1)\r\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from requests>=2.28->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.3.2)\r\n",
+ "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from tokenizers>=0.13.2->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.24.5)\r\n",
+ "Requirement already satisfied: click<9.0.0,>=7.1.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from typer>=0.9.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (8.1.7)\r\n",
+ "Requirement already satisfied: httptools>=0.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.6.1)\r\n",
+ "Requirement already satisfied: python-dotenv>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.0.1)\r\n",
+ "Requirement already satisfied: uvloop!=0.15.0,!=0.15.1,>=0.14.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.19.0)\r\n",
+ "Requirement already satisfied: watchfiles>=0.13 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.23.0)\r\n",
+ "Requirement already satisfied: websockets>=10.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from uvicorn[standard]>=0.18.3->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (12.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (5.4.0)\r\n",
+ "Requirement already satisfied: pyasn1-modules>=0.2.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.4.0)\r\n",
+ "Requirement already satisfied: rsa<5,>=3.1.4 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (4.9)\r\n",
+ "Requirement already satisfied: filelock in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.15.4)\r\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (2024.6.1)\r\n",
+ "Requirement already satisfied: zipp>=0.5 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from importlib-metadata<=8.0.0,>=6.0->opentelemetry-api>=1.2.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (3.19.2)\r\n",
+ "Requirement already satisfied: humanfriendly>=9.1 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from coloredlogs->onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (10.0)\r\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from sympy->onnxruntime>=1.14.1->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (1.3.0)\r\n",
+ "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /Users/bagatur/langchain/.venv/lib/python3.11/site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes>=28.1.0->chromadb!=0.5.4,!=0.5.5,<0.6.0,>=0.4.0->langchain_chroma) (0.6.0)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Using cached langchain_openai-0.1.23-py3-none-any.whl (51 kB)\r\n",
+ "Using cached langchain_core-0.2.39-py3-none-any.whl (396 kB)\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Installing collected packages: langchain-core, langchain_openai\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Attempting uninstall: langchain-core\r\n",
+ " Found existing installation: langchain-core 0.3.0.dev5\r\n",
+ " Uninstalling langchain-core-0.3.0.dev5:\r\n",
+ " Successfully uninstalled langchain-core-0.3.0.dev5\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Attempting uninstall: langchain_openai\r\n",
+ " Found existing installation: langchain-openai 0.2.0.dev2\r\n",
+ " Uninstalling langchain-openai-0.2.0.dev2:\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Successfully uninstalled langchain-openai-0.2.0.dev2\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\r\n",
+ "langchain-groq 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-google-genai 2.0.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-benchmarks 0.0.14 requires langchain<0.3.0,>=0.2.7, but you have langchain 0.3.0.dev2 which is incompatible.\r\n",
+ "langchain-benchmarks 0.0.14 requires langchain-community<0.3,>=0.2, but you have langchain-community 0.3.0.dev2 which is incompatible.\r\n",
+ "langchain-anthropic 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-text-splitters 0.3.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev1, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-community 0.3.0.dev2 requires langchain-core<0.4.0,>=0.3.0.dev5, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-mistralai 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-google-vertexai 2.0.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-experimental 0.3.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain 0.3.0.dev2 requires langchain-core<0.4.0,>=0.3.0.dev5, but you have langchain-core 0.2.39 which is incompatible.\r\n",
+ "langchain-ollama 0.2.0.dev1 requires langchain-core<0.4.0,>=0.3.0.dev4, but you have langchain-core 0.2.39 which is incompatible.\u001b[0m\u001b[31m\r\n",
+ "\u001b[0mSuccessfully installed langchain-core-0.2.39 langchain_openai-0.1.23\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install langchain_chroma langchain_openai"
]
@@ -160,7 +465,14 @@
{
"cell_type": "code",
"execution_count": 6,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:22.234408Z",
+ "iopub.status.busy": "2024-09-11T23:58:22.233824Z",
+ "iopub.status.idle": "2024-09-11T23:58:22.237371Z",
+ "shell.execute_reply": "2024-09-11T23:58:22.236977Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -176,8 +488,59 @@
{
"cell_type": "code",
"execution_count": 7,
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:22.239447Z",
+ "iopub.status.busy": "2024-09-11T23:58:22.239323Z",
+ "iopub.status.idle": "2024-09-11T23:58:23.092294Z",
+ "shell.execute_reply": "2024-09-11T23:58:23.091953Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/bagatur/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_config.py:341: UserWarning: Valid config keys have changed in V2:\n",
+ "* 'allow_population_by_field_name' has been renamed to 'populate_by_name'\n",
+ " warnings.warn(message, UserWarning)\n"
+ ]
+ },
+ {
+ "ename": "PydanticUserError",
+ "evalue": "The `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` instead in class `SecretStr`.\n\nFor further information visit https://errors.pydantic.dev/2.8/u/custom-json-schema",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mPydanticUserError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[7], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_chroma\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Chroma\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m OpenAIEmbeddings\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_text_splitters\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RecursiveCharacterTextSplitter\n\u001b[1;32m 5\u001b[0m text_splitter \u001b[38;5;241m=\u001b[39m RecursiveCharacterTextSplitter(chunk_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1000\u001b[39m, chunk_overlap\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m200\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_openai/__init__.py:1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mchat_models\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AzureChatOpenAI, ChatOpenAI\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01membeddings\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AzureOpenAIEmbeddings, OpenAIEmbeddings\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mllms\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AzureOpenAI, OpenAI\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_openai/chat_models/__init__.py:1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mchat_models\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mazure\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AzureChatOpenAI\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mchat_models\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbase\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ChatOpenAI\n\u001b[1;32m 4\u001b[0m __all__ \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mChatOpenAI\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAzureChatOpenAI\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_openai/chat_models/azure.py:41\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_core\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfunction_calling\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m convert_to_openai_tool\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_core\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpydantic\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m is_basemodel_subclass\n\u001b[0;32m---> 41\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mchat_models\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbase\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m BaseChatOpenAI\n\u001b[1;32m 43\u001b[0m logger \u001b[38;5;241m=\u001b[39m logging\u001b[38;5;241m.\u001b[39mgetLogger(\u001b[38;5;18m__name__\u001b[39m)\n\u001b[1;32m 46\u001b[0m _BM \u001b[38;5;241m=\u001b[39m TypeVar(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_BM\u001b[39m\u001b[38;5;124m\"\u001b[39m, bound\u001b[38;5;241m=\u001b[39mBaseModel)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_openai/chat_models/base.py:353\u001b[0m\n\u001b[1;32m 349\u001b[0m parsed: Optional[_DictOrPydantic]\n\u001b[1;32m 350\u001b[0m parsing_error: Optional[\u001b[38;5;167;01mBaseException\u001b[39;00m]\n\u001b[0;32m--> 353\u001b[0m \u001b[38;5;28;43;01mclass\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;21;43;01mBaseChatOpenAI\u001b[39;49;00m\u001b[43m(\u001b[49m\u001b[43mBaseChatModel\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 354\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mAny\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mField\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdefault\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexclude\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m#: :meta private:\u001b[39;49;00m\n\u001b[1;32m 355\u001b[0m \u001b[43m \u001b[49m\u001b[43masync_client\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mAny\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mField\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdefault\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexclude\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m#: :meta private:\u001b[39;49;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py:205\u001b[0m, in \u001b[0;36mModelMetaclass.__new__\u001b[0;34m(mcs, cls_name, bases, namespace, __pydantic_generic_metadata__, __pydantic_reset_parent_namespace__, _create_model_module, **kwargs)\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m config_wrapper\u001b[38;5;241m.\u001b[39mfrozen \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__hash__\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m namespace:\n\u001b[1;32m 203\u001b[0m set_default_hash_func(\u001b[38;5;28mcls\u001b[39m, bases)\n\u001b[0;32m--> 205\u001b[0m \u001b[43mcomplete_model_class\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 206\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[43m \u001b[49m\u001b[43mcls_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig_wrapper\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43mraise_errors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43mtypes_namespace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtypes_namespace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 211\u001b[0m \u001b[43m \u001b[49m\u001b[43mcreate_model_module\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_create_model_module\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 212\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 214\u001b[0m \u001b[38;5;66;03m# If this is placed before the complete_model_class call above,\u001b[39;00m\n\u001b[1;32m 215\u001b[0m \u001b[38;5;66;03m# the generic computed fields return type is set to PydanticUndefined\u001b[39;00m\n\u001b[1;32m 216\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_computed_fields \u001b[38;5;241m=\u001b[39m {k: v\u001b[38;5;241m.\u001b[39minfo \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m__pydantic_decorators__\u001b[38;5;241m.\u001b[39mcomputed_fields\u001b[38;5;241m.\u001b[39mitems()}\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py:534\u001b[0m, in \u001b[0;36mcomplete_model_class\u001b[0;34m(cls, cls_name, config_wrapper, raise_errors, types_namespace, create_model_module)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 533\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 534\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__get_pydantic_core_schema__\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhandler\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 535\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m PydanticUndefinedAnnotation \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 536\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m raise_errors:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/main.py:643\u001b[0m, in \u001b[0;36mBaseModel.__get_pydantic_core_schema__\u001b[0;34m(cls, source, handler)\u001b[0m\n\u001b[1;32m 640\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m__pydantic_generic_metadata__[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124morigin\u001b[39m\u001b[38;5;124m'\u001b[39m]:\n\u001b[1;32m 641\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m__pydantic_core_schema__\n\u001b[0;32m--> 643\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mhandler\u001b[49m\u001b[43m(\u001b[49m\u001b[43msource\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py:83\u001b[0m, in \u001b[0;36mCallbackGetCoreSchemaHandler.__call__\u001b[0;34m(self, source_type)\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, source_type: Any, \u001b[38;5;241m/\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mCoreSchema:\n\u001b[0;32m---> 83\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_handler\u001b[49m\u001b[43m(\u001b[49m\u001b[43msource_type\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 84\u001b[0m ref \u001b[38;5;241m=\u001b[39m schema\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mref\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ref_mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mto-def\u001b[39m\u001b[38;5;124m'\u001b[39m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:512\u001b[0m, in \u001b[0;36mGenerateSchema.generate_schema\u001b[0;34m(self, obj, from_dunder_get_core_schema)\u001b[0m\n\u001b[1;32m 509\u001b[0m schema \u001b[38;5;241m=\u001b[39m from_property\n\u001b[1;32m 511\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m schema \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 512\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_schema_inner\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 514\u001b[0m metadata_js_function \u001b[38;5;241m=\u001b[39m _extract_get_pydantic_json_schema(obj, schema)\n\u001b[1;32m 515\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m metadata_js_function \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:784\u001b[0m, in \u001b[0;36mGenerateSchema._generate_schema_inner\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 782\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m lenient_issubclass(obj, BaseModel):\n\u001b[1;32m 783\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_type_stack\u001b[38;5;241m.\u001b[39mpush(obj):\n\u001b[0;32m--> 784\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_model_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 786\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, PydanticRecursiveRef):\n\u001b[1;32m 787\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m core_schema\u001b[38;5;241m.\u001b[39mdefinition_reference_schema(schema_ref\u001b[38;5;241m=\u001b[39mobj\u001b[38;5;241m.\u001b[39mtype_ref)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:591\u001b[0m, in \u001b[0;36mGenerateSchema._model_schema\u001b[0;34m(self, cls)\u001b[0m\n\u001b[1;32m 579\u001b[0m model_schema \u001b[38;5;241m=\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mmodel_schema(\n\u001b[1;32m 580\u001b[0m \u001b[38;5;28mcls\u001b[39m,\n\u001b[1;32m 581\u001b[0m inner_schema,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 587\u001b[0m metadata\u001b[38;5;241m=\u001b[39mmetadata,\n\u001b[1;32m 588\u001b[0m )\n\u001b[1;32m 589\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 590\u001b[0m fields_schema: core_schema\u001b[38;5;241m.\u001b[39mCoreSchema \u001b[38;5;241m=\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mmodel_fields_schema(\n\u001b[0;32m--> 591\u001b[0m \u001b[43m{\u001b[49m\u001b[43mk\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_md_field_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecorators\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m}\u001b[49m,\n\u001b[1;32m 592\u001b[0m computed_fields\u001b[38;5;241m=\u001b[39m[\n\u001b[1;32m 593\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_computed_field_schema(d, decorators\u001b[38;5;241m.\u001b[39mfield_serializers)\n\u001b[1;32m 594\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m d \u001b[38;5;129;01min\u001b[39;00m computed_fields\u001b[38;5;241m.\u001b[39mvalues()\n\u001b[1;32m 595\u001b[0m ],\n\u001b[1;32m 596\u001b[0m extras_schema\u001b[38;5;241m=\u001b[39mextras_schema,\n\u001b[1;32m 597\u001b[0m model_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m,\n\u001b[1;32m 598\u001b[0m )\n\u001b[1;32m 599\u001b[0m inner_schema \u001b[38;5;241m=\u001b[39m apply_validators(fields_schema, decorators\u001b[38;5;241m.\u001b[39mroot_validators\u001b[38;5;241m.\u001b[39mvalues(), \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 600\u001b[0m new_inner_schema \u001b[38;5;241m=\u001b[39m define_expected_missing_refs(inner_schema, recursively_defined_type_refs())\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:591\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 579\u001b[0m model_schema \u001b[38;5;241m=\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mmodel_schema(\n\u001b[1;32m 580\u001b[0m \u001b[38;5;28mcls\u001b[39m,\n\u001b[1;32m 581\u001b[0m inner_schema,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 587\u001b[0m metadata\u001b[38;5;241m=\u001b[39mmetadata,\n\u001b[1;32m 588\u001b[0m )\n\u001b[1;32m 589\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 590\u001b[0m fields_schema: core_schema\u001b[38;5;241m.\u001b[39mCoreSchema \u001b[38;5;241m=\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mmodel_fields_schema(\n\u001b[0;32m--> 591\u001b[0m {k: \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_md_field_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mk\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mv\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecorators\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m fields\u001b[38;5;241m.\u001b[39mitems()},\n\u001b[1;32m 592\u001b[0m computed_fields\u001b[38;5;241m=\u001b[39m[\n\u001b[1;32m 593\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_computed_field_schema(d, decorators\u001b[38;5;241m.\u001b[39mfield_serializers)\n\u001b[1;32m 594\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m d \u001b[38;5;129;01min\u001b[39;00m computed_fields\u001b[38;5;241m.\u001b[39mvalues()\n\u001b[1;32m 595\u001b[0m ],\n\u001b[1;32m 596\u001b[0m extras_schema\u001b[38;5;241m=\u001b[39mextras_schema,\n\u001b[1;32m 597\u001b[0m model_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m,\n\u001b[1;32m 598\u001b[0m )\n\u001b[1;32m 599\u001b[0m inner_schema \u001b[38;5;241m=\u001b[39m apply_validators(fields_schema, decorators\u001b[38;5;241m.\u001b[39mroot_validators\u001b[38;5;241m.\u001b[39mvalues(), \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 600\u001b[0m new_inner_schema \u001b[38;5;241m=\u001b[39m define_expected_missing_refs(inner_schema, recursively_defined_type_refs())\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:947\u001b[0m, in \u001b[0;36mGenerateSchema._generate_md_field_schema\u001b[0;34m(self, name, field_info, decorators)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_generate_md_field_schema\u001b[39m(\n\u001b[1;32m 941\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 942\u001b[0m name: \u001b[38;5;28mstr\u001b[39m,\n\u001b[1;32m 943\u001b[0m field_info: FieldInfo,\n\u001b[1;32m 944\u001b[0m decorators: DecoratorInfos,\n\u001b[1;32m 945\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mModelField:\n\u001b[1;32m 946\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Prepare a ModelField to represent a model field.\"\"\"\u001b[39;00m\n\u001b[0;32m--> 947\u001b[0m common_field \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_common_field_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfield_info\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecorators\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 948\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m core_schema\u001b[38;5;241m.\u001b[39mmodel_field(\n\u001b[1;32m 949\u001b[0m common_field[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mschema\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 950\u001b[0m serialization_exclude\u001b[38;5;241m=\u001b[39mcommon_field[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mserialization_exclude\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 954\u001b[0m metadata\u001b[38;5;241m=\u001b[39mcommon_field[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmetadata\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 955\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1134\u001b[0m, in \u001b[0;36mGenerateSchema._common_field_schema\u001b[0;34m(self, name, field_info, decorators)\u001b[0m\n\u001b[1;32m 1132\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_apply_annotations(source_type, annotations, transform_inner_schema\u001b[38;5;241m=\u001b[39mset_discriminator)\n\u001b[1;32m 1133\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1134\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_apply_annotations\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1135\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1136\u001b[0m \u001b[43m \u001b[49m\u001b[43mannotations\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1137\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1139\u001b[0m \u001b[38;5;66;03m# This V1 compatibility shim should eventually be removed\u001b[39;00m\n\u001b[1;32m 1140\u001b[0m \u001b[38;5;66;03m# push down any `each_item=True` validators\u001b[39;00m\n\u001b[1;32m 1141\u001b[0m \u001b[38;5;66;03m# note that this won't work for any Annotated types that get wrapped by a function validator\u001b[39;00m\n\u001b[1;32m 1142\u001b[0m \u001b[38;5;66;03m# but that's okay because that didn't exist in V1\u001b[39;00m\n\u001b[1;32m 1143\u001b[0m this_field_validators \u001b[38;5;241m=\u001b[39m filter_field_decorator_info_by_field(decorators\u001b[38;5;241m.\u001b[39mvalidators\u001b[38;5;241m.\u001b[39mvalues(), name)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1890\u001b[0m, in \u001b[0;36mGenerateSchema._apply_annotations\u001b[0;34m(self, source_type, annotations, transform_inner_schema)\u001b[0m\n\u001b[1;32m 1885\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m 1886\u001b[0m get_inner_schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_wrapped_inner_schema(\n\u001b[1;32m 1887\u001b[0m get_inner_schema, annotation, pydantic_js_annotation_functions\n\u001b[1;32m 1888\u001b[0m )\n\u001b[0;32m-> 1890\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[43mget_inner_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43msource_type\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1891\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m pydantic_js_annotation_functions:\n\u001b[1;32m 1892\u001b[0m metadata \u001b[38;5;241m=\u001b[39m CoreMetadataHandler(schema)\u001b[38;5;241m.\u001b[39mmetadata\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py:83\u001b[0m, in \u001b[0;36mCallbackGetCoreSchemaHandler.__call__\u001b[0;34m(self, source_type)\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, source_type: Any, \u001b[38;5;241m/\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m core_schema\u001b[38;5;241m.\u001b[39mCoreSchema:\n\u001b[0;32m---> 83\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_handler\u001b[49m\u001b[43m(\u001b[49m\u001b[43msource_type\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 84\u001b[0m ref \u001b[38;5;241m=\u001b[39m schema\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mref\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ref_mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mto-def\u001b[39m\u001b[38;5;124m'\u001b[39m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1871\u001b[0m, in \u001b[0;36mGenerateSchema._apply_annotations..inner_handler\u001b[0;34m(obj)\u001b[0m\n\u001b[1;32m 1869\u001b[0m from_property \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_generate_schema_from_property(obj, source_type)\n\u001b[1;32m 1870\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m from_property \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 1871\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_generate_schema_inner\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1872\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1873\u001b[0m schema \u001b[38;5;241m=\u001b[39m from_property\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:789\u001b[0m, in \u001b[0;36mGenerateSchema._generate_schema_inner\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 786\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, PydanticRecursiveRef):\n\u001b[1;32m 787\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m core_schema\u001b[38;5;241m.\u001b[39mdefinition_reference_schema(schema_ref\u001b[38;5;241m=\u001b[39mobj\u001b[38;5;241m.\u001b[39mtype_ref)\n\u001b[0;32m--> 789\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmatch_type\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:871\u001b[0m, in \u001b[0;36mGenerateSchema.match_type\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 869\u001b[0m origin \u001b[38;5;241m=\u001b[39m get_origin(obj)\n\u001b[1;32m 870\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m origin \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 871\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_match_generic_type\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43morigin\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 873\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_arbitrary_types:\n\u001b[1;32m 874\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_arbitrary_type_schema(obj)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:895\u001b[0m, in \u001b[0;36mGenerateSchema._match_generic_type\u001b[0;34m(self, obj, origin)\u001b[0m\n\u001b[1;32m 892\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m from_property\n\u001b[1;32m 894\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m _typing_extra\u001b[38;5;241m.\u001b[39morigin_is_union(origin):\n\u001b[0;32m--> 895\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_union_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 896\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m origin \u001b[38;5;129;01min\u001b[39;00m TUPLE_TYPES:\n\u001b[1;32m 897\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_tuple_schema(obj)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1207\u001b[0m, in \u001b[0;36mGenerateSchema._union_schema\u001b[0;34m(self, union_type)\u001b[0m\n\u001b[1;32m 1205\u001b[0m nullable \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 1206\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1207\u001b[0m choices\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerate_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43marg\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 1209\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(choices) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 1210\u001b[0m s \u001b[38;5;241m=\u001b[39m choices[\u001b[38;5;241m0\u001b[39m]\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:514\u001b[0m, in \u001b[0;36mGenerateSchema.generate_schema\u001b[0;34m(self, obj, from_dunder_get_core_schema)\u001b[0m\n\u001b[1;32m 511\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m schema \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 512\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_generate_schema_inner(obj)\n\u001b[0;32m--> 514\u001b[0m metadata_js_function \u001b[38;5;241m=\u001b[39m \u001b[43m_extract_get_pydantic_json_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 515\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m metadata_js_function \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 516\u001b[0m metadata_schema \u001b[38;5;241m=\u001b[39m resolve_original_schema(schema, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefs\u001b[38;5;241m.\u001b[39mdefinitions)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2227\u001b[0m, in \u001b[0;36m_extract_get_pydantic_json_schema\u001b[0;34m(tp, schema)\u001b[0m\n\u001b[1;32m 2225\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m has_custom_v2_modify_js_func:\n\u001b[1;32m 2226\u001b[0m cls_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(tp, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__name__\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[0;32m-> 2227\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m PydanticUserError(\n\u001b[1;32m 2228\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mThe `__modify_schema__` method is not supported in Pydantic v2. \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 2229\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUse `__get_pydantic_json_schema__` instead\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m in class `\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcls_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m`\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mif\u001b[39;00m\u001b[38;5;250m \u001b[39mcls_name\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01melse\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 2230\u001b[0m code\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcustom-json-schema\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 2231\u001b[0m )\n\u001b[1;32m 2233\u001b[0m \u001b[38;5;66;03m# handle GenericAlias' but ignore Annotated which \"lies\" about its origin (in this case it would be `int`)\u001b[39;00m\n\u001b[1;32m 2234\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(tp, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__origin__\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(tp, \u001b[38;5;28mtype\u001b[39m(Annotated[\u001b[38;5;28mint\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mplaceholder\u001b[39m\u001b[38;5;124m'\u001b[39m])):\n",
+ "\u001b[0;31mPydanticUserError\u001b[0m: The `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` instead in class `SecretStr`.\n\nFor further information visit https://errors.pydantic.dev/2.8/u/custom-json-schema"
+ ]
+ }
+ ],
"source": [
"from langchain_chroma import Chroma\n",
"from langchain_openai import OpenAIEmbeddings\n",
@@ -200,22 +563,25 @@
{
"cell_type": "code",
"execution_count": 8,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:23.093892Z",
+ "iopub.status.busy": "2024-09-11T23:58:23.093784Z",
+ "iopub.status.idle": "2024-09-11T23:58:23.128150Z",
+ "shell.execute_reply": "2024-09-11T23:58:23.127927Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "{'input': \"What was Nike's revenue in 2023?\",\n",
- " 'context': [Document(page_content='Table of Contents\\nFISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS\\nThe following tables present NIKE Brand revenues disaggregated by reportable operating segment, distribution channel and major product line:\\nFISCAL 2023 COMPARED TO FISCAL 2022\\n•NIKE, Inc. Revenues were $51.2 billion in fiscal 2023, which increased 10% and 16% compared to fiscal 2022 on a reported and currency-neutral basis, respectively.\\nThe increase was due to higher revenues in North America, Europe, Middle East & Africa (\"EMEA\"), APLA and Greater China, which contributed approximately 7, 6,\\n2 and 1 percentage points to NIKE, Inc. Revenues, respectively.\\n•NIKE Brand revenues, which represented over 90% of NIKE, Inc. Revenues, increased 10% and 16% on a reported and currency-neutral basis, respectively. This\\nincrease was primarily due to higher revenues in Men\\'s, the Jordan Brand, Women\\'s and Kids\\' which grew 17%, 35%,11% and 10%, respectively, on a wholesale\\nequivalent basis.', metadata={'page': 35, 'source': '../example_data/nke-10k-2023.pdf'}),\n",
- " Document(page_content='Enterprise Resource Planning Platform, data and analytics, demand sensing, insight gathering, and other areas to create an end-to-end technology foundation, which we\\nbelieve will further accelerate our digital transformation. We believe this unified approach will accelerate growth and unlock more efficiency for our business, while driving\\nspeed and responsiveness as we serve consumers globally.\\nFINANCIAL HIGHLIGHTS\\n•In fiscal 2023, NIKE, Inc. achieved record Revenues of $51.2 billion, which increased 10% and 16% on a reported and currency-neutral basis, respectively\\n•NIKE Direct revenues grew 14% from $18.7 billion in fiscal 2022 to $21.3 billion in fiscal 2023, and represented approximately 44% of total NIKE Brand revenues for\\nfiscal 2023\\n•Gross margin for the fiscal year decreased 250 basis points to 43.5% primarily driven by higher product costs, higher markdowns and unfavorable changes in foreign\\ncurrency exchange rates, partially offset by strategic pricing actions', metadata={'page': 30, 'source': '../example_data/nke-10k-2023.pdf'}),\n",
- " Document(page_content=\"Table of Contents\\nNORTH AMERICA\\n(Dollars in millions) FISCAL 2023FISCAL 2022 % CHANGE% CHANGE\\nEXCLUDING\\nCURRENCY\\nCHANGESFISCAL 2021 % CHANGE% CHANGE\\nEXCLUDING\\nCURRENCY\\nCHANGES\\nRevenues by:\\nFootwear $ 14,897 $ 12,228 22 % 22 %$ 11,644 5 % 5 %\\nApparel 5,947 5,492 8 % 9 % 5,028 9 % 9 %\\nEquipment 764 633 21 % 21 % 507 25 % 25 %\\nTOTAL REVENUES $ 21,608 $ 18,353 18 % 18 %$ 17,179 7 % 7 %\\nRevenues by: \\nSales to Wholesale Customers $ 11,273 $ 9,621 17 % 18 %$ 10,186 -6 % -6 %\\nSales through NIKE Direct 10,335 8,732 18 % 18 % 6,993 25 % 25 %\\nTOTAL REVENUES $ 21,608 $ 18,353 18 % 18 %$ 17,179 7 % 7 %\\nEARNINGS BEFORE INTEREST AND TAXES $ 5,454 $ 5,114 7 % $ 5,089 0 %\\nFISCAL 2023 COMPARED TO FISCAL 2022\\n•North America revenues increased 18% on a currency-neutral basis, primarily due to higher revenues in Men's and the Jordan Brand. NIKE Direct revenues\\nincreased 18%, driven by strong digital sales growth of 23%, comparable store sales growth of 9% and the addition of new stores.\", metadata={'page': 39, 'source': '../example_data/nke-10k-2023.pdf'}),\n",
- " Document(page_content=\"Table of Contents\\nEUROPE, MIDDLE EAST & AFRICA\\n(Dollars in millions) FISCAL 2023FISCAL 2022 % CHANGE% CHANGE\\nEXCLUDING\\nCURRENCY\\nCHANGESFISCAL 2021 % CHANGE% CHANGE\\nEXCLUDING\\nCURRENCY\\nCHANGES\\nRevenues by:\\nFootwear $ 8,260 $ 7,388 12 % 25 %$ 6,970 6 % 9 %\\nApparel 4,566 4,527 1 % 14 % 3,996 13 % 16 %\\nEquipment 592 564 5 % 18 % 490 15 % 17 %\\nTOTAL REVENUES $ 13,418 $ 12,479 8 % 21 %$ 11,456 9 % 12 %\\nRevenues by: \\nSales to Wholesale Customers $ 8,522 $ 8,377 2 % 15 %$ 7,812 7 % 10 %\\nSales through NIKE Direct 4,896 4,102 19 % 33 % 3,644 13 % 15 %\\nTOTAL REVENUES $ 13,418 $ 12,479 8 % 21 %$ 11,456 9 % 12 %\\nEARNINGS BEFORE INTEREST AND TAXES $ 3,531 $ 3,293 7 % $ 2,435 35 % \\nFISCAL 2023 COMPARED TO FISCAL 2022\\n•EMEA revenues increased 21% on a currency-neutral basis, due to higher revenues in Men's, the Jordan Brand, Women's and Kids'. NIKE Direct revenues\\nincreased 33%, driven primarily by strong digital sales growth of 43% and comparable store sales growth of 22%.\", metadata={'page': 40, 'source': '../example_data/nke-10k-2023.pdf'})],\n",
- " 'answer': 'According to the financial highlights, Nike, Inc. achieved record revenues of $51.2 billion in fiscal 2023, which increased 10% on a reported basis and 16% on a currency-neutral basis compared to fiscal 2022.'}"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'retriever' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[8], line 24\u001b[0m\n\u001b[1;32m 15\u001b[0m prompt \u001b[38;5;241m=\u001b[39m ChatPromptTemplate\u001b[38;5;241m.\u001b[39mfrom_messages(\n\u001b[1;32m 16\u001b[0m [\n\u001b[1;32m 17\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msystem\u001b[39m\u001b[38;5;124m\"\u001b[39m, system_prompt),\n\u001b[1;32m 18\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhuman\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{input}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 19\u001b[0m ]\n\u001b[1;32m 20\u001b[0m )\n\u001b[1;32m 23\u001b[0m question_answer_chain \u001b[38;5;241m=\u001b[39m create_stuff_documents_chain(llm, prompt)\n\u001b[0;32m---> 24\u001b[0m rag_chain \u001b[38;5;241m=\u001b[39m create_retrieval_chain(\u001b[43mretriever\u001b[49m, question_answer_chain)\n\u001b[1;32m 26\u001b[0m results \u001b[38;5;241m=\u001b[39m rag_chain\u001b[38;5;241m.\u001b[39minvoke({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minput\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat was Nike\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms revenue in 2023?\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n\u001b[1;32m 28\u001b[0m results\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'retriever' is not defined"
+ ]
}
],
"source": [
@@ -261,22 +627,24 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:23.129435Z",
+ "iopub.status.busy": "2024-09-11T23:58:23.129366Z",
+ "iopub.status.idle": "2024-09-11T23:58:23.135173Z",
+ "shell.execute_reply": "2024-09-11T23:58:23.134952Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Table of Contents\n",
- "FISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS\n",
- "The following tables present NIKE Brand revenues disaggregated by reportable operating segment, distribution channel and major product line:\n",
- "FISCAL 2023 COMPARED TO FISCAL 2022\n",
- "•NIKE, Inc. Revenues were $51.2 billion in fiscal 2023, which increased 10% and 16% compared to fiscal 2022 on a reported and currency-neutral basis, respectively.\n",
- "The increase was due to higher revenues in North America, Europe, Middle East & Africa (\"EMEA\"), APLA and Greater China, which contributed approximately 7, 6,\n",
- "2 and 1 percentage points to NIKE, Inc. Revenues, respectively.\n",
- "•NIKE Brand revenues, which represented over 90% of NIKE, Inc. Revenues, increased 10% and 16% on a reported and currency-neutral basis, respectively. This\n",
- "increase was primarily due to higher revenues in Men's, the Jordan Brand, Women's and Kids' which grew 17%, 35%,11% and 10%, respectively, on a wholesale\n",
- "equivalent basis.\n"
+ "ename": "NameError",
+ "evalue": "name 'results' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mresults\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontext\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mpage_content)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'results' is not defined"
]
}
],
@@ -287,13 +655,24 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:23.136420Z",
+ "iopub.status.busy": "2024-09-11T23:58:23.136341Z",
+ "iopub.status.idle": "2024-09-11T23:58:23.142105Z",
+ "shell.execute_reply": "2024-09-11T23:58:23.141897Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "{'page': 35, 'source': '../example_data/nke-10k-2023.pdf'}\n"
+ "ename": "NameError",
+ "evalue": "name 'results' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mresults\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontext\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mmetadata)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'results' is not defined"
]
}
],
@@ -345,7 +724,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.5"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/qa_chat_history.ipynb b/docs/docs/tutorials/qa_chat_history.ipynb
index bfdfee6b51f..a5290071c7f 100644
--- a/docs/docs/tutorials/qa_chat_history.ipynb
+++ b/docs/docs/tutorials/qa_chat_history.ipynb
@@ -61,7 +61,14 @@
"cell_type": "code",
"execution_count": 1,
"id": "ede7fdc0-ef31-483d-bd67-32e4b5c5d527",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:24.268853Z",
+ "iopub.status.busy": "2024-09-11T23:58:24.268486Z",
+ "iopub.status.idle": "2024-09-11T23:58:32.415179Z",
+ "shell.execute_reply": "2024-09-11T23:58:32.414323Z"
+ }
+ },
"outputs": [],
"source": [
"%%capture --no-stderr\n",
@@ -80,7 +87,14 @@
"cell_type": "code",
"execution_count": 2,
"id": "143787ca-d8e6-4dc9-8281-4374f4d71720",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:32.418089Z",
+ "iopub.status.busy": "2024-09-11T23:58:32.417897Z",
+ "iopub.status.idle": "2024-09-11T23:58:32.421560Z",
+ "shell.execute_reply": "2024-09-11T23:58:32.421149Z"
+ }
+ },
"outputs": [],
"source": [
"import getpass\n",
@@ -110,7 +124,14 @@
"cell_type": "code",
"execution_count": 3,
"id": "07411adb-3722-4f65-ab7f-8f6f57663d11",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:32.423611Z",
+ "iopub.status.busy": "2024-09-11T23:58:32.423490Z",
+ "iopub.status.idle": "2024-09-11T23:58:32.425945Z",
+ "shell.execute_reply": "2024-09-11T23:58:32.425673Z"
+ }
+ },
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
@@ -144,7 +165,14 @@
"cell_type": "code",
"execution_count": 4,
"id": "cb58f273-2111-4a9b-8932-9b64c95030c8",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:32.427735Z",
+ "iopub.status.busy": "2024-09-11T23:58:32.427526Z",
+ "iopub.status.idle": "2024-09-11T23:58:32.877677Z",
+ "shell.execute_reply": "2024-09-11T23:58:32.877379Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -157,10 +185,25 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 5,
"id": "820244ae-74b4-4593-b392-822979dd91b8",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:32.879381Z",
+ "iopub.status.busy": "2024-09-11T23:58:32.879264Z",
+ "iopub.status.idle": "2024-09-11T23:58:34.981232Z",
+ "shell.execute_reply": "2024-09-11T23:58:34.980781Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "USER_AGENT environment variable not set, consider setting it to identify your requests.\n"
+ ]
+ }
+ ],
"source": [
"import bs4\n",
"from langchain import hub\n",
@@ -213,17 +256,24 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 6,
"id": "bf55faaf-0d17-4b74-925d-c478b555f7b2",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:34.984038Z",
+ "iopub.status.busy": "2024-09-11T23:58:34.983892Z",
+ "iopub.status.idle": "2024-09-11T23:58:36.442971Z",
+ "shell.execute_reply": "2024-09-11T23:58:36.442307Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "\"Task decomposition involves breaking down complex tasks into smaller and simpler steps to make them more manageable for an agent or model. This process helps in guiding the agent through the various subgoals required to achieve the overall task efficiently. Different techniques like Chain of Thought and Tree of Thoughts can be used to decompose tasks into step-by-step processes, enhancing performance and understanding of the model's thinking process.\""
+ "'Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. This process helps agents or models handle intricate tasks more effectively by dividing them into manageable subtasks. Different methods like Chain of Thought and Tree of Thoughts are employed to decompose tasks into multiple steps for easier execution.'"
]
},
- "execution_count": 7,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -285,9 +335,16 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 7,
"id": "2b685428-8b82-4af1-be4f-7232c5d55b73",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:36.447228Z",
+ "iopub.status.busy": "2024-09-11T23:58:36.446869Z",
+ "iopub.status.idle": "2024-09-11T23:58:36.453929Z",
+ "shell.execute_reply": "2024-09-11T23:58:36.453208Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain.chains import create_history_aware_retriever\n",
@@ -329,9 +386,16 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 8,
"id": "66f275f3-ddef-4678-b90d-ee64576878f9",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:36.456805Z",
+ "iopub.status.busy": "2024-09-11T23:58:36.456562Z",
+ "iopub.status.idle": "2024-09-11T23:58:36.461328Z",
+ "shell.execute_reply": "2024-09-11T23:58:36.460478Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain.chains import create_retrieval_chain\n",
@@ -361,15 +425,22 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 9,
"id": "0005810b-1b95-4666-a795-08d80e478b83",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:36.463812Z",
+ "iopub.status.busy": "2024-09-11T23:58:36.463640Z",
+ "iopub.status.idle": "2024-09-11T23:58:40.159715Z",
+ "shell.execute_reply": "2024-09-11T23:58:40.158954Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Task decomposition can be achieved through various methods such as using techniques like Chain of Thought (CoT) or Tree of Thoughts to break down complex tasks into smaller steps. Common ways include prompting the model with simple instructions like \"Steps for XYZ\" or task-specific instructions like \"Write a story outline.\" Human inputs can also be used to guide the task decomposition process effectively.\n"
+ "Task decomposition can be achieved through various methods such as using Language Model (LLM) with simple prompting, providing task-specific instructions, or incorporating human inputs. These approaches help in breaking down complex tasks into smaller components, making it easier for agents or models to understand and execute the overall task effectively. By utilizing these common ways of task decomposition, the complexity of tasks can be reduced, leading to improved performance and problem-solving capabilities.\n"
]
}
],
@@ -428,9 +499,16 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 10,
"id": "9c3fb176-8d6a-4dc7-8408-6a22c5f7cc72",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:40.163211Z",
+ "iopub.status.busy": "2024-09-11T23:58:40.162868Z",
+ "iopub.status.idle": "2024-09-11T23:58:40.173111Z",
+ "shell.execute_reply": "2024-09-11T23:58:40.172413Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_community.chat_message_histories import ChatMessageHistory\n",
@@ -457,17 +535,24 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 11,
"id": "1046c92f-21b3-4214-907d-92878d8cba23",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:40.177182Z",
+ "iopub.status.busy": "2024-09-11T23:58:40.176865Z",
+ "iopub.status.idle": "2024-09-11T23:58:41.394784Z",
+ "shell.execute_reply": "2024-09-11T23:58:41.394524Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Task decomposition involves breaking down complex tasks into smaller and simpler steps to make them more manageable. Techniques like Chain of Thought (CoT) and Tree of Thoughts help models decompose hard tasks into multiple manageable subtasks. This process allows agents to plan ahead and tackle intricate tasks effectively.'"
+ "'Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. This process helps agents or models handle difficult tasks by dividing them into more manageable subtasks. Different methods like Chain of Thought and Tree of Thoughts are used to decompose tasks into multiple steps for easier execution.'"
]
},
- "execution_count": 12,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -483,17 +568,24 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 12,
"id": "0e89c75f-7ad7-4331-a2fe-57579eb8f840",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:41.396255Z",
+ "iopub.status.busy": "2024-09-11T23:58:41.396150Z",
+ "iopub.status.idle": "2024-09-11T23:58:43.463256Z",
+ "shell.execute_reply": "2024-09-11T23:58:43.462343Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Task decomposition can be achieved through various methods such as using Language Model (LLM) with simple prompting, task-specific instructions tailored to the specific task at hand, or incorporating human inputs to break down the task into smaller components. These approaches help in guiding agents to think step by step and decompose complex tasks into more manageable subgoals.'"
+ "'Task decomposition can be achieved through various methods such as using prompting techniques like \"Steps for XYZ\" with LLMs, providing task-specific instructions like \"Write a story outline,\" or incorporating human inputs. These approaches help break down complex tasks into smaller, more manageable subgoals for better understanding and execution.'"
]
},
- "execution_count": 13,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -515,9 +607,16 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 13,
"id": "7686b874-3a85-499f-82b5-28a85c4c768c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:43.469693Z",
+ "iopub.status.busy": "2024-09-11T23:58:43.469253Z",
+ "iopub.status.idle": "2024-09-11T23:58:43.476774Z",
+ "shell.execute_reply": "2024-09-11T23:58:43.475012Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -525,11 +624,11 @@
"text": [
"User: What is Task Decomposition?\n",
"\n",
- "AI: Task decomposition involves breaking down complex tasks into smaller and simpler steps to make them more manageable. Techniques like Chain of Thought (CoT) and Tree of Thoughts help models decompose hard tasks into multiple manageable subtasks. This process allows agents to plan ahead and tackle intricate tasks effectively.\n",
+ "AI: Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. This process helps agents or models handle difficult tasks by dividing them into more manageable subtasks. Different methods like Chain of Thought and Tree of Thoughts are used to decompose tasks into multiple steps for easier execution.\n",
"\n",
"User: What are common ways of doing it?\n",
"\n",
- "AI: Task decomposition can be achieved through various methods such as using Language Model (LLM) with simple prompting, task-specific instructions tailored to the specific task at hand, or incorporating human inputs to break down the task into smaller components. These approaches help in guiding agents to think step by step and decompose complex tasks into more manageable subgoals.\n",
+ "AI: Task decomposition can be achieved through various methods such as using prompting techniques like \"Steps for XYZ\" with LLMs, providing task-specific instructions like \"Write a story outline,\" or incorporating human inputs. These approaches help break down complex tasks into smaller, more manageable subgoals for better understanding and execution.\n",
"\n"
]
}
@@ -564,9 +663,16 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 14,
"id": "71c32048-1a41-465f-a9e2-c4affc332fd9",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:43.483953Z",
+ "iopub.status.busy": "2024-09-11T23:58:43.483364Z",
+ "iopub.status.idle": "2024-09-11T23:58:45.119752Z",
+ "shell.execute_reply": "2024-09-11T23:58:45.119396Z"
+ }
+ },
"outputs": [],
"source": [
"import bs4\n",
@@ -664,17 +770,24 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 15,
"id": "6d0a7a73-d151-47d9-9e99-b4f3291c0322",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:45.121809Z",
+ "iopub.status.busy": "2024-09-11T23:58:45.121682Z",
+ "iopub.status.idle": "2024-09-11T23:58:46.495282Z",
+ "shell.execute_reply": "2024-09-11T23:58:46.494737Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. It involves transforming big tasks into multiple manageable tasks to facilitate problem-solving. Different methods like Chain of Thought and Tree of Thoughts can be employed to decompose tasks effectively.'"
+ "'Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. It involves transforming big tasks into multiple manageable tasks to facilitate problem-solving. This process can be done using prompting techniques like Chain of Thought or Tree of Thoughts, which guide models or agents to think step by step and explore multiple reasoning possibilities at each step.'"
]
},
- "execution_count": 16,
+ "execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@@ -690,17 +803,24 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 16,
"id": "17021822-896a-4513-a17d-1d20b1c5381c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:46.499151Z",
+ "iopub.status.busy": "2024-09-11T23:58:46.498799Z",
+ "iopub.status.idle": "2024-09-11T23:58:48.358891Z",
+ "shell.execute_reply": "2024-09-11T23:58:48.358114Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Task decomposition can be achieved through various methods such as using prompting techniques like \"Steps for XYZ\" or \"What are the subgoals for achieving XYZ?\", providing task-specific instructions like \"Write a story outline,\" or incorporating human inputs to break down complex tasks into smaller components. These approaches help in organizing thoughts and planning ahead for successful task completion.'"
+ "'Task decomposition can be achieved through various methods, such as using prompting techniques like Chain of Thought or Tree of Thoughts to guide models or agents to break down complex tasks into smaller steps. Additionally, task decomposition can be done by providing task-specific instructions, such as asking for a story outline when writing a novel. Human inputs can also be used to decompose tasks into more manageable components.'"
]
},
- "execution_count": 17,
+ "execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -731,9 +851,16 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 17,
"id": "809cc747-2135-40a2-8e73-e4556343ee64",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:48.363276Z",
+ "iopub.status.busy": "2024-09-11T23:58:48.362962Z",
+ "iopub.status.idle": "2024-09-11T23:58:48.372424Z",
+ "shell.execute_reply": "2024-09-11T23:58:48.371834Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain.tools.retriever import create_retriever_tool\n",
@@ -756,9 +883,16 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 18,
"id": "931c4fe3-c603-4efb-9b37-5f7cbbb1cbbd",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:48.376037Z",
+ "iopub.status.busy": "2024-09-11T23:58:48.375766Z",
+ "iopub.status.idle": "2024-09-11T23:58:48.633110Z",
+ "shell.execute_reply": "2024-09-11T23:58:48.632228Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -766,7 +900,7 @@
"'Tree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.'"
]
},
- "execution_count": 19,
+ "execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@@ -788,9 +922,16 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 19,
"id": "1726d151-4653-4c72-a187-a14840add526",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:48.639525Z",
+ "iopub.status.busy": "2024-09-11T23:58:48.638971Z",
+ "iopub.status.idle": "2024-09-11T23:58:48.687183Z",
+ "shell.execute_reply": "2024-09-11T23:58:48.686527Z"
+ }
+ },
"outputs": [],
"source": [
"from langgraph.prebuilt import create_react_agent\n",
@@ -808,26 +949,22 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 20,
"id": "170403a2-c914-41db-85d8-a2c381da112d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:48.690592Z",
+ "iopub.status.busy": "2024-09-11T23:58:48.690346Z",
+ "iopub.status.idle": "2024-09-11T23:58:49.709925Z",
+ "shell.execute_reply": "2024-09-11T23:58:49.709126Z"
+ }
+ },
"outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Error in LangChainTracer.on_tool_end callback: TracerException(\"Found chain run at ID 1a50f4da-34a7-44af-8cbb-c67c90c9619e, but expected {'tool'} run.\")\n"
- ]
- },
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_1ZkTWsLYIlKZ1uMyIQGUuyJx', 'function': {'arguments': '{\"query\":\"Task Decomposition\"}', 'name': 'blog_post_retriever'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 68, 'total_tokens': 87}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-dddbe2d2-2355-4ca5-9961-1ceb39d78cf9-0', tool_calls=[{'name': 'blog_post_retriever', 'args': {'query': 'Task Decomposition'}, 'id': 'call_1ZkTWsLYIlKZ1uMyIQGUuyJx'}])]}}\n",
- "----\n",
- "{'tools': {'messages': [ToolMessage(content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.', name='blog_post_retriever', tool_call_id='call_1ZkTWsLYIlKZ1uMyIQGUuyJx')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. This approach helps in managing and solving difficult tasks by dividing them into more manageable components. One common method of task decomposition is the Chain of Thought (CoT) technique, where models are instructed to think step by step to decompose hard tasks into smaller steps. Another extension of CoT is the Tree of Thoughts, which explores multiple reasoning possibilities at each step and generates multiple thoughts per step, creating a tree structure. Task decomposition can be facilitated by using simple prompts, task-specific instructions, or human inputs.', response_metadata={'token_usage': {'completion_tokens': 119, 'prompt_tokens': 636, 'total_tokens': 755}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-4a701854-97f2-4ec2-b6e1-73410911fa72-0')]}}\n",
+ "{'agent': {'messages': [AIMessage(content='Task decomposition is a problem-solving strategy that involves breaking down a complex task or problem into smaller, more manageable subtasks. By decomposing a task, individuals can better understand the components of the task, allocate resources effectively, and tackle each subtask sequentially to achieve the overall goal.\\n\\nWould you like me to provide more information on task decomposition from the Autonomous Agents blog post?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 75, 'prompt_tokens': 68, 'total_tokens': 143}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-69feb405-bc2c-4892-9586-2701890984ab-0', usage_metadata={'input_tokens': 68, 'output_tokens': 75, 'total_tokens': 143})]}}\n",
"----\n"
]
}
@@ -852,9 +989,16 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 21,
"id": "04a3a664-3c3f-4cd1-9995-26662a52da7c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:49.713360Z",
+ "iopub.status.busy": "2024-09-11T23:58:49.713095Z",
+ "iopub.status.idle": "2024-09-11T23:58:49.723517Z",
+ "shell.execute_reply": "2024-09-11T23:58:49.722677Z"
+ }
+ },
"outputs": [],
"source": [
"from langgraph.checkpoint.memory import MemorySaver\n",
@@ -876,15 +1020,22 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 22,
"id": "d6d70833-b958-4cd7-9e27-29c1c08bb1b8",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:49.727334Z",
+ "iopub.status.busy": "2024-09-11T23:58:49.727009Z",
+ "iopub.status.idle": "2024-09-11T23:58:50.193909Z",
+ "shell.execute_reply": "2024-09-11T23:58:50.193372Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='Hello Bob! How can I assist you today?', response_metadata={'token_usage': {'completion_tokens': 11, 'prompt_tokens': 67, 'total_tokens': 78}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-022806f0-eb26-4c87-9132-ed2fcc6c21ea-0')]}}\n",
+ "{'agent': {'messages': [AIMessage(content='Hello Bob! How can I assist you today?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 11, 'prompt_tokens': 67, 'total_tokens': 78}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-ae4257fc-733a-4a19-bafa-cedb134519f6-0', usage_metadata={'input_tokens': 67, 'output_tokens': 11, 'total_tokens': 78})]}}\n",
"----\n"
]
}
@@ -909,30 +1060,38 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 23,
"id": "e2c570ae-dd91-402c-8693-ae746de63b16",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:50.197161Z",
+ "iopub.status.busy": "2024-09-11T23:58:50.196716Z",
+ "iopub.status.idle": "2024-09-11T23:58:53.203088Z",
+ "shell.execute_reply": "2024-09-11T23:58:53.202518Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_DdAAJJgGIQOZQgKVE4duDyML', 'function': {'arguments': '{\"query\":\"Task Decomposition\"}', 'name': 'blog_post_retriever'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 91, 'total_tokens': 110}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-acc3c903-4f6f-48dd-8b36-f6f3b80d0856-0', tool_calls=[{'name': 'blog_post_retriever', 'args': {'query': 'Task Decomposition'}, 'id': 'call_DdAAJJgGIQOZQgKVE4duDyML'}])]}}\n",
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_bEkfiA1MMMhoeEuvWDipVvNY', 'function': {'arguments': '{\"query\":\"Task Decomposition\"}', 'name': 'blog_post_retriever'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 19, 'prompt_tokens': 91, 'total_tokens': 110}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-a9a56ae8-a5c1-43af-91f2-559b90d7d18f-0', tool_calls=[{'name': 'blog_post_retriever', 'args': {'query': 'Task Decomposition'}, 'id': 'call_bEkfiA1MMMhoeEuvWDipVvNY', 'type': 'tool_call'}], usage_metadata={'input_tokens': 91, 'output_tokens': 19, 'total_tokens': 110})]}}\n",
"----\n"
]
},
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "Error in LangChainTracer.on_tool_end callback: TracerException(\"Found chain run at ID 9a7ba580-ec91-412d-9649-1b5cbf5ae7bc, but expected {'tool'} run.\")\n"
- ]
- },
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'tools': {'messages': [ToolMessage(content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.', name='blog_post_retriever', tool_call_id='call_DdAAJJgGIQOZQgKVE4duDyML')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.', name='blog_post_retriever', tool_call_id='call_bEkfiA1MMMhoeEuvWDipVvNY')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='Task decomposition is a technique used to break down complex tasks into smaller and simpler steps. This approach helps in managing and solving difficult problems by dividing them into more manageable components. One common method for task decomposition is the Chain of Thought (CoT) technique, where models are instructed to think step by step to decompose hard tasks into smaller steps. Another extension of CoT is the Tree of Thoughts, which explores multiple reasoning possibilities at each step and generates multiple thoughts per step, creating a tree structure.\\n\\nTask decomposition can be facilitated by using language models with simple prompting, task-specific instructions, or human inputs. By breaking down tasks into smaller components, agents can better understand the steps involved and plan ahead effectively.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 142, 'prompt_tokens': 659, 'total_tokens': 801}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-693733ec-cc1b-4bf5-8aa4-e2c64bec02d5-0', usage_metadata={'input_tokens': 659, 'output_tokens': 142, 'total_tokens': 801})]}}\n",
"----\n"
]
}
@@ -959,19 +1118,32 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 24,
"id": "570d8c68-136e-4ba5-969a-03ba195f6118",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:53.206768Z",
+ "iopub.status.busy": "2024-09-11T23:58:53.206415Z",
+ "iopub.status.idle": "2024-09-11T23:58:56.347386Z",
+ "shell.execute_reply": "2024-09-11T23:58:56.346450Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_KvoiamnLfGEzMeEMlV3u0TJ7', 'function': {'arguments': '{\"query\":\"common ways of task decomposition\"}', 'name': 'blog_post_retriever'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 930, 'total_tokens': 951}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-dd842071-6dbd-4b68-8657-892eaca58638-0', tool_calls=[{'name': 'blog_post_retriever', 'args': {'query': 'common ways of task decomposition'}, 'id': 'call_KvoiamnLfGEzMeEMlV3u0TJ7'}])]}}\n",
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_GqJ4neqn2JzNPtiOl54YeU2X', 'function': {'arguments': '{\"query\":\"Common ways of task decomposition\"}', 'name': 'blog_post_retriever'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 824, 'total_tokens': 845}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-29812cca-07a0-4021-ad9b-8bdf99e5952b-0', tool_calls=[{'name': 'blog_post_retriever', 'args': {'query': 'Common ways of task decomposition'}, 'id': 'call_GqJ4neqn2JzNPtiOl54YeU2X', 'type': 'tool_call'}], usage_metadata={'input_tokens': 824, 'output_tokens': 21, 'total_tokens': 845})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content='Tree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nResources:\\n1. Internet access for searches and information gathering.\\n2. Long Term memory management.\\n3. GPT-3.5 powered Agents for delegation of simple tasks.\\n4. File output.\\n\\nPerformance Evaluation:\\n1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\\n2. Constructively self-criticize your big-picture behavior constantly.\\n3. Reflect on past decisions and strategies to refine your approach.\\n4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\\n\\n(3) Task execution: Expert models execute on the specific tasks and log results.\\nInstruction:\\n\\nWith the input and the inference results, the AI assistant needs to describe the process and results. The previous stages can be formed as - User Input: {{ User Input }}, Task Planning: {{ Tasks }}, Model Selection: {{ Model Assignment }}, Task Execution: {{ Predictions }}. You must first answer the user\\'s request in a straightforward manner. Then describe the task process and show your analysis and model inference results to the user in the first person. If inference results contain a file path, must tell the user the complete file path.', name='blog_post_retriever', id='c749bb8e-c8e0-4fa3-bc11-3e2e0651880b', tool_call_id='call_KvoiamnLfGEzMeEMlV3u0TJ7')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='According to the blog post, common ways of task decomposition include:\\n\\n1. Using language models with simple prompting like \"Steps for XYZ\" or \"What are the subgoals for achieving XYZ?\"\\n2. Utilizing task-specific instructions, for example, using \"Write a story outline\" for writing a novel.\\n3. Involving human inputs in the task decomposition process.\\n\\nThese methods help in breaking down complex tasks into smaller and more manageable steps, facilitating better planning and execution of the overall task.', response_metadata={'token_usage': {'completion_tokens': 100, 'prompt_tokens': 1475, 'total_tokens': 1575}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'stop', 'logprobs': None}, id='run-98b765b3-f1a6-4c9a-ad0f-2db7950b900f-0')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nFig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.\\n\\nTree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.', name='blog_post_retriever', tool_call_id='call_GqJ4neqn2JzNPtiOl54YeU2X')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='According to the blog post, common ways of task decomposition include:\\n\\n1. Using language models with simple prompting, such as providing instructions like \"Steps for XYZ\" or \"What are the subgoals for achieving XYZ?\"\\n2. Utilizing task-specific instructions tailored to the specific task at hand. For example, using instructions like \"Write a story outline\" for tasks like writing a novel.\\n3. Involving human inputs in the task decomposition process to break down complex tasks into smaller and more manageable components.\\n\\nThese methods help in effectively decomposing tasks into smaller steps, making it easier to understand and tackle complex problems.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 124, 'prompt_tokens': 1394, 'total_tokens': 1518}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-60ed528c-4770-47f8-a4ea-194263f0d8bf-0', usage_metadata={'input_tokens': 1394, 'output_tokens': 124, 'total_tokens': 1518})]}}\n",
"----\n"
]
}
@@ -1006,9 +1178,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 25,
"id": "b1d2b4d4-e604-497d-873d-d345b808578e",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:56.351511Z",
+ "iopub.status.busy": "2024-09-11T23:58:56.351255Z",
+ "iopub.status.idle": "2024-09-11T23:58:57.570309Z",
+ "shell.execute_reply": "2024-09-11T23:58:57.569954Z"
+ }
+ },
"outputs": [],
"source": [
"import bs4\n",
@@ -1097,7 +1276,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.2"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/query_analysis.ipynb b/docs/docs/tutorials/query_analysis.ipynb
index 9433bbd1958..6f8671e8d1c 100644
--- a/docs/docs/tutorials/query_analysis.ipynb
+++ b/docs/docs/tutorials/query_analysis.ipynb
@@ -47,7 +47,14 @@
"cell_type": "code",
"execution_count": 1,
"id": "e168ef5c-e54e-49a6-8552-5502854a6f01",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.234162Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.233914Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.240399Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.239820Z"
+ }
+ },
"outputs": [],
"source": [
"# %pip install -qU langchain langchain-community langchain-openai youtube-transcript-api pytube langchain-chroma"
@@ -65,10 +72,30 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 2,
"id": "40e2979e-a818-4b96-ac25-039336f94319",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.245135Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.244787Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.392334Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.392036Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "StdinNotImplementedError",
+ "evalue": "getpass was called, but this frontend does not support input requests.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mStdinNotImplementedError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[2], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgetpass\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOPENAI_API_KEY\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mgetpass\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetpass\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# Optional, uncomment to trace runs with LangSmith. Sign up here: https://smith.langchain.com.\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;66;03m# os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass()\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/ipykernel/kernelbase.py:1256\u001b[0m, in \u001b[0;36mKernel.getpass\u001b[0;34m(self, prompt, stream)\u001b[0m\n\u001b[1;32m 1254\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_allow_stdin:\n\u001b[1;32m 1255\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgetpass was called, but this frontend does not support input requests.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 1256\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m StdinNotImplementedError(msg)\n\u001b[1;32m 1257\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m stream \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mwarnings\u001b[39;00m\n",
+ "\u001b[0;31mStdinNotImplementedError\u001b[0m: getpass was called, but this frontend does not support input requests."
+ ]
+ }
+ ],
"source": [
"import getpass\n",
"import os\n",
@@ -92,10 +119,34 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 3,
"id": "ae6921e1-3d5a-431c-9999-29a5f33201e1",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.393933Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.393835Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.687072Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.686803Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "ImportError",
+ "evalue": "Could not import \"youtube_transcript_api\" Python package. Please install it with `pip install youtube-transcript-api`.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/document_loaders/youtube.py:244\u001b[0m, in \u001b[0;36mYoutubeLoader.load\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 243\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 244\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01myoutube_transcript_api\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 245\u001b[0m NoTranscriptFound,\n\u001b[1;32m 246\u001b[0m TranscriptsDisabled,\n\u001b[1;32m 247\u001b[0m YouTubeTranscriptApi,\n\u001b[1;32m 248\u001b[0m )\n\u001b[1;32m 249\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m:\n",
+ "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'youtube_transcript_api'",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[3], line 20\u001b[0m\n\u001b[1;32m 18\u001b[0m docs \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m url \u001b[38;5;129;01min\u001b[39;00m urls:\n\u001b[0;32m---> 20\u001b[0m docs\u001b[38;5;241m.\u001b[39mextend(\u001b[43mYoutubeLoader\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_youtube_url\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43madd_video_info\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/document_loaders/youtube.py:250\u001b[0m, in \u001b[0;36mYoutubeLoader.load\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01myoutube_transcript_api\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 245\u001b[0m NoTranscriptFound,\n\u001b[1;32m 246\u001b[0m TranscriptsDisabled,\n\u001b[1;32m 247\u001b[0m YouTubeTranscriptApi,\n\u001b[1;32m 248\u001b[0m )\n\u001b[1;32m 249\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m:\n\u001b[0;32m--> 250\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[1;32m 251\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mCould not import \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myoutube_transcript_api\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m Python package. \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPlease install it with `pip install youtube-transcript-api`.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 253\u001b[0m )\n\u001b[1;32m 255\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madd_video_info:\n\u001b[1;32m 256\u001b[0m \u001b[38;5;66;03m# Get more video meta info\u001b[39;00m\n\u001b[1;32m 257\u001b[0m \u001b[38;5;66;03m# Such as title, description, thumbnail url, publish_date\u001b[39;00m\n\u001b[1;32m 258\u001b[0m video_info \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_video_info()\n",
+ "\u001b[0;31mImportError\u001b[0m: Could not import \"youtube_transcript_api\" Python package. Please install it with `pip install youtube-transcript-api`."
+ ]
+ }
+ ],
"source": [
"from langchain_community.document_loaders import YoutubeLoader\n",
"\n",
@@ -121,9 +172,16 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 4,
"id": "2b84918e",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.688464Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.688385Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.690349Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.690112Z"
+ }
+ },
"outputs": [],
"source": [
"import datetime\n",
@@ -147,29 +205,24 @@
},
{
"cell_type": "code",
- "execution_count": 59,
+ "execution_count": 5,
"id": "3e1a99ee-1078-4373-b80a-630af48bf94a",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.691938Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.691823Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.694571Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.694377Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "['OpenGPTs',\n",
- " 'Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve',\n",
- " 'Streaming Events: Introducing a new `stream_events` method',\n",
- " 'LangGraph: Multi-Agent Workflows',\n",
- " 'Build and Deploy a RAG app with Pinecone Serverless',\n",
- " 'Auto-Prompt Builder (with Hosted LangServe)',\n",
- " 'Build a Full Stack RAG App With TypeScript',\n",
- " 'Getting Started with Multi-Modal LLMs',\n",
- " 'SQL Research Assistant',\n",
- " 'Skeleton-of-Thought: Building a New Template from Scratch',\n",
- " 'Benchmarking RAG over LangChain Docs',\n",
- " 'Building a Research Assistant from Scratch',\n",
- " 'LangServe and LangChain Templates Webinar']"
+ "[]"
]
},
- "execution_count": 59,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -188,27 +241,27 @@
},
{
"cell_type": "code",
- "execution_count": 60,
+ "execution_count": 6,
"id": "c7748415-ddbf-4c55-a242-c28833c03caf",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.695826Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.695730Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.702253Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.702039Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "{'source': 'HAn9vnJy6S4',\n",
- " 'title': 'OpenGPTs',\n",
- " 'description': 'Unknown',\n",
- " 'view_count': 7210,\n",
- " 'thumbnail_url': 'https://i.ytimg.com/vi/HAn9vnJy6S4/hq720.jpg',\n",
- " 'publish_date': '2024-01-31 00:00:00',\n",
- " 'length': 1530,\n",
- " 'author': 'LangChain',\n",
- " 'publish_year': 2024}"
- ]
- },
- "execution_count": 60,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "IndexError",
+ "evalue": "list index out of range",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdocs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241m.\u001b[39mmetadata\n",
+ "\u001b[0;31mIndexError\u001b[0m: list index out of range"
+ ]
}
],
"source": [
@@ -225,19 +278,27 @@
},
{
"cell_type": "code",
- "execution_count": 61,
+ "execution_count": 7,
"id": "845149b7-130e-4228-ac80-d0a9286ef1d3",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.703429Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.703349Z",
+ "iopub.status.idle": "2024-09-11T23:58:59.708907Z",
+ "shell.execute_reply": "2024-09-11T23:58:59.708691Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "\"hello today I want to talk about open gpts open gpts is a project that we built here at linkchain uh that replicates the GPT store in a few ways so it creates uh end user-facing friendly interface to create different Bots and these Bots can have access to different tools and they can uh be given files to retrieve things over and basically it's a way to create a variety of bots and expose the configuration of these Bots to end users it's all open source um it can be used with open AI it can be us\""
- ]
- },
- "execution_count": 61,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "IndexError",
+ "evalue": "list index out of range",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdocs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241m.\u001b[39mpage_content[:\u001b[38;5;241m500\u001b[39m]\n",
+ "\u001b[0;31mIndexError\u001b[0m: list index out of range"
+ ]
}
],
"source": [
@@ -256,10 +317,36 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 8,
"id": "1f621694",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:58:59.710145Z",
+ "iopub.status.busy": "2024-09-11T23:58:59.710081Z",
+ "iopub.status.idle": "2024-09-11T23:59:00.767901Z",
+ "shell.execute_reply": "2024-09-11T23:59:00.767543Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "ValueError",
+ "evalue": "Expected IDs to be a non-empty list, got 0 IDs",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[8], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m chunked_docs \u001b[38;5;241m=\u001b[39m text_splitter\u001b[38;5;241m.\u001b[39msplit_documents(docs)\n\u001b[1;32m 7\u001b[0m embeddings \u001b[38;5;241m=\u001b[39m OpenAIEmbeddings(model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext-embedding-3-small\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 8\u001b[0m vectorstore \u001b[38;5;241m=\u001b[39m \u001b[43mChroma\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_documents\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked_docs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 10\u001b[0m \u001b[43m \u001b[49m\u001b[43membeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 11\u001b[0m \u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:1128\u001b[0m, in \u001b[0;36mChroma.from_documents\u001b[0;34m(cls, documents, embedding, ids, collection_name, persist_directory, client_settings, client, collection_metadata, **kwargs)\u001b[0m\n\u001b[1;32m 1126\u001b[0m texts \u001b[38;5;241m=\u001b[39m [doc\u001b[38;5;241m.\u001b[39mpage_content \u001b[38;5;28;01mfor\u001b[39;00m doc \u001b[38;5;129;01min\u001b[39;00m documents]\n\u001b[1;32m 1127\u001b[0m metadatas \u001b[38;5;241m=\u001b[39m [doc\u001b[38;5;241m.\u001b[39mmetadata \u001b[38;5;28;01mfor\u001b[39;00m doc \u001b[38;5;129;01min\u001b[39;00m documents]\n\u001b[0;32m-> 1128\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_texts\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1129\u001b[0m \u001b[43m \u001b[49m\u001b[43mtexts\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtexts\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1130\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43membedding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1131\u001b[0m \u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1132\u001b[0m \u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1133\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1134\u001b[0m \u001b[43m \u001b[49m\u001b[43mpersist_directory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpersist_directory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1135\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient_settings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient_settings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1136\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1137\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_metadata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_metadata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1138\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1139\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:1089\u001b[0m, in \u001b[0;36mChroma.from_texts\u001b[0;34m(cls, texts, embedding, metadatas, ids, collection_name, persist_directory, client_settings, client, collection_metadata, **kwargs)\u001b[0m\n\u001b[1;32m 1083\u001b[0m chroma_collection\u001b[38;5;241m.\u001b[39madd_texts(\n\u001b[1;32m 1084\u001b[0m texts\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m3\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m batch[\u001b[38;5;241m3\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m [],\n\u001b[1;32m 1085\u001b[0m metadatas\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m batch[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 1086\u001b[0m ids\u001b[38;5;241m=\u001b[39mbatch[\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 1087\u001b[0m )\n\u001b[1;32m 1088\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1089\u001b[0m \u001b[43mchroma_collection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_texts\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtexts\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtexts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mids\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1090\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m chroma_collection\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_chroma/vectorstores.py:557\u001b[0m, in \u001b[0;36mChroma.add_texts\u001b[0;34m(self, texts, metadatas, ids, **kwargs)\u001b[0m\n\u001b[1;32m 551\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_collection\u001b[38;5;241m.\u001b[39mupsert(\n\u001b[1;32m 552\u001b[0m embeddings\u001b[38;5;241m=\u001b[39membeddings_without_metadatas, \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 553\u001b[0m documents\u001b[38;5;241m=\u001b[39mtexts_without_metadatas,\n\u001b[1;32m 554\u001b[0m ids\u001b[38;5;241m=\u001b[39mids_without_metadatas,\n\u001b[1;32m 555\u001b[0m )\n\u001b[1;32m 556\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 557\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_collection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupsert\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 558\u001b[0m \u001b[43m \u001b[49m\u001b[43membeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43membeddings\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore\u001b[39;49;00m\n\u001b[1;32m 559\u001b[0m \u001b[43m \u001b[49m\u001b[43mdocuments\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtexts\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 560\u001b[0m \u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 561\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 562\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ids\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/chromadb/api/models/Collection.py:296\u001b[0m, in \u001b[0;36mCollection.upsert\u001b[0;34m(self, ids, embeddings, metadatas, documents, images, uris)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupsert\u001b[39m(\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 267\u001b[0m ids: OneOrMany[ID],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 277\u001b[0m uris: Optional[OneOrMany[URI]] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 278\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 279\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Update the embeddings, metadatas or documents for provided ids, or create them if they don't exist.\u001b[39;00m\n\u001b[1;32m 280\u001b[0m \n\u001b[1;32m 281\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 288\u001b[0m \u001b[38;5;124;03m None\u001b[39;00m\n\u001b[1;32m 289\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m 290\u001b[0m (\n\u001b[1;32m 291\u001b[0m ids,\n\u001b[1;32m 292\u001b[0m embeddings,\n\u001b[1;32m 293\u001b[0m metadatas,\n\u001b[1;32m 294\u001b[0m documents,\n\u001b[1;32m 295\u001b[0m uris,\n\u001b[0;32m--> 296\u001b[0m ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_and_prepare_upsert_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 297\u001b[0m \u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43membeddings\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdocuments\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mimages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muris\u001b[49m\n\u001b[1;32m 298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 300\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39m_upsert(\n\u001b[1;32m 301\u001b[0m collection_id\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mid,\n\u001b[1;32m 302\u001b[0m ids\u001b[38;5;241m=\u001b[39mids,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 306\u001b[0m uris\u001b[38;5;241m=\u001b[39muris,\n\u001b[1;32m 307\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/chromadb/api/models/CollectionCommon.py:515\u001b[0m, in \u001b[0;36mCollectionCommon._validate_and_prepare_upsert_request\u001b[0;34m(self, ids, embeddings, metadatas, documents, images, uris)\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_validate_and_prepare_upsert_request\u001b[39m(\n\u001b[1;32m 489\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 490\u001b[0m ids: OneOrMany[ID],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 506\u001b[0m Optional[URIs],\n\u001b[1;32m 507\u001b[0m ]:\n\u001b[1;32m 508\u001b[0m (\n\u001b[1;32m 509\u001b[0m ids,\n\u001b[1;32m 510\u001b[0m embeddings,\n\u001b[1;32m 511\u001b[0m metadatas,\n\u001b[1;32m 512\u001b[0m documents,\n\u001b[1;32m 513\u001b[0m images,\n\u001b[1;32m 514\u001b[0m uris,\n\u001b[0;32m--> 515\u001b[0m ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_embedding_set\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[43m \u001b[49m\u001b[43mids\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43membeddings\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadatas\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdocuments\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mimages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muris\u001b[49m\n\u001b[1;32m 517\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 519\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m embeddings \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 520\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m documents \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/chromadb/api/models/CollectionCommon.py:163\u001b[0m, in \u001b[0;36mCollectionCommon._validate_embedding_set\u001b[0;34m(self, ids, embeddings, metadatas, documents, images, uris, require_embeddings_or_data)\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_validate_embedding_set\u001b[39m(\n\u001b[1;32m 142\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 143\u001b[0m ids: OneOrMany[ID],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 161\u001b[0m Optional[URIs],\n\u001b[1;32m 162\u001b[0m ]:\n\u001b[0;32m--> 163\u001b[0m valid_ids \u001b[38;5;241m=\u001b[39m \u001b[43mvalidate_ids\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmaybe_cast_one_to_many_ids\u001b[49m\u001b[43m(\u001b[49m\u001b[43mids\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 164\u001b[0m valid_embeddings \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 165\u001b[0m validate_embeddings(\n\u001b[1;32m 166\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_normalize_embeddings(maybe_cast_one_to_many_embedding(embeddings))\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 169\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 170\u001b[0m )\n\u001b[1;32m 171\u001b[0m valid_metadatas \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 172\u001b[0m validate_metadatas(maybe_cast_one_to_many_metadata(metadatas))\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m metadatas \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 174\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 175\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/chromadb/api/types.py:232\u001b[0m, in \u001b[0;36mvalidate_ids\u001b[0;34m(ids)\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpected IDs to be a list, got \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(ids)\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m as IDs\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 231\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(ids) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 232\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpected IDs to be a non-empty list, got \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(ids)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m IDs\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 233\u001b[0m seen \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mset\u001b[39m()\n\u001b[1;32m 234\u001b[0m dups \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mset\u001b[39m()\n",
+ "\u001b[0;31mValueError\u001b[0m: Expected IDs to be a non-empty list, got 0 IDs"
+ ]
+ }
+ ],
"source": [
"from langchain_chroma import Chroma\n",
"from langchain_openai import OpenAIEmbeddings\n",
@@ -286,16 +373,26 @@
},
{
"cell_type": "code",
- "execution_count": 64,
+ "execution_count": 9,
"id": "09435e9b-57b4-41b1-b34a-449815bdfae0",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:00.769428Z",
+ "iopub.status.busy": "2024-09-11T23:59:00.769331Z",
+ "iopub.status.idle": "2024-09-11T23:59:00.776730Z",
+ "shell.execute_reply": "2024-09-11T23:59:00.776467Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Build and Deploy a RAG app with Pinecone Serverless\n",
- "hi this is Lance from the Lang chain team and today we're going to be building and deploying a rag app using pine con serval list from scratch so we're going to kind of walk through all the code required to do this and I'll use these slides as kind of a guide to kind of lay the the ground work um so first what is rag so under capoy has this pretty nice visualization that shows LMS as a kernel of a new kind of operating system and of course one of the core components of our operating system is th\n"
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m search_results \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhow do I build a RAG agent\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(search_results[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mmetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtitle\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(search_results[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mpage_content[:\u001b[38;5;241m500\u001b[39m])\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
]
}
],
@@ -323,17 +420,26 @@
},
{
"cell_type": "code",
- "execution_count": 65,
+ "execution_count": 10,
"id": "7adbfc11-ca01-4883-8978-e4f6e4a1d23d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:00.778082Z",
+ "iopub.status.busy": "2024-09-11T23:59:00.777994Z",
+ "iopub.status.idle": "2024-09-11T23:59:00.784849Z",
+ "shell.execute_reply": "2024-09-11T23:59:00.784588Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "OpenGPTs\n",
- "2024-01-31\n",
- "hardcoded that it will always do a retrieval step here the assistant decides whether to do a retrieval step or not sometimes this is good sometimes this is bad sometimes it you don't need to do a retrieval step when I said hi it didn't need to call it tool um but other times you know the the llm might mess up and not realize that it needs to do a retrieval step and so the rag bot will always do a retrieval step so it's more focused there because this is also a simpler architecture so it's always\n"
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m search_results \u001b[38;5;241m=\u001b[39m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvideos on RAG published in 2023\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(search_results[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mmetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtitle\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(search_results[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mmetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpublish_date\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
]
}
],
@@ -369,9 +475,16 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 11,
"id": "0b51dd76-820d-41a4-98c8-893f6fe0d1ea",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:00.786107Z",
+ "iopub.status.busy": "2024-09-11T23:59:00.786020Z",
+ "iopub.status.idle": "2024-09-11T23:59:00.788315Z",
+ "shell.execute_reply": "2024-09-11T23:59:00.788109Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import Optional\n",
@@ -401,19 +514,17 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 12,
"id": "783c03c3-8c72-4f88-9cf4-5829ce6745d6",
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/Users/bagatur/langchain/libs/core/langchain_core/_api/beta_decorator.py:86: LangChainBetaWarning: The function `with_structured_output` is in beta. It is actively being worked on, so the API may change.\n",
- " warn_beta(\n"
- ]
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:00.789463Z",
+ "iopub.status.busy": "2024-09-11T23:59:00.789378Z",
+ "iopub.status.idle": "2024-09-11T23:59:00.806100Z",
+ "shell.execute_reply": "2024-09-11T23:59:00.805836Z"
}
- ],
+ },
+ "outputs": [],
"source": [
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables import RunnablePassthrough\n",
@@ -445,9 +556,16 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 13,
"id": "bc1d3863",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:00.807485Z",
+ "iopub.status.busy": "2024-09-11T23:59:00.807401Z",
+ "iopub.status.idle": "2024-09-11T23:59:01.587125Z",
+ "shell.execute_reply": "2024-09-11T23:59:01.586812Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -455,7 +573,7 @@
"Search(query='build RAG agent', publish_year=None)"
]
},
- "execution_count": 4,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@@ -466,9 +584,16 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 14,
"id": "af62af17-4f90-4dbd-a8b4-dfff51f1db95",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:01.588732Z",
+ "iopub.status.busy": "2024-09-11T23:59:01.588615Z",
+ "iopub.status.idle": "2024-09-11T23:59:01.996058Z",
+ "shell.execute_reply": "2024-09-11T23:59:01.995251Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -476,7 +601,7 @@
"Search(query='RAG', publish_year=2023)"
]
},
- "execution_count": 5,
+ "execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -499,9 +624,16 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 15,
"id": "1e047d87",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:02.000081Z",
+ "iopub.status.busy": "2024-09-11T23:59:01.999768Z",
+ "iopub.status.idle": "2024-09-11T23:59:02.003267Z",
+ "shell.execute_reply": "2024-09-11T23:59:02.002727Z"
+ }
+ },
"outputs": [],
"source": [
"from typing import List\n",
@@ -513,7 +645,14 @@
"cell_type": "code",
"execution_count": 16,
"id": "8dac7866",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:02.006839Z",
+ "iopub.status.busy": "2024-09-11T23:59:02.006549Z",
+ "iopub.status.idle": "2024-09-11T23:59:02.010942Z",
+ "shell.execute_reply": "2024-09-11T23:59:02.010232Z"
+ }
+ },
"outputs": [],
"source": [
"def retrieval(search: Search) -> List[Document]:\n",
@@ -530,7 +669,14 @@
"cell_type": "code",
"execution_count": 17,
"id": "232ad8a7-7990-4066-9228-d35a555f7293",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:02.014129Z",
+ "iopub.status.busy": "2024-09-11T23:59:02.013861Z",
+ "iopub.status.idle": "2024-09-11T23:59:02.019241Z",
+ "shell.execute_reply": "2024-09-11T23:59:02.018311Z"
+ }
+ },
"outputs": [],
"source": [
"retrieval_chain = query_analyzer | retrieval"
@@ -546,32 +692,63 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 18,
"id": "e7f683b5-b1c5-4dec-b163-2efc162a2b51",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:02.022321Z",
+ "iopub.status.busy": "2024-09-11T23:59:02.022101Z",
+ "iopub.status.idle": "2024-09-11T23:59:02.787698Z",
+ "shell.execute_reply": "2024-09-11T23:59:02.786940Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'vectorstore' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[18], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m results \u001b[38;5;241m=\u001b[39m \u001b[43mretrieval_chain\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minvoke\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mRAG tutorial published in 2023\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/base.py:2878\u001b[0m, in \u001b[0;36mRunnableSequence.invoke\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[38;5;28minput\u001b[39m \u001b[38;5;241m=\u001b[39m context\u001b[38;5;241m.\u001b[39mrun(step\u001b[38;5;241m.\u001b[39minvoke, \u001b[38;5;28minput\u001b[39m, config, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 2877\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 2878\u001b[0m \u001b[38;5;28minput\u001b[39m \u001b[38;5;241m=\u001b[39m context\u001b[38;5;241m.\u001b[39mrun(step\u001b[38;5;241m.\u001b[39minvoke, \u001b[38;5;28minput\u001b[39m, config)\n\u001b[1;32m 2879\u001b[0m \u001b[38;5;66;03m# finish the root run\u001b[39;00m\n\u001b[1;32m 2880\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/base.py:4474\u001b[0m, in \u001b[0;36mRunnableLambda.invoke\u001b[0;34m(self, input, config, **kwargs)\u001b[0m\n\u001b[1;32m 4460\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Invoke this Runnable synchronously.\u001b[39;00m\n\u001b[1;32m 4461\u001b[0m \n\u001b[1;32m 4462\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 4471\u001b[0m \u001b[38;5;124;03m TypeError: If the Runnable is a coroutine function.\u001b[39;00m\n\u001b[1;32m 4472\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 4473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfunc\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m-> 4474\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_with_config\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 4475\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_invoke\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4476\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4477\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_config\u001b[49m\u001b[43m(\u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfunc\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4478\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4479\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4480\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 4481\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\n\u001b[1;32m 4482\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCannot invoke a coroutine function synchronously.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 4483\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUse `ainvoke` instead.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 4484\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/base.py:1785\u001b[0m, in \u001b[0;36mRunnable._call_with_config\u001b[0;34m(self, func, input, config, run_type, serialized, **kwargs)\u001b[0m\n\u001b[1;32m 1781\u001b[0m context \u001b[38;5;241m=\u001b[39m copy_context()\n\u001b[1;32m 1782\u001b[0m context\u001b[38;5;241m.\u001b[39mrun(_set_config_context, child_config)\n\u001b[1;32m 1783\u001b[0m output \u001b[38;5;241m=\u001b[39m cast(\n\u001b[1;32m 1784\u001b[0m Output,\n\u001b[0;32m-> 1785\u001b[0m \u001b[43mcontext\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1786\u001b[0m \u001b[43m \u001b[49m\u001b[43mcall_func_with_variable_args\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1787\u001b[0m \u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1788\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 1789\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1790\u001b[0m \u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1791\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1792\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 1793\u001b[0m )\n\u001b[1;32m 1794\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 1795\u001b[0m run_manager\u001b[38;5;241m.\u001b[39mon_chain_error(e)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/config.py:398\u001b[0m, in \u001b[0;36mcall_func_with_variable_args\u001b[0;34m(func, input, config, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 396\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_manager \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m accepts_run_manager(func):\n\u001b[1;32m 397\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_manager\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m run_manager\n\u001b[0;32m--> 398\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/base.py:4330\u001b[0m, in \u001b[0;36mRunnableLambda._invoke\u001b[0;34m(self, input, run_manager, config, **kwargs)\u001b[0m\n\u001b[1;32m 4328\u001b[0m output \u001b[38;5;241m=\u001b[39m chunk\n\u001b[1;32m 4329\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 4330\u001b[0m output \u001b[38;5;241m=\u001b[39m \u001b[43mcall_func_with_variable_args\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 4331\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrun_manager\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 4332\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4333\u001b[0m \u001b[38;5;66;03m# If the output is a Runnable, invoke it\u001b[39;00m\n\u001b[1;32m 4334\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(output, Runnable):\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_core/runnables/config.py:398\u001b[0m, in \u001b[0;36mcall_func_with_variable_args\u001b[0;34m(func, input, config, run_manager, **kwargs)\u001b[0m\n\u001b[1;32m 396\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m run_manager \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m accepts_run_manager(func):\n\u001b[1;32m 397\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_manager\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m run_manager\n\u001b[0;32m--> 398\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "Cell \u001b[0;32mIn[16], line 8\u001b[0m, in \u001b[0;36mretrieval\u001b[0;34m(search)\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 7\u001b[0m _filter \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mvectorstore\u001b[49m\u001b[38;5;241m.\u001b[39msimilarity_search(search\u001b[38;5;241m.\u001b[39mquery, \u001b[38;5;28mfilter\u001b[39m\u001b[38;5;241m=\u001b[39m_filter)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'vectorstore' is not defined"
+ ]
+ }
+ ],
"source": [
"results = retrieval_chain.invoke(\"RAG tutorial published in 2023\")"
]
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 19,
"id": "1ad52512-b3e8-42a3-8701-d9e87fb8b46c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:02.789336Z",
+ "iopub.status.busy": "2024-09-11T23:59:02.789238Z",
+ "iopub.status.idle": "2024-09-11T23:59:02.796935Z",
+ "shell.execute_reply": "2024-09-11T23:59:02.796678Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "[('Getting Started with Multi-Modal LLMs', '2023-12-20 00:00:00'),\n",
- " ('LangServe and LangChain Templates Webinar', '2023-11-02 00:00:00'),\n",
- " ('Getting Started with Multi-Modal LLMs', '2023-12-20 00:00:00'),\n",
- " ('Building a Research Assistant from Scratch', '2023-11-16 00:00:00')]"
- ]
- },
- "execution_count": 21,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "NameError",
+ "evalue": "name 'results' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[19], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m [(doc\u001b[38;5;241m.\u001b[39mmetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtitle\u001b[39m\u001b[38;5;124m\"\u001b[39m], doc\u001b[38;5;241m.\u001b[39mmetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpublish_date\u001b[39m\u001b[38;5;124m\"\u001b[39m]) \u001b[38;5;28;01mfor\u001b[39;00m doc \u001b[38;5;129;01min\u001b[39;00m \u001b[43mresults\u001b[49m]\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'results' is not defined"
+ ]
}
],
"source": [
@@ -595,7 +772,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/rag.ipynb b/docs/docs/tutorials/rag.ipynb
index f7b93fef437..bc05ed4f11e 100644
--- a/docs/docs/tutorials/rag.ipynb
+++ b/docs/docs/tutorials/rag.ipynb
@@ -124,9 +124,16 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "26ef9d35",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:04.797140Z",
+ "iopub.status.busy": "2024-09-11T23:59:04.796673Z",
+ "iopub.status.idle": "2024-09-11T23:59:05.241970Z",
+ "shell.execute_reply": "2024-09-11T23:59:05.241679Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -141,12 +148,34 @@
"cell_type": "code",
"execution_count": 2,
"id": "6281ec7b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:05.243960Z",
+ "iopub.status.busy": "2024-09-11T23:59:05.243633Z",
+ "iopub.status.idle": "2024-09-11T23:59:12.863473Z",
+ "shell.execute_reply": "2024-09-11T23:59:12.862644Z"
+ }
+ },
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "USER_AGENT environment variable not set, consider setting it to identify your requests.\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/bagatur/langchain/.venv/lib/python3.11/site-packages/langsmith/client.py:5301: LangChainBetaWarning: The function `loads` is in beta. It is actively being worked on, so the API may change.\n",
+ " prompt = loads(json.dumps(prompt_object.manifest))\n"
+ ]
+ },
{
"data": {
"text/plain": [
- "'Task Decomposition is a process where a complex task is broken down into smaller, simpler steps or subtasks. This technique is utilized to enhance model performance on complex tasks by making them more manageable. It can be done by using language models with simple prompting, task-specific instructions, or with human inputs.'"
+ "'Task Decomposition is the process of breaking down complex tasks into smaller, more manageable steps or subtasks. This process can be achieved by using techniques like Chain of Thought (CoT) and Tree of Thoughts, which instruct the model to think step by step, thus simplifying complicated tasks. Task decomposition can be performed by using simple prompting, task-specific instructions, or with human inputs.'"
]
},
"execution_count": 2,
@@ -200,9 +229,16 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 3,
"id": "3d56d203",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:12.866924Z",
+ "iopub.status.busy": "2024-09-11T23:59:12.866650Z",
+ "iopub.status.idle": "2024-09-11T23:59:12.879316Z",
+ "shell.execute_reply": "2024-09-11T23:59:12.878835Z"
+ }
+ },
"outputs": [],
"source": [
"# cleanup\n",
@@ -245,9 +281,16 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 4,
"id": "f5ba0122-8c92-4895-b5ef-f03a634e3fdf",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:12.882295Z",
+ "iopub.status.busy": "2024-09-11T23:59:12.882088Z",
+ "iopub.status.idle": "2024-09-11T23:59:13.484960Z",
+ "shell.execute_reply": "2024-09-11T23:59:13.484675Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -255,7 +298,7 @@
"43131"
]
},
- "execution_count": 3,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -277,9 +320,16 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 5,
"id": "5cf74be6-5f40-4f6d-8689-b6b42ced8b70",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:13.486485Z",
+ "iopub.status.busy": "2024-09-11T23:59:13.486381Z",
+ "iopub.status.idle": "2024-09-11T23:59:13.488448Z",
+ "shell.execute_reply": "2024-09-11T23:59:13.488134Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -348,9 +398,16 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"id": "6aa3f8c0-5113-4c36-9706-ee702407173a",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:13.490112Z",
+ "iopub.status.busy": "2024-09-11T23:59:13.489981Z",
+ "iopub.status.idle": "2024-09-11T23:59:13.493703Z",
+ "shell.execute_reply": "2024-09-11T23:59:13.493394Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -358,7 +415,7 @@
"66"
]
},
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -376,9 +433,16 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 7,
"id": "2257752c-bed2-4d57-be8e-d275bfe70ace",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:13.495100Z",
+ "iopub.status.busy": "2024-09-11T23:59:13.494998Z",
+ "iopub.status.idle": "2024-09-11T23:59:13.497201Z",
+ "shell.execute_reply": "2024-09-11T23:59:13.496959Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -386,7 +450,7 @@
"969"
]
},
- "execution_count": 6,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -397,9 +461,16 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"id": "325fdc48-4a24-4645-9d08-0d22f5be5e13",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:13.498560Z",
+ "iopub.status.busy": "2024-09-11T23:59:13.498469Z",
+ "iopub.status.idle": "2024-09-11T23:59:13.500651Z",
+ "shell.execute_reply": "2024-09-11T23:59:13.500393Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -408,7 +479,7 @@
" 'start_index': 7056}"
]
},
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -460,9 +531,16 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"id": "0b44b41a-8b25-42ad-9e37-7baf82a058cd",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:13.501945Z",
+ "iopub.status.busy": "2024-09-11T23:59:13.501866Z",
+ "iopub.status.idle": "2024-09-11T23:59:15.308003Z",
+ "shell.execute_reply": "2024-09-11T23:59:15.307574Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_chroma import Chroma\n",
@@ -519,9 +597,16 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"id": "1a0d25f8-8a45-4ec7-b419-c36e231fde13",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:15.309699Z",
+ "iopub.status.busy": "2024-09-11T23:59:15.309586Z",
+ "iopub.status.idle": "2024-09-11T23:59:15.928074Z",
+ "shell.execute_reply": "2024-09-11T23:59:15.927275Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -529,7 +614,7 @@
"6"
]
},
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -544,9 +629,16 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 11,
"id": "58db0a6a-f1ad-4d28-acf8-98be9ed3c968",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:15.932001Z",
+ "iopub.status.busy": "2024-09-11T23:59:15.931668Z",
+ "iopub.status.idle": "2024-09-11T23:59:15.935847Z",
+ "shell.execute_reply": "2024-09-11T23:59:15.935240Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -617,9 +709,16 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 12,
"id": "ff01d415-7b0f-469d-bfda-b9cb672da611",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:15.939483Z",
+ "iopub.status.busy": "2024-09-11T23:59:15.939222Z",
+ "iopub.status.idle": "2024-09-11T23:59:16.436701Z",
+ "shell.execute_reply": "2024-09-11T23:59:16.436191Z"
+ }
+ },
"outputs": [
{
"data": {
@@ -627,7 +726,7 @@
"[HumanMessage(content=\"You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.\\nQuestion: filler question \\nContext: filler context \\nAnswer:\")]"
]
},
- "execution_count": 11,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -646,9 +745,16 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 13,
"id": "2885ed99-31a0-4d7e-b9b0-af49c462caf4",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:16.440022Z",
+ "iopub.status.busy": "2024-09-11T23:59:16.439765Z",
+ "iopub.status.idle": "2024-09-11T23:59:16.442915Z",
+ "shell.execute_reply": "2024-09-11T23:59:16.442400Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -682,15 +788,512 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 14,
"id": "d6820cf3-e14d-4275-bd00-aa1b8262b1ae",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:16.446157Z",
+ "iopub.status.busy": "2024-09-11T23:59:16.445941Z",
+ "iopub.status.idle": "2024-09-11T23:59:20.520851Z",
+ "shell.execute_reply": "2024-09-11T23:59:20.520140Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Task Decomposition is a process where a complex task is broken down into smaller, more manageable steps or parts. This is often done using techniques like \"Chain of Thought\" or \"Tree of Thoughts\", which instruct a model to \"think step by step\" and transform large tasks into multiple simple tasks. Task decomposition can be prompted in a model, guided by task-specific instructions, or influenced by human inputs."
+ "Task"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Decom"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "position"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " is"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " a"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " process"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " used"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " in"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " complex"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " tasks"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " where"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " the"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " task"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " is"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " broken"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " down"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " into"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " smaller"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ ","
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " simpler"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " steps"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "."
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " This"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " approach"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " allows"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " for"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " better"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " utilization"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " of"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " test"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "-time"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " computation"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " and"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " provides"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " a"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " clearer"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " understanding"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " of"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " the"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " model"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "'s"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " thinking"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " process"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "."
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Techniques"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " like"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Chain"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " of"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Thought"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " and"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Tree"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " of"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " Thoughts"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " are"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " examples"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " of"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " how"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " task"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " decomposition"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " can"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " be"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " implemented"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ ","
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " transforming"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " larger"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " tasks"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " into"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " multiple"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " manageable"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " ones"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "."
]
}
],
@@ -755,15 +1358,22 @@
},
{
"cell_type": "code",
- "execution_count": 37,
+ "execution_count": 15,
"id": "e75bfe98-d9e4-4868-bae1-5811437d859b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:20.525416Z",
+ "iopub.status.busy": "2024-09-11T23:59:20.524839Z",
+ "iopub.status.idle": "2024-09-11T23:59:59.066464Z",
+ "shell.execute_reply": "2024-09-11T23:59:59.065505Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Task Decomposition is a process in which complex tasks are broken down into smaller and simpler steps. Techniques like Chain of Thought (CoT) and Tree of Thoughts are used to enhance model performance on these tasks. The CoT method instructs the model to think step by step, decomposing hard tasks into manageable ones, while Tree of Thoughts extends CoT by exploring multiple reasoning possibilities at each step, creating a tree structure of thoughts.\n"
+ "Task decomposition is a process where a complex task is broken down into smaller, simpler steps. Techniques such as Chain of Thought (CoT) and Tree of Thoughts are used to decompose hard tasks into manageable tasks. This can be done by a Language Model like GPT-3.5 with simple prompting or task-specific instructions, or with human inputs.\n"
]
}
],
@@ -808,25 +1418,53 @@
},
{
"cell_type": "code",
- "execution_count": 41,
+ "execution_count": 16,
"id": "9d4cec1a-75d6-4479-929f-72cadb2dcde8",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:59.071725Z",
+ "iopub.status.busy": "2024-09-11T23:59:59.071234Z",
+ "iopub.status.idle": "2024-09-11T23:59:59.076092Z",
+ "shell.execute_reply": "2024-09-11T23:59:59.075532Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "page_content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/'}\n",
+ "page_content='Fig. 1. Overview of a LLM-powered autonomous agent system.\n",
+ "Component One: Planning#\n",
+ "A complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\n",
+ "Task Decomposition#\n",
+ "Chain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 1585}\n",
"\n",
- "page_content='Fig. 1. Overview of a LLM-powered autonomous agent system.\\nComponent One: Planning#\\nA complicated task usually involves many steps. An agent needs to know what they are and plan ahead.\\nTask Decomposition#\\nChain of thought (CoT; Wei et al. 2022) has become a standard prompting technique for enhancing model performance on complex tasks. The model is instructed to “think step by step” to utilize more test-time computation to decompose hard tasks into smaller and simpler steps. CoT transforms big tasks into multiple manageable tasks and shed lights into an interpretation of the model’s thinking process.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 1585}\n",
+ "page_content='Tree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\n",
+ "Task decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 2192}\n",
"\n",
- "page_content='Tree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 2192}\n",
+ "page_content='Resources:\n",
+ "1. Internet access for searches and information gathering.\n",
+ "2. Long Term memory management.\n",
+ "3. GPT-3.5 powered Agents for delegation of simple tasks.\n",
+ "4. File output.\n",
"\n",
- "page_content='Tree of Thoughts (Yao et al. 2023) extends CoT by exploring multiple reasoning possibilities at each step. It first decomposes the problem into multiple thought steps and generates multiple thoughts per step, creating a tree structure. The search process can be BFS (breadth-first search) or DFS (depth-first search) with each state evaluated by a classifier (via a prompt) or majority vote.\\nTask decomposition can be done (1) by LLM with simple prompting like \"Steps for XYZ.\\\\n1.\", \"What are the subgoals for achieving XYZ?\", (2) by using task-specific instructions; e.g. \"Write a story outline.\" for writing a novel, or (3) with human inputs.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/'}\n",
+ "Performance Evaluation:\n",
+ "1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\n",
+ "2. Constructively self-criticize your big-picture behavior constantly.\n",
+ "3. Reflect on past decisions and strategies to refine your approach.\n",
+ "4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 29630}\n",
"\n",
- "page_content='Resources:\\n1. Internet access for searches and information gathering.\\n2. Long Term memory management.\\n3. GPT-3.5 powered Agents for delegation of simple tasks.\\n4. File output.\\n\\nPerformance Evaluation:\\n1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\\n2. Constructively self-criticize your big-picture behavior constantly.\\n3. Reflect on past decisions and strategies to refine your approach.\\n4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/'}\n",
+ "page_content='(3) Task execution: Expert models execute on the specific tasks and log results.\n",
+ "Instruction:\n",
"\n",
- "page_content='Resources:\\n1. Internet access for searches and information gathering.\\n2. Long Term memory management.\\n3. GPT-3.5 powered Agents for delegation of simple tasks.\\n4. File output.\\n\\nPerformance Evaluation:\\n1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\\n2. Constructively self-criticize your big-picture behavior constantly.\\n3. Reflect on past decisions and strategies to refine your approach.\\n4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 29630}\n",
+ "With the input and the inference results, the AI assistant needs to describe the process and results. The previous stages can be formed as - User Input: {{ User Input }}, Task Planning: {{ Tasks }}, Model Selection: {{ Model Assignment }}, Task Execution: {{ Predictions }}. You must first answer the user's request in a straightforward manner. Then describe the task process and show your analysis and model inference results to the user in the first person. If inference results contain a file path, must tell the user the complete file path.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 19373}\n",
+ "\n",
+ "page_content='The AI assistant can parse user input to several tasks: [{\"task\": task, \"id\", task_id, \"dep\": dependency_task_ids, \"args\": {\"text\": text, \"image\": URL, \"audio\": URL, \"video\": URL}}]. The \"dep\" field denotes the id of the previous task which generates a new resource that the current task relies on. A special tag \"-task_id\" refers to the generated text image, audio and video in the dependency task with id as task_id. The task MUST be selected from the following options: {{ Available Task List }}. There is a logical relationship between tasks, please note their order. If the user input can't be parsed, you need to reply empty JSON. Here are several cases for your reference: {{ Demonstrations }}. The chat history is recorded as {{ Chat History }}. From this chat history, you can find the path of the user-mentioned resources for your task planning.' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 17804}\n",
+ "\n",
+ "page_content='Fig. 11. Illustration of how HuggingGPT works. (Image source: Shen et al. 2023)\n",
+ "The system comprises of 4 stages:\n",
+ "(1) Task planning: LLM works as the brain and parses the user requests into multiple tasks. There are four attributes associated with each task: task type, ID, dependencies, and arguments. They use few-shot examples to guide LLM to do task parsing and planning.\n",
+ "Instruction:' metadata={'source': 'https://lilianweng.github.io/posts/2023-06-23-agent/', 'start_index': 17414}\n",
"\n"
]
}
@@ -873,12 +1511,19 @@
"cell_type": "code",
"execution_count": 17,
"id": "2ac552b6",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-11T23:59:59.080361Z",
+ "iopub.status.busy": "2024-09-11T23:59:59.079909Z",
+ "iopub.status.idle": "2024-09-12T00:00:03.980566Z",
+ "shell.execute_reply": "2024-09-12T00:00:03.979941Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'Task decomposition is the process of breaking down a complex task into smaller, more manageable parts. Techniques like Chain of Thought (CoT) and Tree of Thoughts allow an agent to \"think step by step\" and explore multiple reasoning possibilities, respectively. This process can be executed by a Language Model with simple prompts, task-specific instructions, or human inputs. Thanks for asking!'"
+ "\"Task Decomposition is a process used by an autonomous agent system to break down complex tasks into smaller, simpler steps. Techniques like Chain of Thought (CoT) and Tree of Thoughts are used for this purpose, transforming big tasks into multiple manageable ones. This not only enhances the model's performance on complex tasks, but also provides insight into the model's thinking process. Thanks for asking!\""
]
},
"execution_count": 17,
@@ -957,7 +1602,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.5"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/retrievers.ipynb b/docs/docs/tutorials/retrievers.ipynb
index 721a20c3334..0ea70e743b3 100644
--- a/docs/docs/tutorials/retrievers.ipynb
+++ b/docs/docs/tutorials/retrievers.ipynb
@@ -85,7 +85,14 @@
"cell_type": "code",
"execution_count": 1,
"id": "9f3dc151-7b2f-4d94-9558-7a84f7eab100",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:07.288634Z",
+ "iopub.status.busy": "2024-09-12T00:00:07.288244Z",
+ "iopub.status.idle": "2024-09-12T00:00:07.580053Z",
+ "shell.execute_reply": "2024-09-12T00:00:07.579782Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.documents import Document\n",
@@ -136,7 +143,14 @@
"cell_type": "code",
"execution_count": 2,
"id": "d48acc28-1a34-414b-8e08-fbdef3a2a60b",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:07.581668Z",
+ "iopub.status.busy": "2024-09-12T00:00:07.581551Z",
+ "iopub.status.idle": "2024-09-12T00:00:08.972748Z",
+ "shell.execute_reply": "2024-09-12T00:00:08.972009Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_chroma import Chroma\n",
@@ -172,15 +186,22 @@
"cell_type": "code",
"execution_count": 3,
"id": "7e01ed91-1a98-4221-960a-bd7a2541a548",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:08.977260Z",
+ "iopub.status.busy": "2024-09-12T00:00:08.976880Z",
+ "iopub.status.idle": "2024-09-12T00:00:09.344322Z",
+ "shell.execute_reply": "2024-09-12T00:00:09.343673Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Dogs are great companions, known for their loyalty and friendliness.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Rabbits are social animals that need plenty of space to hop around.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Parrots are intelligent birds capable of mimicking human speech.', metadata={'source': 'bird-pets-doc'})]"
+ "[Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Dogs are great companions, known for their loyalty and friendliness.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Rabbits are social animals that need plenty of space to hop around.'),\n",
+ " Document(metadata={'source': 'bird-pets-doc'}, page_content='Parrots are intelligent birds capable of mimicking human speech.')]"
]
},
"execution_count": 3,
@@ -204,15 +225,22 @@
"cell_type": "code",
"execution_count": 4,
"id": "618af196-6182-4a7d-8b09-07493fcdc868",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:09.348435Z",
+ "iopub.status.busy": "2024-09-12T00:00:09.348092Z",
+ "iopub.status.idle": "2024-09-12T00:00:09.735255Z",
+ "shell.execute_reply": "2024-09-12T00:00:09.734419Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Dogs are great companions, known for their loyalty and friendliness.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Rabbits are social animals that need plenty of space to hop around.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Parrots are intelligent birds capable of mimicking human speech.', metadata={'source': 'bird-pets-doc'})]"
+ "[Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Dogs are great companions, known for their loyalty and friendliness.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Rabbits are social animals that need plenty of space to hop around.'),\n",
+ " Document(metadata={'source': 'bird-pets-doc'}, page_content='Parrots are intelligent birds capable of mimicking human speech.')]"
]
},
"execution_count": 4,
@@ -236,19 +264,26 @@
"cell_type": "code",
"execution_count": 5,
"id": "4ed24af2-0d82-478c-949b-b389348d4e9f",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:09.739725Z",
+ "iopub.status.busy": "2024-09-12T00:00:09.739365Z",
+ "iopub.status.idle": "2024-09-12T00:00:09.928727Z",
+ "shell.execute_reply": "2024-09-12T00:00:09.928134Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[(Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'}),\n",
- " 0.3751849830150604),\n",
- " (Document(page_content='Dogs are great companions, known for their loyalty and friendliness.', metadata={'source': 'mammal-pets-doc'}),\n",
- " 0.48316916823387146),\n",
- " (Document(page_content='Rabbits are social animals that need plenty of space to hop around.', metadata={'source': 'mammal-pets-doc'}),\n",
- " 0.49601367115974426),\n",
- " (Document(page_content='Parrots are intelligent birds capable of mimicking human speech.', metadata={'source': 'bird-pets-doc'}),\n",
- " 0.4972994923591614)]"
+ "[(Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.'),\n",
+ " 0.37532728910446167),\n",
+ " (Document(metadata={'source': 'mammal-pets-doc'}, page_content='Dogs are great companions, known for their loyalty and friendliness.'),\n",
+ " 0.4833085536956787),\n",
+ " (Document(metadata={'source': 'mammal-pets-doc'}, page_content='Rabbits are social animals that need plenty of space to hop around.'),\n",
+ " 0.49588823318481445),\n",
+ " (Document(metadata={'source': 'bird-pets-doc'}, page_content='Parrots are intelligent birds capable of mimicking human speech.'),\n",
+ " 0.49741730093955994)]"
]
},
"execution_count": 5,
@@ -276,15 +311,22 @@
"cell_type": "code",
"execution_count": 6,
"id": "b1a5eabb-a821-48cc-917e-cc27f03e4bcc",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:09.932087Z",
+ "iopub.status.busy": "2024-09-12T00:00:09.931816Z",
+ "iopub.status.idle": "2024-09-12T00:00:10.262763Z",
+ "shell.execute_reply": "2024-09-12T00:00:10.261688Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Dogs are great companions, known for their loyalty and friendliness.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Rabbits are social animals that need plenty of space to hop around.', metadata={'source': 'mammal-pets-doc'}),\n",
- " Document(page_content='Parrots are intelligent birds capable of mimicking human speech.', metadata={'source': 'bird-pets-doc'})]"
+ "[Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Dogs are great companions, known for their loyalty and friendliness.'),\n",
+ " Document(metadata={'source': 'mammal-pets-doc'}, page_content='Rabbits are social animals that need plenty of space to hop around.'),\n",
+ " Document(metadata={'source': 'bird-pets-doc'}, page_content='Parrots are intelligent birds capable of mimicking human speech.')]"
]
},
"execution_count": 6,
@@ -322,13 +364,20 @@
"cell_type": "code",
"execution_count": 7,
"id": "f1461582-e569-4326-bd95-510f72edf019",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:10.266175Z",
+ "iopub.status.busy": "2024-09-12T00:00:10.265895Z",
+ "iopub.status.idle": "2024-09-12T00:00:10.513072Z",
+ "shell.execute_reply": "2024-09-12T00:00:10.512575Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'})],\n",
- " [Document(page_content='Goldfish are popular pets for beginners, requiring relatively simple care.', metadata={'source': 'fish-pets-doc'})]]"
+ "[[Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.')],\n",
+ " [Document(metadata={'source': 'fish-pets-doc'}, page_content='Goldfish are popular pets for beginners, requiring relatively simple care.')]]"
]
},
"execution_count": 7,
@@ -357,13 +406,20 @@
"cell_type": "code",
"execution_count": 8,
"id": "4989fe5e-ac58-4751-bc35-f53ff885860c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:10.515820Z",
+ "iopub.status.busy": "2024-09-12T00:00:10.515591Z",
+ "iopub.status.idle": "2024-09-12T00:00:10.802173Z",
+ "shell.execute_reply": "2024-09-12T00:00:10.801790Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'})],\n",
- " [Document(page_content='Goldfish are popular pets for beginners, requiring relatively simple care.', metadata={'source': 'fish-pets-doc'})]]"
+ "[[Document(metadata={'source': 'mammal-pets-doc'}, page_content='Cats are independent pets that often enjoy their own space.')],\n",
+ " [Document(metadata={'source': 'fish-pets-doc'}, page_content='Goldfish are popular pets for beginners, requiring relatively simple care.')]]"
]
},
"execution_count": 8,
@@ -400,7 +456,14 @@
"cell_type": "code",
"execution_count": 9,
"id": "c77b68bf-59f3-4416-9877-960f934c374d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:10.804063Z",
+ "iopub.status.busy": "2024-09-12T00:00:10.803940Z",
+ "iopub.status.idle": "2024-09-12T00:00:10.815830Z",
+ "shell.execute_reply": "2024-09-12T00:00:10.815557Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -415,7 +478,14 @@
"cell_type": "code",
"execution_count": 10,
"id": "6f1ae0d0-0b4b-4da0-80ce-f82913052a83",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:10.817295Z",
+ "iopub.status.busy": "2024-09-12T00:00:10.817201Z",
+ "iopub.status.idle": "2024-09-12T00:00:10.819823Z",
+ "shell.execute_reply": "2024-09-12T00:00:10.819488Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.prompts import ChatPromptTemplate\n",
@@ -439,7 +509,14 @@
"cell_type": "code",
"execution_count": 11,
"id": "b3c0d625-61e0-492e-b3a6-c40d383fca03",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:10.821064Z",
+ "iopub.status.busy": "2024-09-12T00:00:10.820975Z",
+ "iopub.status.idle": "2024-09-12T00:00:11.588533Z",
+ "shell.execute_reply": "2024-09-12T00:00:11.587575Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -492,7 +569,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.4"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/sql_qa.ipynb b/docs/docs/tutorials/sql_qa.ipynb
index 726ffa7136b..f5160faeb04 100644
--- a/docs/docs/tutorials/sql_qa.ipynb
+++ b/docs/docs/tutorials/sql_qa.ipynb
@@ -43,8 +43,15 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {},
+ "execution_count": 1,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:13.069361Z",
+ "iopub.status.busy": "2024-09-12T00:00:13.069053Z",
+ "iopub.status.idle": "2024-09-12T00:00:18.257180Z",
+ "shell.execute_reply": "2024-09-12T00:00:18.256300Z"
+ }
+ },
"outputs": [],
"source": [
"%%capture --no-stderr\n",
@@ -60,8 +67,15 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
+ "execution_count": 2,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:18.261499Z",
+ "iopub.status.busy": "2024-09-12T00:00:18.261272Z",
+ "iopub.status.idle": "2024-09-12T00:00:18.265063Z",
+ "shell.execute_reply": "2024-09-12T00:00:18.264528Z"
+ }
+ },
"outputs": [],
"source": [
"import getpass\n",
@@ -92,26 +106,49 @@
},
{
"cell_type": "code",
- "execution_count": 1,
- "metadata": {},
+ "execution_count": 3,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:18.267852Z",
+ "iopub.status.busy": "2024-09-12T00:00:18.267644Z",
+ "iopub.status.idle": "2024-09-12T00:00:18.901662Z",
+ "shell.execute_reply": "2024-09-12T00:00:18.901245Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sqlite\n",
- "['Album', 'Artist', 'Customer', 'Employee', 'Genre', 'Invoice', 'InvoiceLine', 'MediaType', 'Playlist', 'PlaylistTrack', 'Track']\n"
+ "[]\n"
]
},
{
- "data": {
- "text/plain": [
- "\"[(1, 'AC/DC'), (2, 'Accept'), (3, 'Aerosmith'), (4, 'Alanis Morissette'), (5, 'Alice In Chains'), (6, 'Antônio Carlos Jobim'), (7, 'Apocalyptica'), (8, 'Audioslave'), (9, 'BackBeat'), (10, 'Billy Cobham')]\""
- ]
- },
- "execution_count": 1,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "OperationalError",
+ "evalue": "(sqlite3.OperationalError) no such table: Artist\n[SQL: SELECT * FROM Artist LIMIT 10;]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m \u001b[43mcursor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mOperationalError\u001b[0m: no such table: Artist",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[3], line 6\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(db\u001b[38;5;241m.\u001b[39mdialect)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(db\u001b[38;5;241m.\u001b[39mget_usable_table_names())\n\u001b[0;32m----> 6\u001b[0m \u001b[43mdb\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSELECT * FROM Artist LIMIT 10;\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:502\u001b[0m, in \u001b[0;36mSQLDatabase.run\u001b[0;34m(self, command, fetch, include_columns, parameters, execution_options)\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun\u001b[39m(\n\u001b[1;32m 489\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 490\u001b[0m command: Union[\u001b[38;5;28mstr\u001b[39m, Executable],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 495\u001b[0m execution_options: Optional[Dict[\u001b[38;5;28mstr\u001b[39m, Any]] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 496\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[\u001b[38;5;28mstr\u001b[39m, Sequence[Dict[\u001b[38;5;28mstr\u001b[39m, Any]], Result[Any]]:\n\u001b[1;32m 497\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Execute a SQL command and return a string representing the results.\u001b[39;00m\n\u001b[1;32m 498\u001b[0m \n\u001b[1;32m 499\u001b[0m \u001b[38;5;124;03m If the statement returns rows, a string of the results is returned.\u001b[39;00m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;124;03m If the statement returns no rows, an empty string is returned.\u001b[39;00m\n\u001b[1;32m 501\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 502\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 503\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfetch\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 504\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcursor\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 507\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:467\u001b[0m, in \u001b[0;36mSQLDatabase._execute\u001b[0;34m(self, command, fetch, parameters, execution_options)\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mQuery expression has unknown type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(command)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 467\u001b[0m cursor \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 469\u001b[0m \u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 470\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 471\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m cursor\u001b[38;5;241m.\u001b[39mreturns_rows:\n\u001b[1;32m 474\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mall\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1418\u001b[0m, in \u001b[0;36mConnection.execute\u001b[0;34m(self, statement, parameters, execution_options)\u001b[0m\n\u001b[1;32m 1416\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(statement) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m 1417\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1418\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmeth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1419\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1420\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1421\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mNO_OPTIONS\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1422\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:515\u001b[0m, in \u001b[0;36mClauseElement._execute_on_connection\u001b[0;34m(self, connection, distilled_params, execution_options)\u001b[0m\n\u001b[1;32m 513\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m TYPE_CHECKING:\n\u001b[1;32m 514\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, Executable)\n\u001b[0;32m--> 515\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_clauseelement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdistilled_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 517\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 518\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(\u001b[38;5;28mself\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1640\u001b[0m, in \u001b[0;36mConnection._execute_clauseelement\u001b[0;34m(self, elem, distilled_parameters, execution_options)\u001b[0m\n\u001b[1;32m 1628\u001b[0m compiled_cache: Optional[CompiledCacheType] \u001b[38;5;241m=\u001b[39m execution_options\u001b[38;5;241m.\u001b[39mget(\n\u001b[1;32m 1629\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcompiled_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_compiled_cache\n\u001b[1;32m 1630\u001b[0m )\n\u001b[1;32m 1632\u001b[0m compiled_sql, extracted_params, cache_hit \u001b[38;5;241m=\u001b[39m elem\u001b[38;5;241m.\u001b[39m_compile_w_cache(\n\u001b[1;32m 1633\u001b[0m dialect\u001b[38;5;241m=\u001b[39mdialect,\n\u001b[1;32m 1634\u001b[0m compiled_cache\u001b[38;5;241m=\u001b[39mcompiled_cache,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1638\u001b[0m linting\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdialect\u001b[38;5;241m.\u001b[39mcompiler_linting \u001b[38;5;241m|\u001b[39m compiler\u001b[38;5;241m.\u001b[39mWARN_LINTING,\n\u001b[1;32m 1639\u001b[0m )\n\u001b[0;32m-> 1640\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1641\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1642\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecution_ctx_cls\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_init_compiled\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1643\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1644\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1645\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1646\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1647\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1648\u001b[0m \u001b[43m \u001b[49m\u001b[43melem\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1649\u001b[0m \u001b[43m \u001b[49m\u001b[43mextracted_params\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1650\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_hit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_hit\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1651\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1652\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m has_events:\n\u001b[1;32m 1653\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_execute(\n\u001b[1;32m 1654\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1655\u001b[0m elem,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1659\u001b[0m ret,\n\u001b[1;32m 1660\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1846\u001b[0m, in \u001b[0;36mConnection._execute_context\u001b[0;34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001b[0m\n\u001b[1;32m 1844\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exec_insertmany_context(dialect, context)\n\u001b[1;32m 1845\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1846\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_exec_single_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1847\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\n\u001b[1;32m 1848\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1986\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1983\u001b[0m result \u001b[38;5;241m=\u001b[39m context\u001b[38;5;241m.\u001b[39m_setup_result_proxy()\n\u001b[1;32m 1985\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m-> 1986\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_handle_dbapi_exception\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1987\u001b[0m \u001b[43m \u001b[49m\u001b[43me\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1988\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1990\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2355\u001b[0m, in \u001b[0;36mConnection._handle_dbapi_exception\u001b[0;34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001b[0m\n\u001b[1;32m 2353\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m should_wrap:\n\u001b[1;32m 2354\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m sqlalchemy_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m-> 2355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m sqlalchemy_exception\u001b[38;5;241m.\u001b[39mwith_traceback(exc_info[\u001b[38;5;241m2\u001b[39m]) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 2356\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2357\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m exc_info[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1965\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n\u001b[1;32m 1972\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_cursor_execute(\n\u001b[1;32m 1973\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1974\u001b[0m cursor,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1978\u001b[0m context\u001b[38;5;241m.\u001b[39mexecutemany,\n\u001b[1;32m 1979\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m \u001b[43mcursor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mOperationalError\u001b[0m: (sqlite3.OperationalError) no such table: Artist\n[SQL: SELECT * FROM Artist LIMIT 10;]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)"
+ ]
}
],
"source": [
@@ -156,8 +193,15 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {},
+ "execution_count": 4,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:18.903387Z",
+ "iopub.status.busy": "2024-09-12T00:00:18.903269Z",
+ "iopub.status.idle": "2024-09-12T00:00:19.349619Z",
+ "shell.execute_reply": "2024-09-12T00:00:19.349274Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -170,16 +214,23 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {},
+ "execution_count": 5,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:19.351627Z",
+ "iopub.status.busy": "2024-09-12T00:00:19.351507Z",
+ "iopub.status.idle": "2024-09-12T00:00:20.294090Z",
+ "shell.execute_reply": "2024-09-12T00:00:20.293735Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'SELECT COUNT(\"EmployeeId\") AS \"TotalEmployees\" FROM \"Employee\"\\nLIMIT 1;'"
+ "'SELECT COUNT(\"employee_id\") AS num_employees\\nFROM \"employees\"'"
]
},
- "execution_count": 3,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -201,18 +252,41 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "metadata": {},
+ "execution_count": 6,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:20.295721Z",
+ "iopub.status.busy": "2024-09-12T00:00:20.295591Z",
+ "iopub.status.idle": "2024-09-12T00:00:20.381425Z",
+ "shell.execute_reply": "2024-09-12T00:00:20.380948Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "'[(8,)]'"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "OperationalError",
+ "evalue": "(sqlite3.OperationalError) no such table: employees\n[SQL: SELECT COUNT(\"employee_id\") AS num_employees\nFROM \"employees\"]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m \u001b[43mcursor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mOperationalError\u001b[0m: no such table: employees",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdb\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:502\u001b[0m, in \u001b[0;36mSQLDatabase.run\u001b[0;34m(self, command, fetch, include_columns, parameters, execution_options)\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun\u001b[39m(\n\u001b[1;32m 489\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 490\u001b[0m command: Union[\u001b[38;5;28mstr\u001b[39m, Executable],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 495\u001b[0m execution_options: Optional[Dict[\u001b[38;5;28mstr\u001b[39m, Any]] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 496\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[\u001b[38;5;28mstr\u001b[39m, Sequence[Dict[\u001b[38;5;28mstr\u001b[39m, Any]], Result[Any]]:\n\u001b[1;32m 497\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Execute a SQL command and return a string representing the results.\u001b[39;00m\n\u001b[1;32m 498\u001b[0m \n\u001b[1;32m 499\u001b[0m \u001b[38;5;124;03m If the statement returns rows, a string of the results is returned.\u001b[39;00m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;124;03m If the statement returns no rows, an empty string is returned.\u001b[39;00m\n\u001b[1;32m 501\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 502\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 503\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfetch\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 504\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcursor\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 507\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:467\u001b[0m, in \u001b[0;36mSQLDatabase._execute\u001b[0;34m(self, command, fetch, parameters, execution_options)\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mQuery expression has unknown type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(command)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 467\u001b[0m cursor \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 469\u001b[0m \u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 470\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 471\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m cursor\u001b[38;5;241m.\u001b[39mreturns_rows:\n\u001b[1;32m 474\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mall\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1418\u001b[0m, in \u001b[0;36mConnection.execute\u001b[0;34m(self, statement, parameters, execution_options)\u001b[0m\n\u001b[1;32m 1416\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(statement) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m 1417\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1418\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmeth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1419\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1420\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1421\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mNO_OPTIONS\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1422\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:515\u001b[0m, in \u001b[0;36mClauseElement._execute_on_connection\u001b[0;34m(self, connection, distilled_params, execution_options)\u001b[0m\n\u001b[1;32m 513\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m TYPE_CHECKING:\n\u001b[1;32m 514\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, Executable)\n\u001b[0;32m--> 515\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_clauseelement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdistilled_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 517\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 518\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(\u001b[38;5;28mself\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1640\u001b[0m, in \u001b[0;36mConnection._execute_clauseelement\u001b[0;34m(self, elem, distilled_parameters, execution_options)\u001b[0m\n\u001b[1;32m 1628\u001b[0m compiled_cache: Optional[CompiledCacheType] \u001b[38;5;241m=\u001b[39m execution_options\u001b[38;5;241m.\u001b[39mget(\n\u001b[1;32m 1629\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcompiled_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_compiled_cache\n\u001b[1;32m 1630\u001b[0m )\n\u001b[1;32m 1632\u001b[0m compiled_sql, extracted_params, cache_hit \u001b[38;5;241m=\u001b[39m elem\u001b[38;5;241m.\u001b[39m_compile_w_cache(\n\u001b[1;32m 1633\u001b[0m dialect\u001b[38;5;241m=\u001b[39mdialect,\n\u001b[1;32m 1634\u001b[0m compiled_cache\u001b[38;5;241m=\u001b[39mcompiled_cache,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1638\u001b[0m linting\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdialect\u001b[38;5;241m.\u001b[39mcompiler_linting \u001b[38;5;241m|\u001b[39m compiler\u001b[38;5;241m.\u001b[39mWARN_LINTING,\n\u001b[1;32m 1639\u001b[0m )\n\u001b[0;32m-> 1640\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1641\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1642\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecution_ctx_cls\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_init_compiled\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1643\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1644\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1645\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1646\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1647\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1648\u001b[0m \u001b[43m \u001b[49m\u001b[43melem\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1649\u001b[0m \u001b[43m \u001b[49m\u001b[43mextracted_params\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1650\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_hit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_hit\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1651\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1652\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m has_events:\n\u001b[1;32m 1653\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_execute(\n\u001b[1;32m 1654\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1655\u001b[0m elem,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1659\u001b[0m ret,\n\u001b[1;32m 1660\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1846\u001b[0m, in \u001b[0;36mConnection._execute_context\u001b[0;34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001b[0m\n\u001b[1;32m 1844\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exec_insertmany_context(dialect, context)\n\u001b[1;32m 1845\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1846\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_exec_single_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1847\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\n\u001b[1;32m 1848\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1986\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1983\u001b[0m result \u001b[38;5;241m=\u001b[39m context\u001b[38;5;241m.\u001b[39m_setup_result_proxy()\n\u001b[1;32m 1985\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m-> 1986\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_handle_dbapi_exception\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1987\u001b[0m \u001b[43m \u001b[49m\u001b[43me\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1988\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1990\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2355\u001b[0m, in \u001b[0;36mConnection._handle_dbapi_exception\u001b[0;34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001b[0m\n\u001b[1;32m 2353\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m should_wrap:\n\u001b[1;32m 2354\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m sqlalchemy_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m-> 2355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m sqlalchemy_exception\u001b[38;5;241m.\u001b[39mwith_traceback(exc_info[\u001b[38;5;241m2\u001b[39m]) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 2356\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2357\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m exc_info[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1965\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n\u001b[1;32m 1972\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_cursor_execute(\n\u001b[1;32m 1973\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1974\u001b[0m cursor,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1978\u001b[0m context\u001b[38;5;241m.\u001b[39mexecutemany,\n\u001b[1;32m 1979\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m \u001b[43mcursor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mOperationalError\u001b[0m: (sqlite3.OperationalError) no such table: employees\n[SQL: SELECT COUNT(\"employee_id\") AS num_employees\nFROM \"employees\"]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)"
+ ]
}
],
"source": [
@@ -234,8 +308,15 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "metadata": {},
+ "execution_count": 7,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:20.383243Z",
+ "iopub.status.busy": "2024-09-12T00:00:20.383120Z",
+ "iopub.status.idle": "2024-09-12T00:00:20.387832Z",
+ "shell.execute_reply": "2024-09-12T00:00:20.387619Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -278,16 +359,23 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "metadata": {},
+ "execution_count": 8,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:20.389052Z",
+ "iopub.status.busy": "2024-09-12T00:00:20.388972Z",
+ "iopub.status.idle": "2024-09-12T00:00:21.046826Z",
+ "shell.execute_reply": "2024-09-12T00:00:21.046078Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'[(8,)]'"
+ "'Error: (sqlite3.OperationalError) no such table: Employees\\n[SQL: SELECT COUNT(\"EmployeeID\") AS num_employees\\nFROM \"Employees\"]\\n(Background on this error at: https://sqlalche.me/e/20/e3q8)'"
]
},
- "execution_count": 6,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -312,16 +400,23 @@
},
{
"cell_type": "code",
- "execution_count": 7,
- "metadata": {},
+ "execution_count": 9,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:21.050627Z",
+ "iopub.status.busy": "2024-09-12T00:00:21.050294Z",
+ "iopub.status.idle": "2024-09-12T00:00:23.078888Z",
+ "shell.execute_reply": "2024-09-12T00:00:23.077903Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "'There are a total of 8 employees.'"
+ "'The error message indicates that the table \"Employees\" does not exist in the database. Therefore, the query cannot be executed to determine the total number of employees. Please check the database schema to ensure that the \"Employees\" table is present and spelled correctly.'"
]
},
- "execution_count": 7,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -405,19 +500,26 @@
},
{
"cell_type": "code",
- "execution_count": 8,
- "metadata": {},
+ "execution_count": 10,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:23.086337Z",
+ "iopub.status.busy": "2024-09-12T00:00:23.085855Z",
+ "iopub.status.idle": "2024-09-12T00:00:23.135764Z",
+ "shell.execute_reply": "2024-09-12T00:00:23.135252Z"
+ }
+ },
"outputs": [
{
"data": {
"text/plain": [
- "[QuerySQLDataBaseTool(description=\"Input to this tool is a detailed and correct SQL query, output is a result from the database. If the query is not correct, an error message will be returned. If an error is returned, rewrite the query, check the query, and try again. If you encounter an issue with Unknown column 'xxxx' in 'field list', use sql_db_schema to query the correct table fields.\", db=),\n",
- " InfoSQLDatabaseTool(description='Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables. Be sure that the tables actually exist by calling sql_db_list_tables first! Example Input: table1, table2, table3', db=),\n",
- " ListSQLDatabaseTool(db=),\n",
- " QuerySQLCheckerTool(description='Use this tool to double check if your query is correct before executing it. Always use this tool before executing a query with sql_db_query!', db=, llm=ChatOpenAI(client=, async_client=, temperature=0.0, openai_api_key=SecretStr('**********'), openai_proxy=''), llm_chain=LLMChain(prompt=PromptTemplate(input_variables=['dialect', 'query'], template='\\n{query}\\nDouble check the {dialect} query above for common mistakes, including:\\n- Using NOT IN with NULL values\\n- Using UNION when UNION ALL should have been used\\n- Using BETWEEN for exclusive ranges\\n- Data type mismatch in predicates\\n- Properly quoting identifiers\\n- Using the correct number of arguments for functions\\n- Casting to the correct data type\\n- Using the proper columns for joins\\n\\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.\\n\\nOutput the final SQL query only.\\n\\nSQL Query: '), llm=ChatOpenAI(client=, async_client=, temperature=0.0, openai_api_key=SecretStr('**********'), openai_proxy='')))]"
+ "[QuerySQLDataBaseTool(description=\"Input to this tool is a detailed and correct SQL query, output is a result from the database. If the query is not correct, an error message will be returned. If an error is returned, rewrite the query, check the query, and try again. If you encounter an issue with Unknown column 'xxxx' in 'field list', use sql_db_schema to query the correct table fields.\", db=),\n",
+ " InfoSQLDatabaseTool(description='Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables. Be sure that the tables actually exist by calling sql_db_list_tables first! Example Input: table1, table2, table3', db=),\n",
+ " ListSQLDatabaseTool(db=),\n",
+ " QuerySQLCheckerTool(description='Use this tool to double check if your query is correct before executing it. Always use this tool before executing a query with sql_db_query!', db=, llm=ChatOpenAI(client=, async_client=, root_client=, root_async_client=, temperature=0.0, model_kwargs={}, openai_api_key=SecretStr('**********')), llm_chain=LLMChain(verbose=False, prompt=PromptTemplate(input_variables=['dialect', 'query'], input_types={}, partial_variables={}, template='\\n{query}\\nDouble check the {dialect} query above for common mistakes, including:\\n- Using NOT IN with NULL values\\n- Using UNION when UNION ALL should have been used\\n- Using BETWEEN for exclusive ranges\\n- Data type mismatch in predicates\\n- Properly quoting identifiers\\n- Using the correct number of arguments for functions\\n- Casting to the correct data type\\n- Using the proper columns for joins\\n\\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.\\n\\nOutput the final SQL query only.\\n\\nSQL Query: '), llm=ChatOpenAI(client=, async_client=, root_client=, root_async_client=, temperature=0.0, model_kwargs={}, openai_api_key=SecretStr('**********')), output_parser=StrOutputParser(), llm_kwargs={}))]"
]
},
- "execution_count": 8,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -443,8 +545,15 @@
},
{
"cell_type": "code",
- "execution_count": 32,
- "metadata": {},
+ "execution_count": 11,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:23.138218Z",
+ "iopub.status.busy": "2024-09-12T00:00:23.138063Z",
+ "iopub.status.idle": "2024-09-12T00:00:23.140914Z",
+ "shell.execute_reply": "2024-09-12T00:00:23.140625Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.messages import SystemMessage\n",
@@ -477,8 +586,15 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "metadata": {},
+ "execution_count": 12,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:23.143196Z",
+ "iopub.status.busy": "2024-09-12T00:00:23.143054Z",
+ "iopub.status.idle": "2024-09-12T00:00:24.153025Z",
+ "shell.execute_reply": "2024-09-12T00:00:24.152376Z"
+ }
+ },
"outputs": [],
"source": [
"%%capture --no-stderr\n",
@@ -494,9 +610,25 @@
},
{
"cell_type": "code",
- "execution_count": 33,
- "metadata": {},
- "outputs": [],
+ "execution_count": 13,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:24.156506Z",
+ "iopub.status.busy": "2024-09-12T00:00:24.156255Z",
+ "iopub.status.idle": "2024-09-12T00:00:24.193694Z",
+ "shell.execute_reply": "2024-09-12T00:00:24.193397Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/4j/2rz3865x6qg07tx43146py8h0000gn/T/ipykernel_60454/1800557427.py:4: LangGraphDeprecationWarning: Parameter 'messages_modifier' in function 'create_react_agent' is deprecated as of version 0.1.9 and will be removed in version 0.3.0. Use 'state_modifier' parameter instead.\n",
+ " agent_executor = create_react_agent(llm, tools, messages_modifier=system_message)\n"
+ ]
+ }
+ ],
"source": [
"from langchain_core.messages import HumanMessage\n",
"from langgraph.prebuilt import create_react_agent\n",
@@ -513,26 +645,81 @@
},
{
"cell_type": "code",
- "execution_count": 34,
- "metadata": {},
+ "execution_count": 14,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:24.195452Z",
+ "iopub.status.busy": "2024-09-12T00:00:24.195330Z",
+ "iopub.status.idle": "2024-09-12T00:00:29.952700Z",
+ "shell.execute_reply": "2024-09-12T00:00:29.952146Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_vnHKe3oul1xbpX0Vrb2vsamZ', 'function': {'arguments': '{\"query\":\"SELECT c.Country, SUM(i.Total) AS Total_Spent FROM customers c JOIN invoices i ON c.CustomerId = i.CustomerId GROUP BY c.Country ORDER BY Total_Spent DESC LIMIT 1\"}', 'name': 'sql_db_query'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 53, 'prompt_tokens': 557, 'total_tokens': 610}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-da250593-06b5-414c-a9d9-3fc77036dd9c-0', tool_calls=[{'name': 'sql_db_query', 'args': {'query': 'SELECT c.Country, SUM(i.Total) AS Total_Spent FROM customers c JOIN invoices i ON c.CustomerId = i.CustomerId GROUP BY c.Country ORDER BY Total_Spent DESC LIMIT 1'}, 'id': 'call_vnHKe3oul1xbpX0Vrb2vsamZ'}])]}}\n",
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_2GMSA7HMThuf6t0Yxa8bRXXH', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 12, 'prompt_tokens': 557, 'total_tokens': 569}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-5a87ca92-3a4f-469d-8bf4-36d24cf2b49e-0', tool_calls=[{'name': 'sql_db_list_tables', 'args': {}, 'id': 'call_2GMSA7HMThuf6t0Yxa8bRXXH', 'type': 'tool_call'}], usage_metadata={'input_tokens': 557, 'output_tokens': 12, 'total_tokens': 569})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content='Error: (sqlite3.OperationalError) no such table: customers\\n[SQL: SELECT c.Country, SUM(i.Total) AS Total_Spent FROM customers c JOIN invoices i ON c.CustomerId = i.CustomerId GROUP BY c.Country ORDER BY Total_Spent DESC LIMIT 1]\\n(Background on this error at: https://sqlalche.me/e/20/e3q8)', name='sql_db_query', id='1a5c85d4-1b30-4af3-ab9b-325cbce3b2b4', tool_call_id='call_vnHKe3oul1xbpX0Vrb2vsamZ')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content='', name='sql_db_list_tables', tool_call_id='call_2GMSA7HMThuf6t0Yxa8bRXXH')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_FLrOU39h4lTcW0PCdKTfDF3b', 'function': {'arguments': '{\"table_names\":\"customers, orders\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 18, 'prompt_tokens': 579, 'total_tokens': 597}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-003d1e1e-667c-4779-b3a8-5b3425c6c614-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'customers, orders'}, 'id': 'call_FLrOU39h4lTcW0PCdKTfDF3b', 'type': 'tool_call'}], usage_metadata={'input_tokens': 579, 'output_tokens': 18, 'total_tokens': 597})]}}\n",
"----\n",
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_pp3BBD1hwpdwskUj63G3tgaQ', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 12, 'prompt_tokens': 699, 'total_tokens': 711}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-04cf0e05-61d0-4673-b5dc-1a9b5fd71fff-0', tool_calls=[{'name': 'sql_db_list_tables', 'args': {}, 'id': 'call_pp3BBD1hwpdwskUj63G3tgaQ'}])]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'orders', 'customers'} not found in database\", name='sql_db_schema', tool_call_id='call_FLrOU39h4lTcW0PCdKTfDF3b')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_X4QJXxrdR2F3yvL3EprZtCc1', 'function': {'arguments': '{\"table_names\":\"customer, orders\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 18, 'prompt_tokens': 620, 'total_tokens': 638}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-83ef2b7d-1efd-4e9d-9e0c-01b849156538-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'customer, orders'}, 'id': 'call_X4QJXxrdR2F3yvL3EprZtCc1', 'type': 'tool_call'}], usage_metadata={'input_tokens': 620, 'output_tokens': 18, 'total_tokens': 638})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content='Album, Artist, Customer, Employee, Genre, Invoice, InvoiceLine, MediaType, Playlist, PlaylistTrack, Track', name='sql_db_list_tables', id='c2668450-4d73-4d32-8d75-8aac8fa153fd', tool_call_id='call_pp3BBD1hwpdwskUj63G3tgaQ')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'customer', 'orders'} not found in database\", name='sql_db_schema', tool_call_id='call_X4QJXxrdR2F3yvL3EprZtCc1')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_CPSYEGnwZSpowsfDYZg7lBrE', 'function': {'arguments': '{\"table_names\":\"Customers, Orders\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 18, 'prompt_tokens': 661, 'total_tokens': 679}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-b410d2d9-577c-4847-be21-a4d50ac0e282-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'Customers, Orders'}, 'id': 'call_CPSYEGnwZSpowsfDYZg7lBrE', 'type': 'tool_call'}], usage_metadata={'input_tokens': 661, 'output_tokens': 18, 'total_tokens': 679})]}}\n",
"----\n",
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_22Asbqgdx26YyEvJxBuANVdY', 'function': {'arguments': '{\"query\":\"SELECT c.Country, SUM(i.Total) AS Total_Spent FROM Customer c JOIN Invoice i ON c.CustomerId = i.CustomerId GROUP BY c.Country ORDER BY Total_Spent DESC LIMIT 1\"}', 'name': 'sql_db_query'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 53, 'prompt_tokens': 744, 'total_tokens': 797}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-bdd94241-ca49-4f15-b31a-b7c728a34ea8-0', tool_calls=[{'name': 'sql_db_query', 'args': {'query': 'SELECT c.Country, SUM(i.Total) AS Total_Spent FROM Customer c JOIN Invoice i ON c.CustomerId = i.CustomerId GROUP BY c.Country ORDER BY Total_Spent DESC LIMIT 1'}, 'id': 'call_22Asbqgdx26YyEvJxBuANVdY'}])]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'Orders', 'Customers'} not found in database\", name='sql_db_schema', tool_call_id='call_CPSYEGnwZSpowsfDYZg7lBrE')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_3Q7iYlrUaE45EoV8c9RZyAAk', 'function': {'arguments': '{\"table_names\":\"Customers, Orders\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 18, 'prompt_tokens': 702, 'total_tokens': 720}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-f78c83b8-7f38-461b-bf95-69e4914b1f90-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'Customers, Orders'}, 'id': 'call_3Q7iYlrUaE45EoV8c9RZyAAk', 'type': 'tool_call'}], usage_metadata={'input_tokens': 702, 'output_tokens': 18, 'total_tokens': 720})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content=\"[('USA', 523.0600000000003)]\", name='sql_db_query', id='f647e606-8362-40ab-8d34-612ff166dbe1', tool_call_id='call_22Asbqgdx26YyEvJxBuANVdY')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'Orders', 'Customers'} not found in database\", name='sql_db_schema', tool_call_id='call_3Q7iYlrUaE45EoV8c9RZyAAk')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='I apologize for the inconvenience, it seems that the tables \"Customers\" and \"Orders\" are not available in the database. Let me check the available tables.', additional_kwargs={'tool_calls': [{'id': 'call_KJNCZkOW4xOAfioK11dc9ZcA', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 743, 'total_tokens': 788}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-cf55baae-c770-4eab-b9d3-5ed5dc4ca8a5-0', tool_calls=[{'name': 'sql_db_list_tables', 'args': {}, 'id': 'call_KJNCZkOW4xOAfioK11dc9ZcA', 'type': 'tool_call'}], usage_metadata={'input_tokens': 743, 'output_tokens': 45, 'total_tokens': 788})]}}\n",
"----\n",
- "{'agent': {'messages': [AIMessage(content='Customers from the USA spent the most, with a total amount spent of $523.06.', response_metadata={'token_usage': {'completion_tokens': 20, 'prompt_tokens': 819, 'total_tokens': 839}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'stop', 'logprobs': None}, id='run-92e88de0-ff62-41da-8181-053fb5632af4-0')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content='', name='sql_db_list_tables', tool_call_id='call_KJNCZkOW4xOAfioK11dc9ZcA')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='I have checked the available tables in the database, and it appears that the tables \"Customers\" and \"Orders\" are not present. Could you please provide me with the names of the tables that contain information about customers and their spending?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 48, 'prompt_tokens': 801, 'total_tokens': 849}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-45109eab-78fb-4027-8afb-07fc625f5649-0', usage_metadata={'input_tokens': 801, 'output_tokens': 48, 'total_tokens': 849})]}}\n",
"----\n"
]
}
@@ -561,26 +748,61 @@
},
{
"cell_type": "code",
- "execution_count": 35,
- "metadata": {},
+ "execution_count": 15,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:29.955909Z",
+ "iopub.status.busy": "2024-09-12T00:00:29.955675Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.182948Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.182114Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_WN0N3mm8WFvPXYlK9P7KvIEr', 'function': {'arguments': '{\"table_names\":\"playlisttrack\"}', 'name': 'sql_db_schema'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 17, 'prompt_tokens': 554, 'total_tokens': 571}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-be278326-4115-4c67-91a0-6dc97e7bffa4-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'playlisttrack'}, 'id': 'call_WN0N3mm8WFvPXYlK9P7KvIEr'}])]}}\n",
+ "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_DA02ci0k9rfoJomxUQ9QbMWX', 'function': {'arguments': '{\"table_names\":\"playlisttrack\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 17, 'prompt_tokens': 554, 'total_tokens': 571}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-ac921195-3129-4ec5-8e8f-af14aa634eae-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'playlisttrack'}, 'id': 'call_DA02ci0k9rfoJomxUQ9QbMWX', 'type': 'tool_call'}], usage_metadata={'input_tokens': 554, 'output_tokens': 17, 'total_tokens': 571})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content=\"Error: table_names {'playlisttrack'} not found in database\", name='sql_db_schema', id='fe32b3d3-a40f-4802-a6b8-87a2453af8c2', tool_call_id='call_WN0N3mm8WFvPXYlK9P7KvIEr')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'playlisttrack'} not found in database\", name='sql_db_schema', tool_call_id='call_DA02ci0k9rfoJomxUQ9QbMWX')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='I apologize for the error. Let me first check the list of tables in the database.', additional_kwargs={'tool_calls': [{'id': 'call_YfhB91XQKe4gp5QVRqvIRqal', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 31, 'prompt_tokens': 592, 'total_tokens': 623}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-ba8641d3-a10e-45a3-87c1-ec4149bdfc53-0', tool_calls=[{'name': 'sql_db_list_tables', 'args': {}, 'id': 'call_YfhB91XQKe4gp5QVRqvIRqal', 'type': 'tool_call'}], usage_metadata={'input_tokens': 592, 'output_tokens': 31, 'total_tokens': 623})]}}\n",
"----\n",
- "{'agent': {'messages': [AIMessage(content='I apologize for the error. Let me first check the available tables in the database.', additional_kwargs={'tool_calls': [{'id': 'call_CzHt30847ql2MmnGxgYeVSL2', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 30, 'prompt_tokens': 592, 'total_tokens': 622}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-f6c107bb-e945-4848-a83c-f57daec1144e-0', tool_calls=[{'name': 'sql_db_list_tables', 'args': {}, 'id': 'call_CzHt30847ql2MmnGxgYeVSL2'}])]}}\n",
+ "{'tools': {'messages': [ToolMessage(content='', name='sql_db_list_tables', tool_call_id='call_YfhB91XQKe4gp5QVRqvIRqal')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='The tables in the database are: `playlist`, `track`, `playlisttrack`. Now, let me describe the `playlisttrack` table.', additional_kwargs={'tool_calls': [{'id': 'call_bAI4ipGXnGcqpMAJrk3eBbGn', 'function': {'arguments': '{\"table_names\":\"playlisttrack\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 47, 'prompt_tokens': 636, 'total_tokens': 683}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-720423cb-53cf-44db-8554-4648c11b287f-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'playlisttrack'}, 'id': 'call_bAI4ipGXnGcqpMAJrk3eBbGn', 'type': 'tool_call'}], usage_metadata={'input_tokens': 636, 'output_tokens': 47, 'total_tokens': 683})]}}\n",
"----\n",
- "{'action': {'messages': [ToolMessage(content='Album, Artist, Customer, Employee, Genre, Invoice, InvoiceLine, MediaType, Playlist, PlaylistTrack, Track', name='sql_db_list_tables', id='a4950f74-a0ad-4558-ba54-7bcf99539a02', tool_call_id='call_CzHt30847ql2MmnGxgYeVSL2')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'playlisttrack'} not found in database\", name='sql_db_schema', tool_call_id='call_bAI4ipGXnGcqpMAJrk3eBbGn')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='It seems there was an issue with retrieving the schema for the `playlisttrack` table. Let me try again.', additional_kwargs={'tool_calls': [{'id': 'call_VdlLvkhAtLwFa47a00OfchLb', 'function': {'arguments': '{\"table_names\":\"playlisttrack\"}', 'name': 'sql_db_schema'}, 'type': 'function'}], 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 707, 'total_tokens': 748}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-80473261-39ad-424b-b8e3-5903a23aa61d-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'playlisttrack'}, 'id': 'call_VdlLvkhAtLwFa47a00OfchLb', 'type': 'tool_call'}], usage_metadata={'input_tokens': 707, 'output_tokens': 41, 'total_tokens': 748})]}}\n",
"----\n",
- "{'agent': {'messages': [AIMessage(content='The database contains a table named \"PlaylistTrack\". Let me retrieve the schema and sample rows from the \"PlaylistTrack\" table.', additional_kwargs={'tool_calls': [{'id': 'call_wX9IjHLgRBUmxlfCthprABRO', 'function': {'arguments': '{\"table_names\":\"PlaylistTrack\"}', 'name': 'sql_db_schema'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 44, 'prompt_tokens': 658, 'total_tokens': 702}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-e8d34372-1159-4654-a185-1e7d0cb70269-0', tool_calls=[{'name': 'sql_db_schema', 'args': {'table_names': 'PlaylistTrack'}, 'id': 'call_wX9IjHLgRBUmxlfCthprABRO'}])]}}\n",
- "----\n",
- "{'action': {'messages': [ToolMessage(content='\\nCREATE TABLE \"PlaylistTrack\" (\\n\\t\"PlaylistId\" INTEGER NOT NULL, \\n\\t\"TrackId\" INTEGER NOT NULL, \\n\\tPRIMARY KEY (\"PlaylistId\", \"TrackId\"), \\n\\tFOREIGN KEY(\"TrackId\") REFERENCES \"Track\" (\"TrackId\"), \\n\\tFOREIGN KEY(\"PlaylistId\") REFERENCES \"Playlist\" (\"PlaylistId\")\\n)\\n\\n/*\\n3 rows from PlaylistTrack table:\\nPlaylistId\\tTrackId\\n1\\t3402\\n1\\t3389\\n1\\t3390\\n*/', name='sql_db_schema', id='f6ffc37a-188a-4690-b84e-c9f2c78b1e49', tool_call_id='call_wX9IjHLgRBUmxlfCthprABRO')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='The \"PlaylistTrack\" table has the following schema:\\n- PlaylistId: INTEGER (NOT NULL)\\n- TrackId: INTEGER (NOT NULL)\\n- Primary Key: (PlaylistId, TrackId)\\n- Foreign Key: TrackId references Track(TrackId)\\n- Foreign Key: PlaylistId references Playlist(PlaylistId)\\n\\nHere are 3 sample rows from the \"PlaylistTrack\" table:\\n1. PlaylistId: 1, TrackId: 3402\\n2. PlaylistId: 1, TrackId: 3389\\n3. PlaylistId: 1, TrackId: 3390\\n\\nIf you have any specific questions or queries regarding the \"PlaylistTrack\" table, feel free to ask!', response_metadata={'token_usage': {'completion_tokens': 145, 'prompt_tokens': 818, 'total_tokens': 963}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'stop', 'logprobs': None}, id='run-961a4552-3cbd-4d28-b338-4d2f1ac40ea0-0')]}}\n",
+ "{'tools': {'messages': [ToolMessage(content=\"Error: table_names {'playlisttrack'} not found in database\", name='sql_db_schema', tool_call_id='call_VdlLvkhAtLwFa47a00OfchLb')]}}\n",
+ "----\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "{'agent': {'messages': [AIMessage(content='It appears that there is an issue with retrieving the schema for the `playlisttrack` table. Unfortunately, I am unable to provide the description of the `playlisttrack` table at the moment. If you have any other questions or if there is another table you would like me to describe, please let me know.', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 64, 'prompt_tokens': 772, 'total_tokens': 836}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-eaa79006-51b7-4253-b477-34a8b6b3e69a-0', usage_metadata={'input_tokens': 772, 'output_tokens': 64, 'total_tokens': 836})]}}\n",
"----\n"
]
}
@@ -608,22 +830,42 @@
},
{
"cell_type": "code",
- "execution_count": 36,
- "metadata": {},
+ "execution_count": 16,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:35.186079Z",
+ "iopub.status.busy": "2024-09-12T00:00:35.185801Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.278075Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.277380Z"
+ }
+ },
"outputs": [
{
- "data": {
- "text/plain": [
- "['Big Ones',\n",
- " 'Cidade Negra - Hits',\n",
- " 'In Step',\n",
- " 'Use Your Illusion I',\n",
- " 'Voodoo Lounge']"
- ]
- },
- "execution_count": 36,
- "metadata": {},
- "output_type": "execute_result"
+ "ename": "OperationalError",
+ "evalue": "(sqlite3.OperationalError) no such table: Artist\n[SQL: SELECT Name FROM Artist]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m cursor\u001b[38;5;241m.\u001b[39mexecute(statement, parameters)\n",
+ "\u001b[0;31mOperationalError\u001b[0m: no such table: Artist",
+ "\nThe above exception was the direct cause of the following exception:\n",
+ "\u001b[0;31mOperationalError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[16], line 12\u001b[0m\n\u001b[1;32m 8\u001b[0m res \u001b[38;5;241m=\u001b[39m [re\u001b[38;5;241m.\u001b[39msub(\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124md+\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, string)\u001b[38;5;241m.\u001b[39mstrip() \u001b[38;5;28;01mfor\u001b[39;00m string \u001b[38;5;129;01min\u001b[39;00m res]\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28mset\u001b[39m(res))\n\u001b[0;32m---> 12\u001b[0m artists \u001b[38;5;241m=\u001b[39m \u001b[43mquery_as_list\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSELECT Name FROM Artist\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 13\u001b[0m albums \u001b[38;5;241m=\u001b[39m query_as_list(db, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSELECT Title FROM Album\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 14\u001b[0m albums[:\u001b[38;5;241m5\u001b[39m]\n",
+ "Cell \u001b[0;32mIn[16], line 6\u001b[0m, in \u001b[0;36mquery_as_list\u001b[0;34m(db, query)\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mquery_as_list\u001b[39m(db, query):\n\u001b[0;32m----> 6\u001b[0m res \u001b[38;5;241m=\u001b[39m \u001b[43mdb\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mquery\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 7\u001b[0m res \u001b[38;5;241m=\u001b[39m [el \u001b[38;5;28;01mfor\u001b[39;00m sub \u001b[38;5;129;01min\u001b[39;00m ast\u001b[38;5;241m.\u001b[39mliteral_eval(res) \u001b[38;5;28;01mfor\u001b[39;00m el \u001b[38;5;129;01min\u001b[39;00m sub \u001b[38;5;28;01mif\u001b[39;00m el]\n\u001b[1;32m 8\u001b[0m res \u001b[38;5;241m=\u001b[39m [re\u001b[38;5;241m.\u001b[39msub(\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124md+\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, string)\u001b[38;5;241m.\u001b[39mstrip() \u001b[38;5;28;01mfor\u001b[39;00m string \u001b[38;5;129;01min\u001b[39;00m res]\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:502\u001b[0m, in \u001b[0;36mSQLDatabase.run\u001b[0;34m(self, command, fetch, include_columns, parameters, execution_options)\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun\u001b[39m(\n\u001b[1;32m 489\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 490\u001b[0m command: Union[\u001b[38;5;28mstr\u001b[39m, Executable],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 495\u001b[0m execution_options: Optional[Dict[\u001b[38;5;28mstr\u001b[39m, Any]] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 496\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[\u001b[38;5;28mstr\u001b[39m, Sequence[Dict[\u001b[38;5;28mstr\u001b[39m, Any]], Result[Any]]:\n\u001b[1;32m 497\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Execute a SQL command and return a string representing the results.\u001b[39;00m\n\u001b[1;32m 498\u001b[0m \n\u001b[1;32m 499\u001b[0m \u001b[38;5;124;03m If the statement returns rows, a string of the results is returned.\u001b[39;00m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;124;03m If the statement returns no rows, an empty string is returned.\u001b[39;00m\n\u001b[1;32m 501\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 502\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 503\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfetch\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 504\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcursor\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m 507\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/langchain_community/utilities/sql_database.py:467\u001b[0m, in \u001b[0;36mSQLDatabase._execute\u001b[0;34m(self, command, fetch, parameters, execution_options)\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 466\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mQuery expression has unknown type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(command)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 467\u001b[0m cursor \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[43m \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 469\u001b[0m \u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 470\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 471\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m cursor\u001b[38;5;241m.\u001b[39mreturns_rows:\n\u001b[1;32m 474\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m fetch \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mall\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1418\u001b[0m, in \u001b[0;36mConnection.execute\u001b[0;34m(self, statement, parameters, execution_options)\u001b[0m\n\u001b[1;32m 1416\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(statement) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m 1417\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1418\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmeth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1419\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1420\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1421\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mNO_OPTIONS\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1422\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:515\u001b[0m, in \u001b[0;36mClauseElement._execute_on_connection\u001b[0;34m(self, connection, distilled_params, execution_options)\u001b[0m\n\u001b[1;32m 513\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m TYPE_CHECKING:\n\u001b[1;32m 514\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, Executable)\n\u001b[0;32m--> 515\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_clauseelement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdistilled_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\n\u001b[1;32m 517\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 518\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\u001b[38;5;241m.\u001b[39mObjectNotExecutableError(\u001b[38;5;28mself\u001b[39m)\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1640\u001b[0m, in \u001b[0;36mConnection._execute_clauseelement\u001b[0;34m(self, elem, distilled_parameters, execution_options)\u001b[0m\n\u001b[1;32m 1628\u001b[0m compiled_cache: Optional[CompiledCacheType] \u001b[38;5;241m=\u001b[39m execution_options\u001b[38;5;241m.\u001b[39mget(\n\u001b[1;32m 1629\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcompiled_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_compiled_cache\n\u001b[1;32m 1630\u001b[0m )\n\u001b[1;32m 1632\u001b[0m compiled_sql, extracted_params, cache_hit \u001b[38;5;241m=\u001b[39m elem\u001b[38;5;241m.\u001b[39m_compile_w_cache(\n\u001b[1;32m 1633\u001b[0m dialect\u001b[38;5;241m=\u001b[39mdialect,\n\u001b[1;32m 1634\u001b[0m compiled_cache\u001b[38;5;241m=\u001b[39mcompiled_cache,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1638\u001b[0m linting\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdialect\u001b[38;5;241m.\u001b[39mcompiler_linting \u001b[38;5;241m|\u001b[39m compiler\u001b[38;5;241m.\u001b[39mWARN_LINTING,\n\u001b[1;32m 1639\u001b[0m )\n\u001b[0;32m-> 1640\u001b[0m ret \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_execute_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1641\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1642\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecution_ctx_cls\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_init_compiled\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1643\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1644\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1645\u001b[0m \u001b[43m \u001b[49m\u001b[43mexecution_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1646\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompiled_sql\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1647\u001b[0m \u001b[43m \u001b[49m\u001b[43mdistilled_parameters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1648\u001b[0m \u001b[43m \u001b[49m\u001b[43melem\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1649\u001b[0m \u001b[43m \u001b[49m\u001b[43mextracted_params\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1650\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_hit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_hit\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1651\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1652\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m has_events:\n\u001b[1;32m 1653\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_execute(\n\u001b[1;32m 1654\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1655\u001b[0m elem,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1659\u001b[0m ret,\n\u001b[1;32m 1660\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1846\u001b[0m, in \u001b[0;36mConnection._execute_context\u001b[0;34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001b[0m\n\u001b[1;32m 1844\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exec_insertmany_context(dialect, context)\n\u001b[1;32m 1845\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1846\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_exec_single_context\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1847\u001b[0m \u001b[43m \u001b[49m\u001b[43mdialect\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstatement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\n\u001b[1;32m 1848\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1986\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1983\u001b[0m result \u001b[38;5;241m=\u001b[39m context\u001b[38;5;241m.\u001b[39m_setup_result_proxy()\n\u001b[1;32m 1985\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m-> 1986\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_handle_dbapi_exception\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1987\u001b[0m \u001b[43m \u001b[49m\u001b[43me\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1988\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1990\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2355\u001b[0m, in \u001b[0;36mConnection._handle_dbapi_exception\u001b[0;34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001b[0m\n\u001b[1;32m 2353\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m should_wrap:\n\u001b[1;32m 2354\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m sqlalchemy_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m-> 2355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m sqlalchemy_exception\u001b[38;5;241m.\u001b[39mwith_traceback(exc_info[\u001b[38;5;241m2\u001b[39m]) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 2356\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2357\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m exc_info[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1967\u001b[0m, in \u001b[0;36mConnection._exec_single_context\u001b[0;34m(self, dialect, context, statement, parameters)\u001b[0m\n\u001b[1;32m 1965\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 1966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m evt_handled:\n\u001b[0;32m-> 1967\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdialect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdo_execute\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1968\u001b[0m \u001b[43m \u001b[49m\u001b[43mcursor\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstr_statement\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43meffective_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\n\u001b[1;32m 1969\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1971\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_events \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mengine\u001b[38;5;241m.\u001b[39m_has_events:\n\u001b[1;32m 1972\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdispatch\u001b[38;5;241m.\u001b[39mafter_cursor_execute(\n\u001b[1;32m 1973\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1974\u001b[0m cursor,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1978\u001b[0m context\u001b[38;5;241m.\u001b[39mexecutemany,\n\u001b[1;32m 1979\u001b[0m )\n",
+ "File \u001b[0;32m~/langchain/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:941\u001b[0m, in \u001b[0;36mDefaultDialect.do_execute\u001b[0;34m(self, cursor, statement, parameters, context)\u001b[0m\n\u001b[1;32m 940\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdo_execute\u001b[39m(\u001b[38;5;28mself\u001b[39m, cursor, statement, parameters, context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 941\u001b[0m cursor\u001b[38;5;241m.\u001b[39mexecute(statement, parameters)\n",
+ "\u001b[0;31mOperationalError\u001b[0m: (sqlite3.OperationalError) no such table: Artist\n[SQL: SELECT Name FROM Artist]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)"
+ ]
}
],
"source": [
@@ -652,9 +894,28 @@
},
{
"cell_type": "code",
- "execution_count": 39,
- "metadata": {},
- "outputs": [],
+ "execution_count": 17,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:35.280117Z",
+ "iopub.status.busy": "2024-09-12T00:00:35.280023Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.531356Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.531097Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'artists' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[17], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_community\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvectorstores\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m FAISS\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_openai\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m OpenAIEmbeddings\n\u001b[0;32m----> 5\u001b[0m vector_db \u001b[38;5;241m=\u001b[39m FAISS\u001b[38;5;241m.\u001b[39mfrom_texts(\u001b[43martists\u001b[49m \u001b[38;5;241m+\u001b[39m albums, OpenAIEmbeddings())\n\u001b[1;32m 6\u001b[0m retriever \u001b[38;5;241m=\u001b[39m vector_db\u001b[38;5;241m.\u001b[39mas_retriever(search_kwargs\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mk\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m5\u001b[39m})\n\u001b[1;32m 7\u001b[0m description \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\u001b[38;5;124mUse to look up values to filter on. Input is an approximate spelling of the proper noun, output is \u001b[39m\u001b[38;5;130;01m\\\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;124mvalid proper nouns. Use the noun most similar to the search.\u001b[39m\u001b[38;5;124m\"\"\"\u001b[39m\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'artists' is not defined"
+ ]
+ }
+ ],
"source": [
"from langchain.agents.agent_toolkits import create_retriever_tool\n",
"from langchain_community.vectorstores import FAISS\n",
@@ -680,22 +941,25 @@
},
{
"cell_type": "code",
- "execution_count": 40,
- "metadata": {},
+ "execution_count": 18,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:35.532901Z",
+ "iopub.status.busy": "2024-09-12T00:00:35.532801Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.538844Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.538623Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Alice In Chains\n",
- "\n",
- "Alanis Morissette\n",
- "\n",
- "Pearl Jam\n",
- "\n",
- "Pearl Jam\n",
- "\n",
- "Audioslave\n"
+ "ename": "NameError",
+ "evalue": "name 'retriever_tool' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[18], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mretriever_tool\u001b[49m\u001b[38;5;241m.\u001b[39minvoke(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAlice Chains\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'retriever_tool' is not defined"
]
}
],
@@ -714,9 +978,28 @@
},
{
"cell_type": "code",
- "execution_count": 50,
- "metadata": {},
- "outputs": [],
+ "execution_count": 19,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:35.540206Z",
+ "iopub.status.busy": "2024-09-12T00:00:35.540126Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.547250Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.546989Z"
+ }
+ },
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'retriever_tool' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[19], line 21\u001b[0m\n\u001b[1;32m 1\u001b[0m system \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\u001b[38;5;124mYou are an agent designed to interact with a SQL database.\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124mGiven an input question, create a syntactically correct SQLite query to run, then look at the results of the query and return the answer.\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124mUnless the user specifies a specific number of examples they wish to obtain, always limit your query to at most 5 results.\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 16\u001b[0m table_names\u001b[38;5;241m=\u001b[39mdb\u001b[38;5;241m.\u001b[39mget_usable_table_names()\n\u001b[1;32m 17\u001b[0m )\n\u001b[1;32m 19\u001b[0m system_message \u001b[38;5;241m=\u001b[39m SystemMessage(content\u001b[38;5;241m=\u001b[39msystem)\n\u001b[0;32m---> 21\u001b[0m tools\u001b[38;5;241m.\u001b[39mappend(\u001b[43mretriever_tool\u001b[49m)\n\u001b[1;32m 23\u001b[0m agent \u001b[38;5;241m=\u001b[39m create_react_agent(llm, tools, messages_modifier\u001b[38;5;241m=\u001b[39msystem_message)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'retriever_tool' is not defined"
+ ]
+ }
+ ],
"source": [
"system = \"\"\"You are an agent designed to interact with a SQL database.\n",
"Given an input question, create a syntactically correct SQLite query to run, then look at the results of the query and return the answer.\n",
@@ -745,19 +1028,25 @@
},
{
"cell_type": "code",
- "execution_count": 51,
- "metadata": {},
+ "execution_count": 20,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:35.548581Z",
+ "iopub.status.busy": "2024-09-12T00:00:35.548496Z",
+ "iopub.status.idle": "2024-09-12T00:00:35.555003Z",
+ "shell.execute_reply": "2024-09-12T00:00:35.554805Z"
+ }
+ },
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_r5UlSwHKQcWDHx6LrttnqE56', 'function': {'arguments': '{\"query\":\"SELECT COUNT(*) AS album_count FROM Album WHERE ArtistId IN (SELECT ArtistId FROM Artist WHERE Name = \\'Alice In Chains\\')\"}', 'name': 'sql_db_query'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 612, 'total_tokens': 652}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-548353fd-b06c-45bf-beab-46f81eb434df-0', tool_calls=[{'name': 'sql_db_query', 'args': {'query': \"SELECT COUNT(*) AS album_count FROM Album WHERE ArtistId IN (SELECT ArtistId FROM Artist WHERE Name = 'Alice In Chains')\"}, 'id': 'call_r5UlSwHKQcWDHx6LrttnqE56'}])]}}\n",
- "----\n",
- "{'action': {'messages': [ToolMessage(content='[(1,)]', name='sql_db_query', id='093058a9-f013-4be1-8e7a-ed839b0c90cd', tool_call_id='call_r5UlSwHKQcWDHx6LrttnqE56')]}}\n",
- "----\n",
- "{'agent': {'messages': [AIMessage(content='Alice In Chains has 11 albums.', response_metadata={'token_usage': {'completion_tokens': 9, 'prompt_tokens': 665, 'total_tokens': 674}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_3b956da36b', 'finish_reason': 'stop', 'logprobs': None}, id='run-f804eaab-9812-4fb3-ae8b-280af8594ac6-0')]}}\n",
- "----\n"
+ "ename": "NameError",
+ "evalue": "name 'agent' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[20], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m s \u001b[38;5;129;01min\u001b[39;00m \u001b[43magent\u001b[49m\u001b[38;5;241m.\u001b[39mstream(\n\u001b[1;32m 2\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m: [HumanMessage(content\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHow many albums does alis in chain have?\u001b[39m\u001b[38;5;124m\"\u001b[39m)]}\n\u001b[1;32m 3\u001b[0m ):\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(s)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m----\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'agent' is not defined"
]
}
],
@@ -793,7 +1082,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.1"
+ "version": "3.11.9"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/summarization.ipynb b/docs/docs/tutorials/summarization.ipynb
index 36375989b2b..5b676b1dd3f 100644
--- a/docs/docs/tutorials/summarization.ipynb
+++ b/docs/docs/tutorials/summarization.ipynb
@@ -153,10 +153,25 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "928585ec-6f6f-4b67-b2c8-0fc87186342b",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:36.672093Z",
+ "iopub.status.busy": "2024-09-12T00:00:36.671850Z",
+ "iopub.status.idle": "2024-09-12T00:00:38.148224Z",
+ "shell.execute_reply": "2024-09-12T00:00:38.147675Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"%pip install --upgrade --quiet tiktoken langchain langgraph beautifulsoup4\n",
"\n",
@@ -170,7 +185,14 @@
"cell_type": "code",
"execution_count": 2,
"id": "d6276d52-d33f-4b6a-aae3-2682df9eb8a7",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:38.151223Z",
+ "iopub.status.busy": "2024-09-12T00:00:38.151029Z",
+ "iopub.status.idle": "2024-09-12T00:00:38.153615Z",
+ "shell.execute_reply": "2024-09-12T00:00:38.153224Z"
+ }
+ },
"outputs": [],
"source": [
"import os\n",
@@ -188,10 +210,25 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 3,
"id": "23154e97-c4cb-4bcb-a742-f0c9d06639da",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:38.155525Z",
+ "iopub.status.busy": "2024-09-12T00:00:38.155385Z",
+ "iopub.status.idle": "2024-09-12T00:00:38.835267Z",
+ "shell.execute_reply": "2024-09-12T00:00:38.834714Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "USER_AGENT environment variable not set, consider setting it to identify your requests.\n"
+ ]
+ }
+ ],
"source": [
"from langchain_community.document_loaders import WebBaseLoader\n",
"\n",
@@ -217,9 +254,16 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 4,
"id": "b1c639d9-b27c-4e71-9312-d2666b05f1e3",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:38.838155Z",
+ "iopub.status.busy": "2024-09-12T00:00:38.837772Z",
+ "iopub.status.idle": "2024-09-12T00:00:39.094508Z",
+ "shell.execute_reply": "2024-09-12T00:00:39.094228Z"
+ }
+ },
"outputs": [],
"source": [
"# | output: false\n",
@@ -247,23 +291,30 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 5,
"id": "ef45585d",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:39.096123Z",
+ "iopub.status.busy": "2024-09-12T00:00:39.096047Z",
+ "iopub.status.idle": "2024-09-12T00:00:42.475364Z",
+ "shell.execute_reply": "2024-09-12T00:00:42.474425Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "The article \"LLM Powered Autonomous Agents\" by Lilian Weng discusses the development and capabilities of autonomous agents powered by large language models (LLMs). It outlines a system architecture that includes three main components: planning, memory, and tool use. \n",
+ "The article \"LLM Powered Autonomous Agents\" by Lilian Weng discusses the development and capabilities of autonomous agents powered by large language models (LLMs). It outlines a system overview that includes three main components: planning, memory, and tool use. \n",
"\n",
- "1. **Planning**: Agents decompose complex tasks into manageable subgoals and engage in self-reflection to improve their performance over time. Techniques like Chain of Thought (CoT) and Tree of Thoughts (ToT) are highlighted for enhancing reasoning and planning.\n",
+ "1. **Planning**: Agents can decompose complex tasks into manageable subgoals and reflect on past actions to improve future performance. Techniques like Chain of Thought (CoT) and Tree of Thoughts enhance reasoning and planning capabilities.\n",
"\n",
- "2. **Memory**: The article distinguishes between short-term and long-term memory, explaining how agents can utilize in-context learning and external vector stores for information retrieval. Maximum Inner Product Search (MIPS) algorithms are discussed for efficient memory access.\n",
+ "2. **Memory**: The article distinguishes between short-term and long-term memory, with short-term memory being akin to in-context learning and long-term memory utilizing external vector stores for information retrieval. Maximum Inner Product Search (MIPS) algorithms are discussed for efficient memory access.\n",
"\n",
"3. **Tool Use**: The integration of external tools allows agents to extend their capabilities beyond their inherent knowledge. Examples include MRKL systems and frameworks like HuggingGPT, which facilitate task planning and execution through API calls.\n",
"\n",
- "The article also addresses challenges faced by LLM-powered agents, such as finite context length, difficulties in long-term planning, and the reliability of natural language interfaces. It concludes with case studies demonstrating the practical applications of these agents in scientific discovery and interactive simulations.\n",
+ "The article also highlights challenges faced by LLM-powered agents, such as finite context length, difficulties in long-term planning, and the reliability of natural language interfaces. It concludes with case studies demonstrating the practical applications of these agents in scientific discovery and interactive simulations.\n",
"\n",
"Overall, the article emphasizes the potential of LLMs as general problem solvers and their ability to function as autonomous agents in various domains.\n"
]
@@ -299,23 +350,79 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 6,
"id": "b7a89b7a-0141-4689-b768-a2a50cdce7da",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:42.479809Z",
+ "iopub.status.busy": "2024-09-12T00:00:42.479295Z",
+ "iopub.status.idle": "2024-09-12T00:00:44.888767Z",
+ "shell.execute_reply": "2024-09-12T00:00:44.887888Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "|The| article| \"|LL|M| Powered| Autonomous| Agents|\"| by| Lil|ian| W|eng| discusses| the| development| and| capabilities| of| autonomous| agents| powered| by| large| language| models| (|LL|Ms|).| It| outlines| a| system| overview| that| includes| three| main| components|:| planning|,| memory|,| and| tool| use|.| \n",
+ "|The| article| \"|LL|M| Powered| Autonomous| Agents|\"| by| Lil|ian|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " W|eng| discusses| the| development| and| capabilities| of| autonomous| agents| powered| by| large| language| models| (|LL|Ms|).| It| outlines| a| system| overview| that| includes| three| main| components|:| planning|,| memory|,| and| tool| use|.| \n",
"\n",
- "|1|.| **|Planning|**| involves| task| decomposition|,| where| agents| break| down| complex| tasks| into| manageable| sub|go|als|,| and| self|-ref|lection|,| allowing| agents| to| learn| from| past| actions| to| improve| future| performance|.\n",
+ "|1|.| **|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Planning|**| involves| task| decomposition|,| where| agents| break| down| complex| tasks| into| manageable| sub|go|als|,| and| self|-ref|lection|,| allowing| agents|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " to| learn| from| past| actions| to| improve| future| performance|.\n",
"\n",
- "|2|.| **|Memory|**| is| categorized| into| short|-term| and| long|-term| memory|,| with| techniques| like| Maximum| Inner| Product| Search| (|M|IPS|)| used| for| efficient| information| retrieval|.\n",
+ "|2|.| **|Memory|**| is| categorized| into| short|-term| and| long|-term| memory|,| with| techniques| like| Maximum| Inner| Product| Search| (|M|IPS|)| used| for|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " efficient| information| retrieval|.\n",
"\n",
- "|3|.| **|Tool| Use|**| highlights| the| integration| of| external| APIs| to| enhance| the| agent|'s| capabilities|,| illustrated| through| case| studies| like| Chem|Crow| for| scientific| discovery| and| Gener|ative| Agents| for| sim|ulating| human| behavior|.\n",
+ "|3|.| **|Tool| Use|**| highlights| the| integration| of| external| APIs| to| enhance|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " the| agent|'s| capabilities|,| illustrated| through| case| studies| like| Chem|Crow| for| scientific| discovery| and| Gener|ative| Agents| for| sim|ulating| human| behavior|.\n",
"\n",
- "|The| article| also| addresses| challenges| such| as| finite| context| length|,| difficulties| in| long|-term| planning|,| and| the| reliability| of| natural| language| interfaces|.| It| concludes| with| references| to| various| studies| and| projects| that| contribute| to| the| field| of| L|LM|-powered| agents|.||"
+ "|The| article| also| addresses| challenges| such| as| finite| context| length|,| difficulties| in| long|-term| planning|,| and| the|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " reliability| of| natural| language| interfaces|.| It| concludes| with| references| to| various| studies| and| projects| that| contribute| to| the| field| of| L|LM|-powered| agents|,|"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " emphasizing| their| potential| as| general| problem| sol|vers| beyond| mere| text| generation|.||"
]
}
],
@@ -358,9 +465,16 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 7,
"id": "a1e6773c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:44.892613Z",
+ "iopub.status.busy": "2024-09-12T00:00:44.892334Z",
+ "iopub.status.idle": "2024-09-12T00:00:44.896714Z",
+ "shell.execute_reply": "2024-09-12T00:00:44.895987Z"
+ }
+ },
"outputs": [],
"source": [
"from langchain_core.output_parsers import StrOutputParser\n",
@@ -387,10 +501,26 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 8,
"id": "ce48b805-d98b-4e0f-8b9e-3b3e72cad3d3",
- "metadata": {},
- "outputs": [],
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:44.899630Z",
+ "iopub.status.busy": "2024-09-12T00:00:44.899435Z",
+ "iopub.status.idle": "2024-09-12T00:00:45.532339Z",
+ "shell.execute_reply": "2024-09-12T00:00:45.532000Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/bagatur/langchain/.venv/lib/python3.11/site-packages/langsmith/client.py:5301: LangChainBetaWarning: The function `loads` is in beta. It is actively being worked on, so the API may change.\n",
+ " prompt = loads(json.dumps(prompt_object.manifest))\n"
+ ]
+ }
+ ],
"source": [
"from langchain import hub\n",
"\n",
@@ -409,9 +539,16 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 9,
"id": "6a718890-99ab-439a-8f79-b9ae9c58ad24",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:45.534283Z",
+ "iopub.status.busy": "2024-09-12T00:00:45.534164Z",
+ "iopub.status.idle": "2024-09-12T00:00:45.536839Z",
+ "shell.execute_reply": "2024-09-12T00:00:45.536588Z"
+ }
+ },
"outputs": [],
"source": [
"# Also available via the hub: `hub.pull(\"rlm/reduce-prompt\")`\n",
@@ -443,9 +580,16 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 10,
"id": "7821efb9-e1de-4234-84d2-75dfe13b5a6c",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:45.538865Z",
+ "iopub.status.busy": "2024-09-12T00:00:45.538702Z",
+ "iopub.status.idle": "2024-09-12T00:00:45.697611Z",
+ "shell.execute_reply": "2024-09-12T00:00:45.697355Z"
+ }
+ },
"outputs": [
{
"name": "stderr",
@@ -482,9 +626,16 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 11,
"id": "10ced55c-9e3e-404f-abe9-83ac29ffaa5a",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:45.699087Z",
+ "iopub.status.busy": "2024-09-12T00:00:45.698994Z",
+ "iopub.status.idle": "2024-09-12T00:00:45.716791Z",
+ "shell.execute_reply": "2024-09-12T00:00:45.716577Z"
+ }
+ },
"outputs": [],
"source": [
"import operator\n",
@@ -607,18 +758,25 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 12,
"id": "0c8d41e4-664d-46f4-94e9-248971d428a6",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:45.718099Z",
+ "iopub.status.busy": "2024-09-12T00:00:45.718016Z",
+ "iopub.status.idle": "2024-09-12T00:00:48.278615Z",
+ "shell.execute_reply": "2024-09-12T00:00:48.277981Z"
+ }
+ },
"outputs": [
{
"data": {
- "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAA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ljcAWvY4bhzSCCCOwgqAyo8c1/gYWbnxOrZtyHbsbzckbBv8p5n7fyD+LfRc75id1J+1Y9aLCzoiLOgiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiCCz2LstvVszjY2y5Gqx0T67ncoswOILo9+4OBaCwnsB3G4D3EZeLzGP1HVe6vI2YMPJNBI3aSF/fySMPa1w+QhSSh8xpPGZydtixA+O4wcrbdWZ8E7R6h0jCHbfiJ2/EveLVm1EWbfu3SvzZ/VtT5rB/Zj6F9bj6rHBza0LXA7giMAhV/wAh5QNmamz0bR6vGWO/4uYT/wAV88iJ/anPf28Xwlezu+P0laRmtKKreRE/tTnv7eL4SidX6bnwuk81kfLfMYvxSlPY8esmOWKvyxud0j2NjBc1u25aCCQNt07O74/SSkZr+iqNXRk81WGTyszsnOwO52yxAO3HeB0fYvXyIn9qc9/bxfCTs7vj9JKRmsBx1Qkk1YST6+jCdW1PmsH9mPoVf8iJ/anPf28Xwl9Gh3kjpNS56Vv+qbTGb/pawH/inZ3fH6SUjNKZfPU8BFEx4dLYkHLXo1m800xHqYz5B2bk7NaO1xaASPLT2HmpPt375jdlbzg6cxElkbG7iOJhPaWtBPbsOZznu2bzco9MLpjGafdI+lW5Z5AGyWZpHTTyDvAdK8l7huT3k95UqubVqzZibNj375T5CIi8UEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAUJrjIHE6Lz94ZRuENbH2Jus3wdO2pyxuPTGP78M25uX17betTag9dXDjtE6httyMWIMGOsSjITw9NHV5YnHpXM+/a3bmLfWBsglqb+lqQP6QTczGnpANubs79vVuvZeNN/PUgd0gl3jaedo2DuzvA9S9kBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQFB65tvoaJ1Bajv18XJDjrEjb1uPpIaxEbiJHt++a3bcj1gFTigteXDj9D6itC/BizBjrEovWYemircsTj0j49jztbtuW+sDZBL03F9SBxe2QljTztGwd2d4XsvGk7npwO5xJvG087RsHdneB6l7ICIiAiIgIiICI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A0bPREX0kfidj5Iz0Ur4JmkPjmjOzo3g7tcPxggEfkXR2itQHVOk8VlXNayWzA10rGHdrJB2PaPxBwcP0LnTuW8eDVV9Xhphef/TNkst/kSyvkb/6Xhfm/blmzNxZt++J+8TX7Q7jcuqIi/FgiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiDEyuMr5rGWqFtnSVbMTopG77btI2Ox9R/Gucc7gLukcs7FZDd0gBdXsn7W1EOznH+0Ozmb3tJ+Qtc7plR+cwGP1Lj30cnUjuVnHfkkHa0+pzSO1pHqIIIX1vZ+nzoVqYmK2Z3x/uF+EuQsvwv0hqDIzZDJ6YxOQvTbGSzZpxvkfsABu4jc7AAfoWH5ltAj/6MwX93xfVXQ17gNVdI44/PXqjCSRHOyOcN/EDsHbflJP41ieYSz7UP9xb9Zfpo9oez7W2Zjyz0Snxaowen8Zpmg2jiaFbG0muLhXqxCNgJ7zsOztWetkeYSz7UP9xb9ZPMJZ9qH+4t+svWPamhRFIt+k9DD8Wt1Fah0phdW1oq+bxVPLQRP6RkdyBsrWu223AcDsditu+YSz7UP9xb9ZPMJZ9qH+4t+sk+1NCtRSbfpPQw/FoUcGdBAEDRuDAI2O1CLt/9KkMFw40rpi+L2I05i8ZcDSwT1KjI3hp7xuBvsVurzCWfah/uLfrLOocBse2QOyWZyF+MHtgiLa7HD5CWDn/qcF5T7R9n2P1WZ5WZ6QU+LXul9JWNdZM4+HnZRYQL1pjtuiYRvyA/67h2DbuB5j6gejoII60McMTGxxRtDGMaNg0AbAALwxeJp4SjFSx9WKnViGzIoWhrR8p/Ke8n1rLX5fT9OtabbiaUsxug+AiIvlgiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiD//Z",
"text/plain": [
""
]
},
- "execution_count": 14,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -641,9 +799,16 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 13,
"id": "b5e32a3c-f43e-4e18-a32d-466403afa844",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:00:48.282848Z",
+ "iopub.status.busy": "2024-09-12T00:00:48.282576Z",
+ "iopub.status.idle": "2024-09-12T00:01:07.993845Z",
+ "shell.execute_reply": "2024-09-12T00:01:07.993290Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
@@ -652,20 +817,73 @@
"['generate_summary']\n",
"['generate_summary']\n",
"['generate_summary']\n",
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"['generate_summary']\n",
"['generate_summary']\n",
"['generate_summary']\n",
"['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['generate_summary']\n",
- "['collect_summaries']\n",
- "['collapse_summaries']\n",
- "['collapse_summaries']\n",
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['generate_summary']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['collect_summaries']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "['collapse_summaries']\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"['generate_final_summary']\n"
]
}
@@ -680,15 +898,22 @@
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 14,
"id": "b0b28b30-d12b-4a30-a0e2-f897adab68c9",
- "metadata": {},
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-09-12T00:01:07.997347Z",
+ "iopub.status.busy": "2024-09-12T00:01:07.997109Z",
+ "iopub.status.idle": "2024-09-12T00:01:08.000786Z",
+ "shell.execute_reply": "2024-09-12T00:01:08.000282Z"
+ }
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "{'generate_final_summary': {'final_summary': 'The consolidated summary of the main themes from the provided documents is as follows:\\n\\n1. **Integration of Large Language Models (LLMs) in Autonomous Agents**: The documents explore the evolving role of LLMs in autonomous systems, emphasizing their enhanced reasoning and acting capabilities through methodologies that incorporate structured planning, memory systems, and tool use.\\n\\n2. **Core Components of Autonomous Agents**:\\n - **Planning**: Techniques like task decomposition (e.g., Chain of Thought) and external classical planners are utilized to facilitate long-term planning by breaking down complex tasks.\\n - **Memory**: The memory system is divided into short-term (in-context learning) and long-term memory, with parallels drawn between human memory and machine learning to improve agent performance.\\n - **Tool Use**: Agents utilize external APIs and algorithms to enhance problem-solving abilities, exemplified by frameworks like HuggingGPT that manage task workflows.\\n\\n3. **Neuro-Symbolic Architectures**: The integration of MRKL (Modular Reasoning, Knowledge, and Language) systems combines neural and symbolic expert modules with LLMs, addressing challenges in tasks such as verbal math problem-solving.\\n\\n4. **Specialized Applications**: Case studies, such as ChemCrow and projects in anticancer drug discovery, demonstrate the advantages of LLMs augmented with expert tools in specialized domains.\\n\\n5. **Challenges and Limitations**: The documents highlight challenges such as hallucination in model outputs and the finite context length of LLMs, which affects their ability to incorporate historical information and perform self-reflection. Techniques like Chain of Hindsight and Algorithm Distillation are discussed to enhance model performance through iterative learning.\\n\\n6. **Structured Software Development**: A systematic approach to creating Python software projects is emphasized, focusing on defining core components, managing dependencies, and adhering to best practices for documentation.\\n\\nOverall, the integration of structured planning, memory systems, and advanced tool use aims to enhance the capabilities of LLM-powered autonomous agents while addressing the challenges and limitations these technologies face in real-world applications.'}}\n"
+ "{'generate_final_summary': {'final_summary': 'The consolidated summary of the main themes from the provided documents highlights the integration of large language models (LLMs) in autonomous agents, emphasizing their capabilities in planning, memory, and tool use, as well as advancements in neuro-symbolic architectures. Key points include:\\n\\n1. **Autonomous Agents and LLMs**: LLMs are central to the functioning of autonomous agents, enabling complex task execution through structured planning and self-reflection. Techniques such as Chain of Thought (CoT) and Tree of Thoughts facilitate task decomposition, while external planners support long-term planning.\\n\\n2. **Challenges and Improvements**: Hallucination remains a significant challenge for autonomous agents. Methods like Chain of Hindsight (CoH) and Algorithm Distillation (AD) are being explored to enhance model outputs and learning efficiency through feedback mechanisms.\\n\\n3. **Memory and Reinforcement Learning**: The importance of various memory types (sensory, short-term, long-term) in both human cognition and machine learning is discussed, along with techniques for improving memory retrieval, such as Maximum Inner Product Search (MIPS) and approximate nearest neighbor algorithms.\\n\\n4. **Neuro-Symbolic Architectures**: The documents explore MRKL (Modular Reasoning, Knowledge and Language) systems that combine neural and symbolic modules with LLMs for effective task management. Frameworks like TALM, Toolformer, and HuggingGPT enhance LLM capabilities by integrating external tools and APIs.\\n\\n5. **Best Practices in Software Development**: The creation of structured codebases for software projects is emphasized, focusing on best practices in coding, file organization, and documentation. Limitations of LLMs, such as finite context length and challenges in long-term planning, are also noted.\\n\\n6. **Applications and Case Studies**: The application of LLMs in specialized domains, such as scientific discovery and anticancer drug research, is highlighted, showcasing their potential to outperform general models when using expert tools. The Generative Agents Simulation illustrates the use of LLMs in simulating human-like interactions.\\n\\nOverall, the integration of LLMs in autonomous agents and neuro-symbolic systems demonstrates their potential as general problem solvers while addressing challenges related to hallucination, memory, and planning strategies. The documents reflect a blend of advancements in AI and best practices in software development, underscoring the evolving role of AI in enhancing automation and decision-making across various domains.'}}\n"
]
}
],
@@ -752,7 +977,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.4"
+ "version": "3.11.9"
}
},
"nbformat": 4,