Skip to content

Commit

Permalink
small fixes (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 authored Sep 6, 2024
1 parent fb9f67c commit dc1e33f
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 30 deletions.
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/background_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/check_thread_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Find idle threads
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/enqueue_concurrent.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ Then, let's import our required packages and instantiate our client, assistant,
```bash
curl --request POST \
--url <DEPLOYMENT_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":
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/human_in_the_loop_breakpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Adding a breakpoint
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/human_in_the_loop_edit_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Editing state
Expand Down
17 changes: 9 additions & 8 deletions docs/docs/cloud/how-tos/human_in_the_loop_review_tool_calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Example with no review
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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",
):
Expand Down Expand Up @@ -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",
):
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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",
):
Expand Down Expand Up @@ -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":
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/human_in_the_loop_time_travel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Replay a state
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/human_in_the_loop_user_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

## Waiting for user input
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/interrupt_concurrent.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Now, let's import our required packages and instantiate our client, assistant, a
```bash
curl --request POST \
--url <DEPLOYMENT_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:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/reject_concurrent.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Now, let's import our required packages and instantiate our client, assistant, a
```bash
curl --request POST \
--url <DEPLOYMENT_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:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/rollback_concurrent.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ Now, let's import our required packages and instantiate our client, assistant, a
```bash
curl --request POST \
--url <DEPLOYMENT_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":
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/stream_debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```


Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/stream_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ This guide covers how to stream events from your graph (`stream_mode="events"`).
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/stream_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/cloud/how-tos/stream_multiple.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand Down
11 changes: 8 additions & 3 deletions docs/docs/cloud/how-tos/stream_updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ First let's set up our client and thread:
from langgraph_sdk import get_client

client = get_client(url=<DEPLOYMENT_URL>)
# Using the graph deployed with the name "agent"
assistant_id = "agent"
# create thread
thread = await client.threads.create()
print(thread)
Expand All @@ -21,6 +23,8 @@ First let's set up our client and thread:
import { Client } from "@langchain/langgraph-sdk";

const client = new Client({ apiUrl: <DEPLOYMENT_URL> });
// Using the graph deployed with the name "agent"
const assistantID = "agent";
// create thread
const thread = await client.threads.create();
console.log(thread);
Expand All @@ -31,7 +35,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand Down Expand Up @@ -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",
):
Expand All @@ -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"
Expand Down
15 changes: 10 additions & 5 deletions docs/docs/cloud/how-tos/stream_values.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ First let's set up our client and thread:
from langgraph_sdk import get_client

client = get_client(url=<DEPLOYMENT_URL>)
# Using the graph deployed with the name "agent"
assistant_id = "agent"
# create thread
thread = await client.threads.create()
print(thread)
Expand All @@ -21,6 +23,8 @@ First let's set up our client and thread:
import { Client } from "@langchain/langgraph-sdk";

const client = new Client({ apiUrl: <DEPLOYMENT_URL> });
// Using the graph deployed with the name "agent"
const assistantID = "agent";
// create thread
const thread = await client.threads.create();
console.log(thread);
Expand All @@ -31,7 +35,8 @@ First let's set up our client and thread:
```bash
curl --request POST \
--url <DEPLOYMENT_URL>/threads \
--header 'Content-Type: application/json'
--header 'Content-Type: application/json' \
--data '{}'
```

Output:
Expand All @@ -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"
):
Expand All @@ -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"
Expand Down Expand Up @@ -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"
):
Expand All @@ -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"
Expand Down

0 comments on commit dc1e33f

Please sign in to comment.