From 2eba27b01f3f0b7bf4c09107baca43d855f3d2fb Mon Sep 17 00:00:00 2001 From: yasonk Date: Tue, 18 Mar 2025 15:00:49 -0700 Subject: [PATCH] docs: fix typo in hil how to doc (#3850) Current text in the doc is incorrect: ``` Use the search tool to ask the user where they are, then look up the weather there ``` The search tool is not the one to use. Instead should just tell the model to ask the user. In addition, an important step is missing and makes the code seem less impactful: ```python location = interrupt("Please provide your location:") ``` The question to ask the human is actually coming from the LLM, there is no need to hardcode it: ```python ... location = interrupt(ask.question) ``` Before merging, someone who validates this should push an update to cell outputs. I cleared it out from my branch because it made too many updates to the file and would make it harder to review. Co-authored-by: Eugene Yurtsev --- docs/docs/cloud/how-tos/human_in_the_loop_user_input.md | 7 +++---- docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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 e083394e7..78c01f8bf 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 @@ -63,7 +63,7 @@ Now, let's invoke our graph by interrupting before `ask_human` node: "messages": [ { "role": "user", - "content": "Use the search tool to ask the user where they are, then look up the weather there", + "content": "Ask the user where they are, then look up the weather there", } ] } @@ -85,8 +85,7 @@ Now, let's invoke our graph by interrupting before `ask_human` node: messages: [ { role: "human", - content: "Use the search tool to ask the user where they are, then look up the weather there" - } + content: "Ask the user where they are, then look up the weather there" } ] }; @@ -115,7 +114,7 @@ Now, let's invoke our graph by interrupting before `ask_human` node: --header 'Content-Type: application/json' \ --data "{ \"assistant_id\": \"agent\", - \"input\": {\"messages\": [{\"role\": \"human\", \"content\": \"Use the search tool to ask the user where they are, then look up the weather there\"}]}, + \"input\": {\"messages\": [{\"role\": \"human\", \"content\": \"Ask the user where they are, then look up the weather there\"}]}, \"interrupt_before\": [\"ask_human\"], \"stream_mode\": [ \"updates\" diff --git a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb index 8ddc73678..6ffca2b6b 100644 --- a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb @@ -397,7 +397,8 @@ "# We define a fake node to ask the human\n", "def ask_human(state):\n", " tool_call_id = state[\"messages\"][-1].tool_calls[0][\"id\"]\n", - " location = interrupt(\"Please provide your location:\")\n", + " ask = AskHuman.model_validate(state[\"messages\"][-1].tool_calls[0][\"args\"])\n", + " location = interrupt(ask.question)\n", " tool_message = [{\"tool_call_id\": tool_call_id, \"type\": \"tool\", \"content\": location}]\n", " return {\"messages\": tool_message}\n", "\n", @@ -491,7 +492,7 @@ " \"messages\": [\n", " (\n", " \"user\",\n", - " \"Use the search tool to ask the user where they are, then look up the weather there\",\n", + " \"Ask the user where they are, then look up the weather there\",\n", " )\n", " ]\n", " },\n",