From dc1e33f4de740e551a02c9fc9cc4dad93e6f93bb Mon Sep 17 00:00:00 2001 From: Isaac Francisco <78627776+isahers1@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:34:37 -0700 Subject: [PATCH] small fixes (#1629) --- docs/docs/cloud/how-tos/background_run.md | 3 ++- docs/docs/cloud/how-tos/check_thread_status.md | 3 ++- docs/docs/cloud/how-tos/enqueue_concurrent.md | 3 ++- .../how-tos/human_in_the_loop_breakpoint.md | 3 ++- .../how-tos/human_in_the_loop_edit_state.md | 3 ++- .../human_in_the_loop_review_tool_calls.md | 17 +++++++++-------- .../how-tos/human_in_the_loop_time_travel.md | 3 ++- .../how-tos/human_in_the_loop_user_input.md | 3 ++- docs/docs/cloud/how-tos/interrupt_concurrent.md | 3 ++- docs/docs/cloud/how-tos/reject_concurrent.md | 3 ++- docs/docs/cloud/how-tos/rollback_concurrent.md | 3 ++- docs/docs/cloud/how-tos/stream_debug.md | 3 ++- docs/docs/cloud/how-tos/stream_events.md | 3 ++- docs/docs/cloud/how-tos/stream_messages.md | 3 ++- docs/docs/cloud/how-tos/stream_multiple.md | 3 ++- docs/docs/cloud/how-tos/stream_updates.md | 11 ++++++++--- docs/docs/cloud/how-tos/stream_values.md | 15 ++++++++++----- 17 files changed, 55 insertions(+), 30 deletions(-) diff --git a/docs/docs/cloud/how-tos/background_run.md b/docs/docs/cloud/how-tos/background_run.md index d648e25b0..9dc23a1c7 100644 --- a/docs/docs/cloud/how-tos/background_run.md +++ b/docs/docs/cloud/how-tos/background_run.md @@ -36,7 +36,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: diff --git a/docs/docs/cloud/how-tos/check_thread_status.md b/docs/docs/cloud/how-tos/check_thread_status.md index 5fb26c403..8e9d5f196 100644 --- a/docs/docs/cloud/how-tos/check_thread_status.md +++ b/docs/docs/cloud/how-tos/check_thread_status.md @@ -34,7 +34,8 @@ First, we need to setup our client so that we can communicate with our hosted gr ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Find idle threads diff --git a/docs/docs/cloud/how-tos/enqueue_concurrent.md b/docs/docs/cloud/how-tos/enqueue_concurrent.md index 5172b8ac6..06864e876 100644 --- a/docs/docs/cloud/how-tos/enqueue_concurrent.md +++ b/docs/docs/cloud/how-tos/enqueue_concurrent.md @@ -78,7 +78,8 @@ Then, let's import our required packages and instantiate our client, assistant, ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Now let's start two runs, with the second interrupting the first one with a multitask strategy of "enqueue": diff --git a/docs/docs/cloud/how-tos/human_in_the_loop_breakpoint.md b/docs/docs/cloud/how-tos/human_in_the_loop_breakpoint.md index 08eaa0f3d..120f55998 100644 --- a/docs/docs/cloud/how-tos/human_in_the_loop_breakpoint.md +++ b/docs/docs/cloud/how-tos/human_in_the_loop_breakpoint.md @@ -43,7 +43,8 @@ In this how-to we use a simple ReAct style hosted graph (you can see the full co ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Adding a breakpoint diff --git a/docs/docs/cloud/how-tos/human_in_the_loop_edit_state.md b/docs/docs/cloud/how-tos/human_in_the_loop_edit_state.md index 927df7164..e4a2ec3c9 100644 --- a/docs/docs/cloud/how-tos/human_in_the_loop_edit_state.md +++ b/docs/docs/cloud/how-tos/human_in_the_loop_edit_state.md @@ -39,7 +39,8 @@ First, we need to setup our client so that we can communicate with our hosted gr ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Editing state diff --git a/docs/docs/cloud/how-tos/human_in_the_loop_review_tool_calls.md b/docs/docs/cloud/how-tos/human_in_the_loop_review_tool_calls.md index 69f247807..7ea17a07d 100644 --- a/docs/docs/cloud/how-tos/human_in_the_loop_review_tool_calls.md +++ b/docs/docs/cloud/how-tos/human_in_the_loop_review_tool_calls.md @@ -50,7 +50,8 @@ First, we need to setup our client so that we can communicate with our hosted gr ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Example with no review @@ -177,7 +178,7 @@ Let's now look at what it looks like to approve a tool call. Note that we don't async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, ): if chunk.data and chunk.event != "metadata": @@ -278,7 +279,7 @@ To approve the tool call, we can just continue the thread with no edits. To do t ```python async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=None, stream_mode="values", ): @@ -352,7 +353,7 @@ Let's now say we want to edit the tool call. E.g. change some of the parameters async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, stream_mode="values", ): @@ -465,7 +466,7 @@ To do this, we first need to update the state. We can do this by passing a messa # Let's now continue executing from here async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=None, ): if chunk.data and chunk.event != "metadata": @@ -608,7 +609,7 @@ For this example we will just add a single tool call representing the feedback. async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, ): if chunk.data and chunk.event != "metadata": @@ -708,7 +709,7 @@ To do this, we first need to update the state. We can do this by passing a messa # Let's now continue executing from here async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=None, stream_mode="values", ): @@ -827,7 +828,7 @@ We can see that we now get to another breakpoint - because it went back to the m ```python async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=None, ): if chunk.data and chunk.event != "metadata": diff --git a/docs/docs/cloud/how-tos/human_in_the_loop_time_travel.md b/docs/docs/cloud/how-tos/human_in_the_loop_time_travel.md index 69b418784..d24b5d060 100644 --- a/docs/docs/cloud/how-tos/human_in_the_loop_time_travel.md +++ b/docs/docs/cloud/how-tos/human_in_the_loop_time_travel.md @@ -36,7 +36,8 @@ First, we need to setup our client so that we can communicate with our hosted gr ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Replay a state diff --git a/docs/docs/cloud/how-tos/human_in_the_loop_user_input.md b/docs/docs/cloud/how-tos/human_in_the_loop_user_input.md index 435b49158..78f4fddca 100644 --- a/docs/docs/cloud/how-tos/human_in_the_loop_user_input.md +++ b/docs/docs/cloud/how-tos/human_in_the_loop_user_input.md @@ -46,7 +46,8 @@ First, we need to setup our client so that we can communicate with our hosted gr ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` ## Waiting for user input diff --git a/docs/docs/cloud/how-tos/interrupt_concurrent.md b/docs/docs/cloud/how-tos/interrupt_concurrent.md index 5ac9934b5..cbf789306 100644 --- a/docs/docs/cloud/how-tos/interrupt_concurrent.md +++ b/docs/docs/cloud/how-tos/interrupt_concurrent.md @@ -75,7 +75,8 @@ Now, let's import our required packages and instantiate our client, assistant, a ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Now we can start our two runs and join the second on euntil it has completed: diff --git a/docs/docs/cloud/how-tos/reject_concurrent.md b/docs/docs/cloud/how-tos/reject_concurrent.md index d94bb27a6..8e302ce26 100644 --- a/docs/docs/cloud/how-tos/reject_concurrent.md +++ b/docs/docs/cloud/how-tos/reject_concurrent.md @@ -74,7 +74,8 @@ Now, let's import our required packages and instantiate our client, assistant, a ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Now we can run a thread and try to run a second one with the "reject" option, which should fail since we have already started a run: diff --git a/docs/docs/cloud/how-tos/rollback_concurrent.md b/docs/docs/cloud/how-tos/rollback_concurrent.md index cabc584c0..1bb31b2a9 100644 --- a/docs/docs/cloud/how-tos/rollback_concurrent.md +++ b/docs/docs/cloud/how-tos/rollback_concurrent.md @@ -76,7 +76,8 @@ Now, let's import our required packages and instantiate our client, assistant, a ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Now let's run a thread with the multitask parameter set to "rollback": diff --git a/docs/docs/cloud/how-tos/stream_debug.md b/docs/docs/cloud/how-tos/stream_debug.md index 2dac3d7d7..e783b7f72 100644 --- a/docs/docs/cloud/how-tos/stream_debug.md +++ b/docs/docs/cloud/how-tos/stream_debug.md @@ -39,7 +39,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` diff --git a/docs/docs/cloud/how-tos/stream_events.md b/docs/docs/cloud/how-tos/stream_events.md index fcac1dedc..e9fdb1710 100644 --- a/docs/docs/cloud/how-tos/stream_events.md +++ b/docs/docs/cloud/how-tos/stream_events.md @@ -33,7 +33,8 @@ This guide covers how to stream events from your graph (`stream_mode="events"`). ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: diff --git a/docs/docs/cloud/how-tos/stream_messages.md b/docs/docs/cloud/how-tos/stream_messages.md index d52e69ebd..5d7d8ed61 100644 --- a/docs/docs/cloud/how-tos/stream_messages.md +++ b/docs/docs/cloud/how-tos/stream_messages.md @@ -71,7 +71,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: diff --git a/docs/docs/cloud/how-tos/stream_multiple.md b/docs/docs/cloud/how-tos/stream_multiple.md index 39c87aa7e..4d11aa026 100644 --- a/docs/docs/cloud/how-tos/stream_multiple.md +++ b/docs/docs/cloud/how-tos/stream_multiple.md @@ -35,7 +35,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: diff --git a/docs/docs/cloud/how-tos/stream_updates.md b/docs/docs/cloud/how-tos/stream_updates.md index ef101b268..fe68bac3b 100644 --- a/docs/docs/cloud/how-tos/stream_updates.md +++ b/docs/docs/cloud/how-tos/stream_updates.md @@ -10,6 +10,8 @@ First let's set up our client and thread: from langgraph_sdk import get_client client = get_client(url=) + # Using the graph deployed with the name "agent" + assistant_id = "agent" # create thread thread = await client.threads.create() print(thread) @@ -21,6 +23,8 @@ First let's set up our client and thread: import { Client } from "@langchain/langgraph-sdk"; const client = new Client({ apiUrl: }); + // Using the graph deployed with the name "agent" + const assistantID = "agent"; // create thread const thread = await client.threads.create(); console.log(thread); @@ -31,7 +35,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: @@ -62,7 +67,7 @@ Now we can stream by updates, which outputs updates made to the state by each no } async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, stream_mode="updates", ): @@ -85,7 +90,7 @@ Now we can stream by updates, which outputs updates made to the state by each no const streamResponse = client.runs.stream( thread["thread_id"], - "agent", + assistantID, { input, streamMode: "updates" diff --git a/docs/docs/cloud/how-tos/stream_values.md b/docs/docs/cloud/how-tos/stream_values.md index d43bc6cea..334c816c5 100644 --- a/docs/docs/cloud/how-tos/stream_values.md +++ b/docs/docs/cloud/how-tos/stream_values.md @@ -10,6 +10,8 @@ First let's set up our client and thread: from langgraph_sdk import get_client client = get_client(url=) + # Using the graph deployed with the name "agent" + assistant_id = "agent" # create thread thread = await client.threads.create() print(thread) @@ -21,6 +23,8 @@ First let's set up our client and thread: import { Client } from "@langchain/langgraph-sdk"; const client = new Client({ apiUrl: }); + // Using the graph deployed with the name "agent" + const assistantID = "agent"; // create thread const thread = await client.threads.create(); console.log(thread); @@ -31,7 +35,8 @@ First let's set up our client and thread: ```bash curl --request POST \ --url /threads \ - --header 'Content-Type: application/json' + --header 'Content-Type: application/json' \ + --data '{}' ``` Output: @@ -56,7 +61,7 @@ Now we can stream by values, which streams the full state of the graph after eac # stream values async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, stream_mode="values" ): @@ -72,7 +77,7 @@ Now we can stream by values, which streams the full state of the graph after eac const streamResponse = client.runs.stream( thread["thread_id"], - "agent", + assistantID, { input, streamMode: "values" @@ -164,7 +169,7 @@ If we want to just get the final result, we can use this endpoint and just keep final_answer = None async for chunk in client.runs.stream( thread["thread_id"], - "agent", + assistant_id, input=input, stream_mode="values" ): @@ -178,7 +183,7 @@ If we want to just get the final result, we can use this endpoint and just keep let finalAnswer; const streamResponse = client.runs.stream( thread["thread_id"], - "agent", + assistantID, { input, streamMode: "values"