Skip to content

Commit

Permalink
docs: thread_ts -> checkpoint_id (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 authored Sep 22, 2024
1 parent 41537c5 commit 94433eb
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 203 deletions.
87 changes: 53 additions & 34 deletions docs/docs/cloud/how-tos/langgraph_to_langgraph_cloud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 10,
"id": "3ab06b39-7bd1-4611-a37e-9b94e25643d2",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -211,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 13,
"id": "0d81c783-2c7b-421a-a0f9-752e22039472",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -538,7 +538,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 14,
"id": "90b312d3-4b51-4953-8c78-8263a90b397a",
"metadata": {},
"outputs": [],
Expand All @@ -548,7 +548,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 15,
"id": "3e523086-29ab-4b21-b762-21136d32e6fa",
"metadata": {},
"outputs": [
Expand All @@ -570,7 +570,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 16,
"id": "f430c8ec-782c-4003-9e30-0736cbdd37ce",
"metadata": {},
"outputs": [
Expand All @@ -580,20 +580,20 @@
"text": [
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"New York City (NYC) is known for a variety of iconic landmarks, cultural institutions, and vibrant neighborhoods. Some of the most notable features include:\n",
"New York City (NYC) is known for a variety of iconic landmarks, cultural institutions, and vibrant neighborhoods. Some of the most notable things NYC is known for include:\n",
"\n",
"1. **Statue of Liberty**: A symbol of freedom and democracy.\n",
"1. **Statue of Liberty**: A symbol of freedom and democracy, located on Liberty Island.\n",
"2. **Times Square**: Known for its bright lights, Broadway theaters, and bustling atmosphere.\n",
"3. **Central Park**: A large urban park offering a natural retreat in the middle of the city.\n",
"3. **Central Park**: A large urban park offering a green oasis in the middle of the city.\n",
"4. **Empire State Building**: An iconic skyscraper with an observation deck offering panoramic views of the city.\n",
"5. **Broadway**: Famous for its world-class theater productions.\n",
"6. **Wall Street**: The financial hub of the United States.\n",
"5. **Broadway**: Famous for its world-class theater productions and musicals.\n",
"6. **Wall Street**: The financial hub of the United States, home to the New York Stock Exchange.\n",
"7. **Museums**: Including the Metropolitan Museum of Art, the Museum of Modern Art (MoMA), and the American Museum of Natural History.\n",
"8. **Diverse Cuisine**: A melting pot of culinary experiences from around the world.\n",
"9. **Cultural Diversity**: A rich tapestry of cultures, languages, and traditions.\n",
"10. **Fashion**: A global fashion capital, home to New York Fashion Week.\n",
"8. **Diverse Cuisine**: A melting pot of culinary experiences, from street food to Michelin-starred restaurants.\n",
"9. **Cultural Diversity**: A rich tapestry of cultures and communities from around the world.\n",
"10. **Skyscrapers**: A skyline filled with iconic buildings and modern architecture.\n",
"\n",
"These are just a few highlights of what makes NYC a unique and vibrant city.\n"
"NYC is also known for its influence in fashion, media, and entertainment, making it one of the most dynamic and influential cities in the world.\n"
]
}
],
Expand All @@ -605,7 +605,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 17,
"id": "cb34efef-805d-455c-be3e-e2234d97b7cf",
"metadata": {},
"outputs": [],
Expand All @@ -615,7 +615,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 18,
"id": "7628e108-338b-4eaf-9d57-defc2c7e2b46",
"metadata": {},
"outputs": [
Expand All @@ -637,7 +637,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 19,
"id": "22a3f9e6-a550-4074-95eb-be3866b77718",
"metadata": {},
"outputs": [
Expand All @@ -649,45 +649,64 @@
" 'response_metadata': {},\n",
" 'type': 'human',\n",
" 'name': None,\n",
" 'id': 'b62078f1-7c44-4a0e-b7b0-05e475ae3188',\n",
" 'id': '381cd144-b360-4c7d-8177-e2634446993c',\n",
" 'example': False},\n",
" {'content': 'Could you please specify what \"it\" refers to? Are you asking about a specific city, person, object, or something else?',\n",
" 'additional_kwargs': {},\n",
" 'response_metadata': {'finish_reason': 'stop'},\n",
" 'additional_kwargs': {'refusal': None},\n",
" 'response_metadata': {'token_usage': {'completion_tokens': 28,\n",
" 'prompt_tokens': 57,\n",
" 'total_tokens': 85,\n",
" 'completion_tokens_details': {'reasoning_tokens': 0}},\n",
" 'model_name': 'gpt-4o-2024-05-13',\n",
" 'system_fingerprint': 'fp_3537616b13',\n",
" 'finish_reason': 'stop',\n",
" 'logprobs': None},\n",
" 'type': 'ai',\n",
" 'name': None,\n",
" 'id': 'run-502c6cf3-d584-4e31-98a6-5e59f1d2a72f',\n",
" 'id': 'run-b23c6a05-d6c7-46fd-8b09-443a334feb6b-0',\n",
" 'example': False,\n",
" 'tool_calls': [],\n",
" 'invalid_tool_calls': [],\n",
" 'usage_metadata': None}]},\n",
" 'usage_metadata': {'input_tokens': 57,\n",
" 'output_tokens': 28,\n",
" 'total_tokens': 85}}]},\n",
" 'next': [],\n",
" 'config': {'configurable': {'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n",
" 'thread_ts': '1ef303f9-7d8e-6d0a-8001-2b4ce14235da'}},\n",
" 'tasks': [],\n",
" 'metadata': {'step': 1,\n",
" 'run_id': '1ef303f9-73e6-6c6b-b407-39938d3dfd7e',\n",
" 'run_id': '1ef78309-0a79-6667-a00b-1a04034cabff',\n",
" 'source': 'loop',\n",
" 'writes': {'agent': {'messages': [{'id': 'run-502c6cf3-d584-4e31-98a6-5e59f1d2a72f',\n",
" 'writes': {'agent': {'messages': [{'id': 'run-b23c6a05-d6c7-46fd-8b09-443a334feb6b-0',\n",
" 'name': None,\n",
" 'type': 'ai',\n",
" 'content': 'Could you please specify what \"it\" refers to? Are you asking about a specific city, person, object, or something else?',\n",
" 'example': False,\n",
" 'tool_calls': [],\n",
" 'usage_metadata': None,\n",
" 'additional_kwargs': {},\n",
" 'response_metadata': {'finish_reason': 'stop'},\n",
" 'usage_metadata': {'input_tokens': 57,\n",
" 'total_tokens': 85,\n",
" 'output_tokens': 28},\n",
" 'additional_kwargs': {'refusal': None},\n",
" 'response_metadata': {'logprobs': None,\n",
" 'model_name': 'gpt-4o-2024-05-13',\n",
" 'token_usage': {'total_tokens': 85,\n",
" 'prompt_tokens': 57,\n",
" 'completion_tokens': 28,\n",
" 'completion_tokens_details': {'reasoning_tokens': 0}},\n",
" 'finish_reason': 'stop',\n",
" 'system_fingerprint': 'fp_3537616b13'},\n",
" 'invalid_tool_calls': []}]}},\n",
" 'parents': {},\n",
" 'user_id': '',\n",
" 'graph_id': 'agent',\n",
" 'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n",
" 'thread_id': '14162c42-ab85-404f-a2f9-e7207493f74b',\n",
" 'created_by': 'system',\n",
" 'run_attempt': 1,\n",
" 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n",
" 'created_at': '2024-06-22T02:31:56.042330+00:00',\n",
" 'parent_config': {'configurable': {'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n",
" 'thread_ts': '1ef303f9-7400-6e2c-8000-e8d5075bfa2a'}}}"
" 'created_at': '2024-09-21T15:45:46.150887+00:00',\n",
" 'checkpoint_id': '1ef78309-131f-673f-8001-55ea44389e6a',\n",
" 'parent_checkpoint_id': '1ef78309-0aab-6271-8000-caaf708a2185'}"
]
},
"execution_count": 23,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
17 changes: 9 additions & 8 deletions docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "6098e5cb",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -384,7 +384,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "cfd140f0-a5a6-4697-8115-322242f197b5",
"metadata": {},
"outputs": [
Expand All @@ -397,10 +397,10 @@
"search for the weather in sf now\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"[{'text': \"Certainly! I can help you search for the current weather in San Francisco. To do this, I'll use the search function to look up the most up-to-date weather information. Let me do that for you right away.\", 'type': 'text'}, {'id': 'toolu_01FSkinAVXR1C4D5kecrzAnj', 'input': {'query': 'current weather in San Francisco'}, 'name': 'search', 'type': 'tool_use'}]\n",
"[{'text': \"Certainly! I'll search for the current weather in San Francisco for you. Let me use the search function to find this information.\", 'type': 'text'}, {'id': 'toolu_01DxRhkj4fAvaGWoBhVuvfeL', 'input': {'query': 'current weather in San Francisco'}, 'name': 'search', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" search (toolu_01FSkinAVXR1C4D5kecrzAnj)\n",
" Call ID: toolu_01FSkinAVXR1C4D5kecrzAnj\n",
" search (toolu_01DxRhkj4fAvaGWoBhVuvfeL)\n",
" Call ID: toolu_01DxRhkj4fAvaGWoBhVuvfeL\n",
" Args:\n",
" query: current weather in San Francisco\n"
]
Expand All @@ -427,18 +427,19 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"id": "1aa7b1b9-9322-4815-bc0d-eb083870ac15",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'configurable': {'thread_id': '3',\n",
" 'thread_ts': '1ef3e229-4126-628c-8002-2a809f9bb238'}}"
" 'checkpoint_ns': '',\n",
" 'checkpoint_id': '1ef7830a-c688-6fc6-8002-824126081ba0'}}"
]
},
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
17 changes: 5 additions & 12 deletions docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 5,
"id": "58eae42d-be32-48da-8d0a-ab64471657d9",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -173,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 6,
"id": "eb8e7d47-e7c9-4217-b72c-08394a2c4d3e",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -208,23 +208,16 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 7,
"id": "2165a1bc-1c5b-411f-9e9c-a2b9627e5d56",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tell me how you want to update the state: go to step 3!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"--State after update--\n",
"StateSnapshot(values={'input': 'hello world', 'user_feedback': 'go to step 3!'}, next=('step_3',), config={'configurable': {'thread_id': '1', 'thread_ts': '1ef3e216-b8a2-6db4-8002-966ecca671d0'}}, metadata={'source': 'update', 'step': 2, 'writes': {'human_feedback': {'user_feedback': 'go to step 3!'}}}, created_at='2024-07-09T18:31:13.083519+00:00', parent_config=None)\n"
"StateSnapshot(values={'input': 'hello world', 'user_feedback': 'go to step 3!'}, next=('step_3',), config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef7830e-b807-6142-8002-1b511e4caf96'}}, metadata={'source': 'update', 'step': 2, 'writes': {'human_feedback': {'user_feedback': 'go to step 3!'}}, 'parents': {}}, created_at='2024-09-21T15:48:17.660131+00:00', parent_config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef7830e-36d1-6f1e-8001-4d4c913ae8a8'}}, tasks=(PregelTask(id='6b5486bf-eb6c-0e27-4784-cad2a69b86a2', name='step_3', path=('__pregel_pull', 'step_3'), error=None, interrupts=(), state=None),))\n"
]
},
{
Expand All @@ -233,7 +226,7 @@
"('step_3',)"
]
},
"execution_count": 63,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
Loading

0 comments on commit 94433eb

Please sign in to comment.