From f741fbf92ebc2710a7cf261e63ed4e145d673764 Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Thu, 20 Jun 2024 21:39:13 -0400 Subject: [PATCH] docs: run codespell on all notebooks (#736) * run codespell on all notebooks * fix codespell --- .github/workflows/codespell.yml | 3 +-- Makefile | 7 +++++-- docs/codespell_notebooks.sh | 13 +++++++++++++ examples/cloud_examples/background_run.ipynb | 16 ++++++++-------- examples/cloud_examples/enqueue_concurrent.ipynb | 8 ++++---- .../cloud_examples/human-in-the-loop_cloud.ipynb | 4 ++-- .../cloud_examples/interrupt_concurrent.ipynb | 8 ++++---- examples/cloud_examples/reject_concurrent.ipynb | 6 +++--- .../cloud_examples/rollback_concurrent.ipynb | 6 +++--- examples/cloud_examples/stream_messages.ipynb | 6 +++--- examples/cloud_examples/stream_updates.ipynb | 2 +- examples/cloud_examples/stream_values.ipynb | 14 +++++++------- examples/customer-support/customer-support.ipynb | 2 +- examples/extraction/retries.ipynb | 2 +- examples/learning.ipynb | 10 +++++----- examples/managing-conversation-history.ipynb | 8 ++++---- examples/rag/langgraph_self_rag_local.ipynb | 2 +- examples/reflexion/reflexion.ipynb | 2 +- examples/tutorials/sql-agent.ipynb | 2 +- examples/tutorials/tnt-llm/tnt-llm.ipynb | 4 ++-- 20 files changed, 70 insertions(+), 55 deletions(-) create mode 100755 docs/codespell_notebooks.sh diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 9abcb807e..2b3090552 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -36,5 +36,4 @@ ignore_words_list: ${{ steps.extract_ignore_words.outputs.ignore_words_list }} # We do this to avoid spellchecking cell outputs - name: Codespell Notebooks - run: | - find . -name "*.ipynb" | head -n 1 | xargs cat $1 | jupytext --from ipynb --to py:percent | codespell - + run: make codespell \ No newline at end of file diff --git a/Makefile b/Makefile index 5d88e53af..fcc138937 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build-docs serve-docs serve-clean-docs clean-docs +.PHONY: build-docs serve-docs serve-clean-docs clean-docs codespell build-docs: poetry run python docs/_scripts/copy_notebooks.py @@ -14,4 +14,7 @@ serve-docs: clean-docs: find ./docs/docs -name "*.ipynb" -type f -delete - rm -rf docs/site \ No newline at end of file + rm -rf docs/site + +codespell: + ./docs/codespell_notebooks.sh . \ No newline at end of file diff --git a/docs/codespell_notebooks.sh b/docs/codespell_notebooks.sh new file mode 100755 index 000000000..82a62414e --- /dev/null +++ b/docs/codespell_notebooks.sh @@ -0,0 +1,13 @@ +ERROR_FOUND=0 +for file in $(find $1 -name "*.ipynb"); do + OUTPUT=$(cat "$file" | jupytext --from ipynb --to py:percent | codespell -) + if [ -n "$OUTPUT" ]; then + echo "Errors found in $file" + echo "$OUTPUT" + ERROR_FOUND=1 + fi +done + +if [ "$ERROR_FOUND" -ne 0 ]; then + exit 1 +fi \ No newline at end of file diff --git a/examples/cloud_examples/background_run.ipynb b/examples/cloud_examples/background_run.ipynb index 87efa3a0b..a41fafa60 100644 --- a/examples/cloud_examples/background_run.ipynb +++ b/examples/cloud_examples/background_run.ipynb @@ -137,7 +137,7 @@ "outputs": [], "source": [ "# Let's kick off a run\n", - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf\"}]}\n", "run = await client.runs.create(thread['thread_id'], assistant[\"assistant_id\"], input=input)\n" ] }, @@ -213,7 +213,7 @@ " 'data': {'chunk': {'messages': [{'id': '46b31c3a-01bf-4946-bd5a-fa6a7f6c97ce',\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}},\n", @@ -243,7 +243,7 @@ " 'event': 'on_chain_end',\n", " 'name': 'agent',\n", " 'data': {'input': {'messages': [{'role': 'human',\n", - " 'content': 'whats the weather in sf'}]},\n", + " 'content': 'what's the weather in sf'}]},\n", " 'output': {'messages': [{'id': 'run-4885d5a0-cd89-4f00-8558-e85b542a710c',\n", " 'name': None,\n", " 'type': 'ai',\n", @@ -297,7 +297,7 @@ " 'data': {'input': {'messages': [{'id': 'abc3581e-417b-4ca1-ab31-de7108e64b3b',\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}},\n", @@ -330,7 +330,7 @@ " 'data': {'input': {'messages': [{'id': 'abc3581e-417b-4ca1-ab31-de7108e64b3b',\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}},\n", @@ -362,7 +362,7 @@ " 'data': {'input': {'messages': [[{'id': None,\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}}]]},\n", @@ -430,7 +430,7 @@ " 'data': {'input': {'messages': [[{'id': None,\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}}]]}},\n", @@ -520,7 +520,7 @@ " 'data': {'output': {'messages': [{'id': '46b31c3a-01bf-4946-bd5a-fa6a7f6c97ce',\n", " 'name': None,\n", " 'type': 'human',\n", - " 'content': 'whats the weather in sf',\n", + " 'content': 'what's the weather in sf',\n", " 'example': False,\n", " 'additional_kwargs': {},\n", " 'response_metadata': {}},\n", diff --git a/examples/cloud_examples/enqueue_concurrent.ipynb b/examples/cloud_examples/enqueue_concurrent.ipynb index 90b82c521..ca33148f7 100644 --- a/examples/cloud_examples/enqueue_concurrent.ipynb +++ b/examples/cloud_examples/enqueue_concurrent.ipynb @@ -42,7 +42,7 @@ "first_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")" ] }, @@ -55,7 +55,7 @@ "second_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in nyc?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"enqueue\",\n", ")" ] @@ -97,7 +97,7 @@ "text": [ "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in sf?\n", + "what's the weather in sf?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'id': 'toolu_01Dez1sJre4oA2Y7NsKJV6VT', 'input': {'query': 'weather in san francisco'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", @@ -132,7 +132,7 @@ "So in summary, expect seasonable spring weather in San Francisco over the next several days, with a mix of sun and clouds and temperatures ranging from the upper 40s at night to the low 60s during the days. Typical dry conditions with no rain in the forecast.\n", "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in nyc?\n", + "what's the weather in nyc?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'text': 'Here are the current weather conditions and forecast for New York City:', 'type': 'text'}, {'id': 'toolu_01FFft5Sx9oS6AdVJuRWWcGp', 'input': {'query': 'weather in new york city'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", diff --git a/examples/cloud_examples/human-in-the-loop_cloud.ipynb b/examples/cloud_examples/human-in-the-loop_cloud.ipynb index 9ab91a93f..475e6b66d 100644 --- a/examples/cloud_examples/human-in-the-loop_cloud.ipynb +++ b/examples/cloud_examples/human-in-the-loop_cloud.ipynb @@ -186,7 +186,7 @@ } ], "source": [ - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf\"}]}\n", "async for chunk in client.runs.stream(\n", " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", @@ -287,7 +287,7 @@ } ], "source": [ - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in la?\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la?\"}]}\n", "async for chunk in client.runs.stream(\n", " thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n", "):\n", diff --git a/examples/cloud_examples/interrupt_concurrent.ipynb b/examples/cloud_examples/interrupt_concurrent.ipynb index 0df7a6ff9..9fd839ab0 100644 --- a/examples/cloud_examples/interrupt_concurrent.ipynb +++ b/examples/cloud_examples/interrupt_concurrent.ipynb @@ -44,13 +44,13 @@ "interrupted_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")\n", "await asyncio.sleep(2)\n", "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in nyc?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"interrupt\",\n", ")" ] @@ -92,7 +92,7 @@ "text": [ "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in sf?\n", + "what's the weather in sf?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'id': 'toolu_01MjNtVJwEcpujRGrf3x6Pih', 'input': {'query': 'weather in san francisco'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", @@ -107,7 +107,7 @@ "[{\"url\": \"https://www.wunderground.com/hourly/us/ca/san-francisco/KCASANFR2002/date/2024-6-18\", \"content\": \"High 64F. Winds W at 10 to 20 mph. A few clouds from time to time. Low 49F. Winds W at 10 to 20 mph. Temp. San Francisco Weather Forecasts. Weather Underground provides local & long-range weather ...\"}]\n", "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in nyc?\n", + "what's the weather in nyc?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'id': 'toolu_01KtE1m1ifPLQAx4fQLyZL9Q', 'input': {'query': 'weather in new york city'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", diff --git a/examples/cloud_examples/reject_concurrent.ipynb b/examples/cloud_examples/reject_concurrent.ipynb index 9aa603b12..cdbc261f4 100644 --- a/examples/cloud_examples/reject_concurrent.ipynb +++ b/examples/cloud_examples/reject_concurrent.ipynb @@ -58,7 +58,7 @@ "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")" ] }, @@ -81,7 +81,7 @@ " await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in nyc?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"reject\",\n", " )\n", "except httpx.HTTPStatusError as e:\n", @@ -125,7 +125,7 @@ "text": [ "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in sf?\n", + "what's the weather in sf?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'id': 'toolu_01CyewEifV2Kmi7EFKHbMDr1', 'input': {'query': 'weather in san francisco'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", diff --git a/examples/cloud_examples/rollback_concurrent.ipynb b/examples/cloud_examples/rollback_concurrent.ipynb index 37d1ab9f5..734f299c4 100644 --- a/examples/cloud_examples/rollback_concurrent.ipynb +++ b/examples/cloud_examples/rollback_concurrent.ipynb @@ -45,13 +45,13 @@ "rolled_back_run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in sf?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf?\"}]},\n", ")\n", "await asyncio.sleep(2)\n", "run = await client.runs.create(\n", " thread[\"thread_id\"],\n", " assistant[\"assistant_id\"],\n", - " input={\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in nyc?\"}]},\n", + " input={\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in nyc?\"}]},\n", " multitask_strategy=\"rollback\",\n", ")" ] @@ -93,7 +93,7 @@ "text": [ "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats the weather in nyc?\n", + "what's the weather in nyc?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "[{'id': 'toolu_01JzPqefao1gxwajHQ3Yh3JD', 'input': {'query': 'weather in nyc'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", diff --git a/examples/cloud_examples/stream_messages.ipynb b/examples/cloud_examples/stream_messages.ipynb index 60439088d..28883c655 100644 --- a/examples/cloud_examples/stream_messages.ipynb +++ b/examples/cloud_examples/stream_messages.ipynb @@ -169,7 +169,7 @@ "text": [ "Metadata: Run ID - c64b3e27-c7a4-4851-9618-07641fa24296\n", "--------------------------------------------------\n", - "Human: whats the weather in sf\n", + "Human: what's the weather in sf\n", "--------------------------------------------------\n", "Invalid Tool Calls:\n", "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: \n", @@ -205,7 +205,7 @@ "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", "Response Metadata: Finish Reason - tool_calls\n", "--------------------------------------------------\n", - "AI: whats the weather in sf\n", + "AI: what's the weather in sf\n", "Tool Calls:\n", "Tool Call ID: call_8XskpDf4mjpQOuIL8F9IzQR8, Function: tavily_search_results_json, Arguments: {'query': 'current weather in San Francisco'}\n", "Response Metadata: Finish Reason - tool_calls\n", @@ -1344,7 +1344,7 @@ } ], "source": [ - "input = {\"messages\": [{\"role\": \"user\", \"content\": \"whats the weather in sf\"}]}\n", + "input = {\"messages\": [{\"role\": \"user\", \"content\": \"what's the weather in sf\"}]}\n", "\n", "async for event in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode='messages'):\n", " if event.event == 'metadata':\n", diff --git a/examples/cloud_examples/stream_updates.ipynb b/examples/cloud_examples/stream_updates.ipynb index 877194b53..4c5a77bf4 100644 --- a/examples/cloud_examples/stream_updates.ipynb +++ b/examples/cloud_examples/stream_updates.ipynb @@ -179,7 +179,7 @@ } ], "source": [ - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in la\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", ):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", " print(chunk.data)\n", diff --git a/examples/cloud_examples/stream_values.ipynb b/examples/cloud_examples/stream_values.ipynb index 86493758c..f30b4fe6e 100644 --- a/examples/cloud_examples/stream_values.ipynb +++ b/examples/cloud_examples/stream_values.ipynb @@ -109,22 +109,22 @@ "\n", "\n", "Receiving new event of type: values...\n", - "{'messages': [{'role': 'human', 'content': 'whats the weather in la'}]}\n", + "{'messages': [{'role': 'human', 'content': 'what's the weather in la'}]}\n", "\n", "\n", "\n", "Receiving new event of type: values...\n", - "{'messages': [{'content': 'whats the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}]}\n", + "{'messages': [{'content': 'what's the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}]}\n", "\n", "\n", "\n", "Receiving new event of type: values...\n", - "{'messages': [{'content': 'whats the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}, {'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'Los Angeles\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 34.05, \\'lon\\': -118.24, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1716310320, \\'localtime\\': \\'2024-05-21 9:52\\'}, \\'current\\': {\\'last_updated_epoch\\': 1716309900, \\'last_updated\\': \\'2024-05-21 09:45\\', \\'temp_c\\': 16.7, \\'temp_f\\': 62.1, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Overcast\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/122.png\\', \\'code\\': 1009}, \\'wind_mph\\': 8.1, \\'wind_kph\\': 13.0, \\'wind_degree\\': 250, \\'wind_dir\\': \\'WSW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 65, \\'cloud\\': 100, \\'feelslike_c\\': 16.7, \\'feelslike_f\\': 62.1, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.2}}\"}]', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'tool', 'name': 'tavily_search_results_json', 'id': '0d5dab31-5ff8-4ae2-a560-bc4bcba7c9d7', 'tool_call_id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}]}\n", + "{'messages': [{'content': 'what's the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}, {'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'Los Angeles\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 34.05, \\'lon\\': -118.24, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1716310320, \\'localtime\\': \\'2024-05-21 9:52\\'}, \\'current\\': {\\'last_updated_epoch\\': 1716309900, \\'last_updated\\': \\'2024-05-21 09:45\\', \\'temp_c\\': 16.7, \\'temp_f\\': 62.1, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Overcast\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/122.png\\', \\'code\\': 1009}, \\'wind_mph\\': 8.1, \\'wind_kph\\': 13.0, \\'wind_degree\\': 250, \\'wind_dir\\': \\'WSW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 65, \\'cloud\\': 100, \\'feelslike_c\\': 16.7, \\'feelslike_f\\': 62.1, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.2}}\"}]', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'tool', 'name': 'tavily_search_results_json', 'id': '0d5dab31-5ff8-4ae2-a560-bc4bcba7c9d7', 'tool_call_id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}]}\n", "\n", "\n", "\n", "Receiving new event of type: values...\n", - "{'messages': [{'content': 'whats the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}, {'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'Los Angeles\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 34.05, \\'lon\\': -118.24, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1716310320, \\'localtime\\': \\'2024-05-21 9:52\\'}, \\'current\\': {\\'last_updated_epoch\\': 1716309900, \\'last_updated\\': \\'2024-05-21 09:45\\', \\'temp_c\\': 16.7, \\'temp_f\\': 62.1, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Overcast\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/122.png\\', \\'code\\': 1009}, \\'wind_mph\\': 8.1, \\'wind_kph\\': 13.0, \\'wind_degree\\': 250, \\'wind_dir\\': \\'WSW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 65, \\'cloud\\': 100, \\'feelslike_c\\': 16.7, \\'feelslike_f\\': 62.1, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.2}}\"}]', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'tool', 'name': 'tavily_search_results_json', 'id': '0d5dab31-5ff8-4ae2-a560-bc4bcba7c9d7', 'tool_call_id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}, {'content': 'Based on the weather API results, the current weather in Los Angeles is overcast with a temperature of around 62°F (17°C). There are light winds from the west-southwest around 8-13 mph. The humidity is 65% and visibility is good at 9 miles. Overall, mild spring weather conditions in LA.', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-4d6d4c23-5aad-4042-b0d9-19407a9e08e3', 'example': False, 'tool_calls': [], 'invalid_tool_calls': []}]}\n", + "{'messages': [{'content': 'what's the weather in la', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'human', 'name': None, 'id': 'faa15565-8823-4aa1-87af-e21b40526fae', 'example': False}, {'content': [{'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g', 'input': {'query': 'weather in los angeles'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}], 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-3fe1db7a-6b8d-4d83-ba07-8657190ad811', 'example': False, 'tool_calls': [{'name': 'tavily_search_results_json', 'args': {'query': 'weather in los angeles'}, 'id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}], 'invalid_tool_calls': []}, {'content': '[{\"url\": \"https://www.weatherapi.com/\", \"content\": \"{\\'location\\': {\\'name\\': \\'Los Angeles\\', \\'region\\': \\'California\\', \\'country\\': \\'United States of America\\', \\'lat\\': 34.05, \\'lon\\': -118.24, \\'tz_id\\': \\'America/Los_Angeles\\', \\'localtime_epoch\\': 1716310320, \\'localtime\\': \\'2024-05-21 9:52\\'}, \\'current\\': {\\'last_updated_epoch\\': 1716309900, \\'last_updated\\': \\'2024-05-21 09:45\\', \\'temp_c\\': 16.7, \\'temp_f\\': 62.1, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Overcast\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/122.png\\', \\'code\\': 1009}, \\'wind_mph\\': 8.1, \\'wind_kph\\': 13.0, \\'wind_degree\\': 250, \\'wind_dir\\': \\'WSW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 65, \\'cloud\\': 100, \\'feelslike_c\\': 16.7, \\'feelslike_f\\': 62.1, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 5.0, \\'gust_mph\\': 12.5, \\'gust_kph\\': 20.2}}\"}]', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'tool', 'name': 'tavily_search_results_json', 'id': '0d5dab31-5ff8-4ae2-a560-bc4bcba7c9d7', 'tool_call_id': 'toolu_01E5mSaZWm5rWJnCqmt63v4g'}, {'content': 'Based on the weather API results, the current weather in Los Angeles is overcast with a temperature of around 62°F (17°C). There are light winds from the west-southwest around 8-13 mph. The humidity is 65% and visibility is good at 9 miles. Overall, mild spring weather conditions in LA.', 'additional_kwargs': {}, 'response_metadata': {}, 'type': 'ai', 'name': None, 'id': 'run-4d6d4c23-5aad-4042-b0d9-19407a9e08e3', 'example': False, 'tool_calls': [], 'invalid_tool_calls': []}]}\n", "\n", "\n", "\n", @@ -137,7 +137,7 @@ } ], "source": [ - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in la\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", "thread = await client.threads.create()\n", "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input):\n", " print(f\"Receiving new event of type: {chunk.event}...\")\n", @@ -160,7 +160,7 @@ "metadata": {}, "outputs": [], "source": [ - "input = {\"messages\": [{\"role\": \"human\", \"content\": \"whats the weather in la\"}]}\n", + "input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n", "thread = await client.threads.create()\n", "final_answer = None\n", "async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input):\n", @@ -177,7 +177,7 @@ { "data": { "text/plain": [ - "{'messages': [{'content': 'whats the weather in la',\n", + "{'messages': [{'content': 'what's the weather in la',\n", " 'additional_kwargs': {},\n", " 'response_metadata': {},\n", " 'type': 'human',\n", diff --git a/examples/customer-support/customer-support.ipynb b/examples/customer-support/customer-support.ipynb index f3828cc5b..75bd46d7b 100644 --- a/examples/customer-support/customer-support.ipynb +++ b/examples/customer-support/customer-support.ipynb @@ -1913,7 +1913,7 @@ "Now, create the graph. Make 2 changes from part 1 to address our previous concerns.\n", "\n", "1. Add an interrupt before using a tool\n", - "2. Explicitly populate the user state within the first node so the assitant doesn't have to use a tool just to learn about the user." + "2. Explicitly populate the user state within the first node so the assistant doesn't have to use a tool just to learn about the user." ] }, { diff --git a/examples/extraction/retries.ipynb b/examples/extraction/retries.ipynb index 751997c40..b45a5a536 100644 --- a/examples/extraction/retries.ipynb +++ b/examples/extraction/retries.ipynb @@ -229,7 +229,7 @@ "\n", " # To support patch-based retries, we need to be able to\n", " # aggregate the messages over multiple turns.\n", - " # The next sequece selects only the relevant messages\n", + " # The next sequence selects only the relevant messages\n", " # and then applies the validator\n", " select_messages = retry_strategy.get(\"aggregate_messages\") or _default_aggregator\n", "\n", diff --git a/examples/learning.ipynb b/examples/learning.ipynb index 0b4c27db1..7449df414 100644 --- a/examples/learning.ipynb +++ b/examples/learning.ipynb @@ -439,7 +439,7 @@ "source": [ "thread = {\"configurable\": {\"thread_id\": \"1\"}}\n", "for event in app.stream(\n", - " {\"messages\": [HumanMessage(content=\"whats the weather in sf?\")]}, thread\n", + " {\"messages\": [HumanMessage(content=\"what's the weather in sf?\")]}, thread\n", "):\n", " for v in event.values():\n", " print(v)" @@ -454,7 +454,7 @@ { "data": { "text/plain": [ - "{'messages': [HumanMessage(content='whats the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'),\n", + "{'messages': [HumanMessage(content='what's the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'),\n", " AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h', 'function': {'arguments': '{\"query\":\"weather in San Francisco\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 94, 'total_tokens': 115}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-3764f79e-17b4-4aa3-bbe4-4f92b11ca52c-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in San Francisco'}, 'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h'}])]}" ] }, @@ -511,7 +511,7 @@ { "data": { "text/plain": [ - "StateSnapshot(values={'messages': [HumanMessage(content='whats the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h', 'function': {'arguments': '{\"query\":\"weather in San Francisco\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 94, 'total_tokens': 115}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-3764f79e-17b4-4aa3-bbe4-4f92b11ca52c-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in San Francisco, Accuweather'}, 'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h'}])]}, next=('action',), config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:15.108790+00:00'}}, parent_config=None)" + "StateSnapshot(values={'messages': [HumanMessage(content='what's the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h', 'function': {'arguments': '{\"query\":\"weather in San Francisco\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 94, 'total_tokens': 115}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-3764f79e-17b4-4aa3-bbe4-4f92b11ca52c-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in San Francisco, Accuweather'}, 'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h'}])]}, next=('action',), config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:15.108790+00:00'}}, parent_config=None)" ] }, "execution_count": 127, @@ -580,7 +580,7 @@ { "data": { "text/plain": [ - "[CheckpointTuple(config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:36.933600+00:00'}}, checkpoint={'v': 1, 'ts': '2024-04-20T01:13:36.933600+00:00', 'channel_values': {'messages': [HumanMessage(content='whats the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h', 'function': {'arguments': '{\"query\":\"weather in San Francisco\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 94, 'total_tokens': 115}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-3764f79e-17b4-4aa3-bbe4-4f92b11ca52c-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in San Francisco, Accuweather'}, 'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h'}]), 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\\': 1713575495, \\'localtime\\': \\'2024-04-19 18:11\\'}, \\'current\\': {\\'last_updated_epoch\\': 1713574800, \\'last_updated\\': \\'2024-04-19 18:00\\', \\'temp_c\\': 16.1, \\'temp_f\\': 61.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Sunny\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/113.png\\', \\'code\\': 1000}, \\'wind_mph\\': 16.1, \\'wind_kph\\': 25.9, \\'wind_degree\\': 300, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 67, \\'cloud\\': 0, \\'feelslike_c\\': 16.1, \\'feelslike_f\\': 61.0, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 4.0, \\'gust_mph\\': 20.6, \\'gust_kph\\': 33.1}}\"}]', name='tavily_search_results_json', id='8c7e9af3-6569-4982-a83d-be1ec02f828a', tool_call_id='call_yQrJa8CEOfKBdpVl80jzWf5h'), AIMessage(content='The current weather in San Francisco is sunny with a temperature of 61.0°F (16.1°C). The wind speed is 25.9 km/h coming from the west-northwest direction. The humidity is at 67%, and there is no precipitation at the moment.', response_metadata={'token_usage': {'completion_tokens': 59, 'prompt_tokens': 476, 'total_tokens': 535}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'stop', 'logprobs': None}, id='run-7d652a0d-cb00-4857-b9fb-d3e37b0a6d23-0')], 'agent': {'messages': [AIMessage(content='The current weather in San Francisco is sunny with a temperature of 61.0°F (16.1°C). The wind speed is 25.9 km/h coming from the west-northwest direction. The humidity is at 67%, and there is no precipitation at the moment.', response_metadata={'token_usage': {'completion_tokens': 59, 'prompt_tokens': 476, 'total_tokens': 535}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'stop', 'logprobs': None}, id='run-7d652a0d-cb00-4857-b9fb-d3e37b0a6d23-0')]}}, 'channel_versions': defaultdict(, {'__start__': 1, 'messages': 6, 'start:agent': 2, 'action': 5, 'agent': 6, 'branch:agent:should_continue:action': 4}), 'versions_seen': defaultdict(, {'__start__': defaultdict(, {'__start__': 1}), 'agent': defaultdict(, {'start:agent': 2, 'action': 5}), 'action': defaultdict(, {'branch:agent:should_continue:action': 4}), '__interrupt__': defaultdict(, {'messages': 4})})}, parent_config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:35.392072+00:00'}})]" + "[CheckpointTuple(config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:36.933600+00:00'}}, checkpoint={'v': 1, 'ts': '2024-04-20T01:13:36.933600+00:00', 'channel_values': {'messages': [HumanMessage(content='what's the weather in sf?', id='1cfd0c2f-9b60-48da-8938-408fd6aeda13'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h', 'function': {'arguments': '{\"query\":\"weather in San Francisco\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 21, 'prompt_tokens': 94, 'total_tokens': 115}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-3764f79e-17b4-4aa3-bbe4-4f92b11ca52c-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in San Francisco, Accuweather'}, 'id': 'call_yQrJa8CEOfKBdpVl80jzWf5h'}]), 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\\': 1713575495, \\'localtime\\': \\'2024-04-19 18:11\\'}, \\'current\\': {\\'last_updated_epoch\\': 1713574800, \\'last_updated\\': \\'2024-04-19 18:00\\', \\'temp_c\\': 16.1, \\'temp_f\\': 61.0, \\'is_day\\': 1, \\'condition\\': {\\'text\\': \\'Sunny\\', \\'icon\\': \\'//cdn.weatherapi.com/weather/64x64/day/113.png\\', \\'code\\': 1000}, \\'wind_mph\\': 16.1, \\'wind_kph\\': 25.9, \\'wind_degree\\': 300, \\'wind_dir\\': \\'WNW\\', \\'pressure_mb\\': 1015.0, \\'pressure_in\\': 29.97, \\'precip_mm\\': 0.0, \\'precip_in\\': 0.0, \\'humidity\\': 67, \\'cloud\\': 0, \\'feelslike_c\\': 16.1, \\'feelslike_f\\': 61.0, \\'vis_km\\': 16.0, \\'vis_miles\\': 9.0, \\'uv\\': 4.0, \\'gust_mph\\': 20.6, \\'gust_kph\\': 33.1}}\"}]', name='tavily_search_results_json', id='8c7e9af3-6569-4982-a83d-be1ec02f828a', tool_call_id='call_yQrJa8CEOfKBdpVl80jzWf5h'), AIMessage(content='The current weather in San Francisco is sunny with a temperature of 61.0°F (16.1°C). The wind speed is 25.9 km/h coming from the west-northwest direction. The humidity is at 67%, and there is no precipitation at the moment.', response_metadata={'token_usage': {'completion_tokens': 59, 'prompt_tokens': 476, 'total_tokens': 535}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'stop', 'logprobs': None}, id='run-7d652a0d-cb00-4857-b9fb-d3e37b0a6d23-0')], 'agent': {'messages': [AIMessage(content='The current weather in San Francisco is sunny with a temperature of 61.0°F (16.1°C). The wind speed is 25.9 km/h coming from the west-northwest direction. The humidity is at 67%, and there is no precipitation at the moment.', response_metadata={'token_usage': {'completion_tokens': 59, 'prompt_tokens': 476, 'total_tokens': 535}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_c2295e73ad', 'finish_reason': 'stop', 'logprobs': None}, id='run-7d652a0d-cb00-4857-b9fb-d3e37b0a6d23-0')]}}, 'channel_versions': defaultdict(, {'__start__': 1, 'messages': 6, 'start:agent': 2, 'action': 5, 'agent': 6, 'branch:agent:should_continue:action': 4}), 'versions_seen': defaultdict(, {'__start__': defaultdict(, {'__start__': 1}), 'agent': defaultdict(, {'start:agent': 2, 'action': 5}), 'action': defaultdict(, {'branch:agent:should_continue:action': 4}), '__interrupt__': defaultdict(, {'messages': 4})})}, parent_config={'configurable': {'thread_id': '1', 'thread_ts': '2024-04-20T01:13:35.392072+00:00'}})]" ] }, "execution_count": 131, @@ -609,7 +609,7 @@ "source": [ "thread = {\"configurable\": {\"thread_id\": \"7\"}}\n", "for event in app.stream(\n", - " {\"messages\": [HumanMessage(content=\"whats the weather in la?\")]}, thread\n", + " {\"messages\": [HumanMessage(content=\"what's the weather in la?\")]}, thread\n", "):\n", " for v in event.values():\n", " print(v)" diff --git a/examples/managing-conversation-history.ipynb b/examples/managing-conversation-history.ipynb index 8a7495a67..35182b053 100644 --- a/examples/managing-conversation-history.ipynb +++ b/examples/managing-conversation-history.ipynb @@ -185,7 +185,7 @@ "Nice to meet you, Bob! As an AI assistant, I don't have a physical form, but I'm happy to chat with you and try my best to help out however I can. Please feel free to ask me anything, and I'll do my best to provide useful information or assistance.\n", "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats my name?\n", + "what's my name?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "You said your name is Bob, so that is the name I have for you.\n" @@ -201,7 +201,7 @@ " event[\"messages\"][-1].pretty_print()\n", "\n", "\n", - "input_message = HumanMessage(content=\"whats my name?\")\n", + "input_message = HumanMessage(content=\"what's my name?\")\n", "for event in app.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n", " event[\"messages\"][-1].pretty_print()" ] @@ -322,7 +322,7 @@ "Nice to meet you, Bob! I'm Claude, an AI assistant created by Anthropic. It's a pleasure to chat with you. Feel free to ask me anything, I'm here to help!\n", "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", - "whats my name?\n", + "what's my name?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", "I'm afraid I don't actually know your name. As an AI assistant, I don't have information about the specific identities of the people I talk to. I only know what is provided to me during our conversation.\n" @@ -339,7 +339,7 @@ "\n", "# This will now not remember the previous messages\n", "# (because we set `messages[-1:]` in the filter messages argument)\n", - "input_message = HumanMessage(content=\"whats my name?\")\n", + "input_message = HumanMessage(content=\"what's my name?\")\n", "for event in app.stream({\"messages\": [input_message]}, config, stream_mode=\"values\"):\n", " event[\"messages\"][-1].pretty_print()" ] diff --git a/examples/rag/langgraph_self_rag_local.ipynb b/examples/rag/langgraph_self_rag_local.ipynb index a9855b07e..6da5bf792 100644 --- a/examples/rag/langgraph_self_rag_local.ipynb +++ b/examples/rag/langgraph_self_rag_local.ipynb @@ -10,7 +10,7 @@ "id": "848ba742-7443-4123-8115-061da9823309", "metadata": {}, "source": [ - "# Self RAG usig local LLMs\n", + "# Self RAG using local LLMs\n", "\n", "Self-RAG is a strategy for RAG that incorporates self-reflection / self-grading on retrieved documents and generations. \n", "\n", diff --git a/examples/reflexion/reflexion.ipynb b/examples/reflexion/reflexion.ipynb index 2793ec514..ec4d03bd3 100644 --- a/examples/reflexion/reflexion.ipynb +++ b/examples/reflexion/reflexion.ipynb @@ -580,7 +580,7 @@ "source": [ "## Conclusion\n", "\n", - "Congrats on building a Reflexion actor! I'll leave you with a few observations to save you some time when choosing which parts of this agent ot adapt to your workflow:\n", + "Congrats on building a Reflexion actor! I'll leave you with a few observations to save you some time when choosing which parts of this agent to adapt to your workflow:\n", "1. This agent trades off execution time for quality. It explicitly forces the agent to critique and revise the output over several steps, which usually (not always) increases the response quality but takes much longer to return a final answer\n", "2. The 'reflections' can be paired with additional external feedback (such as validators), to further guide the actor.\n", "3. In the paper, 1 environment (AlfWorld) uses external memory. It does this by storing summaries of the reflections to an external store and using them in subsequent trials/invocations." diff --git a/examples/tutorials/sql-agent.ipynb b/examples/tutorials/sql-agent.ipynb index 50590f6da..9a948c5ac 100644 --- a/examples/tutorials/sql-agent.ipynb +++ b/examples/tutorials/sql-agent.ipynb @@ -459,7 +459,7 @@ "query_check_prompt = ChatPromptTemplate.from_messages([(\"system\", query_check_system),(\"placeholder\", \"{messages}\")])\n", "query_check = query_check_prompt | ChatOpenAI(model=\"gpt-4o\", temperature=0).bind_tools([db_query_tool], tool_choice=\"required\")\n", "\n", - "query_check.invoke({\"messages\": [(\"user\", \"SELET * FROM Artist LIMIT 10;\")]})" + "query_check.invoke({\"messages\": [(\"user\", \"SELECT * FROM Artist LIMIT 10;\")]})" ] }, { diff --git a/examples/tutorials/tnt-llm/tnt-llm.ipynb b/examples/tutorials/tnt-llm/tnt-llm.ipynb index e07a07840..39026fd92 100644 --- a/examples/tutorials/tnt-llm/tnt-llm.ipynb +++ b/examples/tutorials/tnt-llm/tnt-llm.ipynb @@ -762,7 +762,7 @@ "\n", "#### Label Training Data\n", "\n", - "Use an LLM to label the data in a fully-automated fashion. For beter accuracy, you can sample a portion of the results to label by hand as well to verify the quality.\n" + "Use an LLM to label the data in a fully-automated fashion. For better accuracy, you can sample a portion of the results to label by hand as well to verify the quality.\n" ] }, { @@ -1048,7 +1048,7 @@ "source": [ "## Conclusion\n", "\n", - "Congrats on implementing TNT-LLM! While most folks use clustering-based approachs like LDA, k-means, etc. it can often be hard to really interpret what each cluster represents. TNT-LLM generates human-interpretable labels you can use downstream to monitor and improve your application.\n", + "Congrats on implementing TNT-LLM! While most folks use clustering-based approaches like LDA, k-means, etc. it can often be hard to really interpret what each cluster represents. TNT-LLM generates human-interpretable labels you can use downstream to monitor and improve your application.\n", "\n", "The technique also lends itself to hierarchical sub-categorizing: once you have the above taxonomy, use it to label your data, then on each sub-category, generate a new taxonomy using a similar technique to the one described above!\n" ]