From c056ec9f54f935b57f4dacb7abd08d8277c555a3 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Fri, 17 May 2024 08:15:54 -0700 Subject: [PATCH] [Docs] Capitalization Nits (#485) --- docs/docs/how-tos/index.md | 34 ++++++++++++++++----------------- docs/docs/index.md | 4 ++++ docs/mkdocs.yml | 2 +- examples/persistence.ipynb | 25 +++++++++++++----------- examples/streaming-tokens.ipynb | 2 +- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/docs/docs/how-tos/index.md b/docs/docs/how-tos/index.md index 7e277c3de..b7756b065 100644 --- a/docs/docs/how-tos/index.md +++ b/docs/docs/how-tos/index.md @@ -1,37 +1,37 @@ -# How-To Guides +# How-to guides -Welcome to the LangGraph How-To Guides! These guides provide practical, step-by-step instructions for accomplishing key tasks in LangGraph. +Welcome to the LangGraph how-to guides! These guides provide practical, step-by-step instructions for accomplishing key tasks in LangGraph. ## Core -The core guides show how to address common needs when building a out AI workflows, with special focus placed on [ReAct](https://arxiv.org/abs/2210.03629)-style agents with [tool calling](https://python.langchain.com/docs/modules/model_io/chat/function_calling/). +The core guides show how to address common needs when building out AI workflows, with special focus placed on [ReAct](https://arxiv.org/abs/2210.03629)-style agents with [tool calling](https://python.langchain.com/docs/modules/model_io/chat/function_calling/). -- [Persistence](persistence.ipynb): How to give your graph "memory" and resiliance by saving and loading state -- [Time Travel](time-travel.ipynb): How to navigate and manipulate graph state history once it's persisted -- [Async Execution](async.ipynb): How to run nodes asynchronously for improved performance -- [Streaming Responses](streaming-tokens.ipynb): How to stream agent responses in real-time +- [Persistence](persistence.ipynb): How to give your graph "memory" and resilience by saving and loading state +- [Time travel](time-travel.ipynb): How to navigate and manipulate graph state history once it's persisted +- [Async execution](async.ipynb): How to run nodes asynchronously for improved performance +- [Streaming responses](streaming-tokens.ipynb): How to stream agent responses in real-time - [Visualization](visualization.ipynb): How to visualize your graphs - [Configuration](configuration.ipynb): How to indicate that a graph can swap out configurable components -### Design Patterns +### Design patterns Recipes showing how to apply common design patterns in your workflows: - [Subgraphs](subgraph.ipynb): How to compose subgraphs within a larger graph - [Branching](branching.ipynb): How to create branching logic in your graphs for parallel node execution -- [Human-in-the-Loop](human-in-the-loop.ipynb): How to incorporate human feedback and intervention +- [Human-in-the-loop](human-in-the-loop.ipynb): How to incorporate human feedback and intervention The following examples are useful especially if you are used to LangChain's AgentExecutor configurations. -- [Force Calling a Tool First](force-calling-a-tool-first.ipynb): Define a fixed workflow before ceding control to the ReAct agent -- [Dynamic Direct Return](dynamically-returning-directly.ipynb): Let the LLM to decide whether the graph should finish after a tool is run or whether the LLM should be able to review the output and keep going. -- [Respond in Structured Format](respond-in-format.ipynb): Let the LLM use tools or populate schema to provide the user. Useful if your agent should generate structured content. -- [Managing Agent Steps](managing-agent-steps.ipynb): How to format the intermediate steps of your workflow for the agent. +- [Force calling a tool first](force-calling-a-tool-first.ipynb): Define a fixed workflow before ceding control to the ReAct agent +- [Dynamic direct return](dynamically-returning-directly.ipynb): Let the LLM decide whether the graph should finish after a tool is run or whether the LLM should be able to review the output and keep going +- [Respond in structured format](respond-in-format.ipynb): Let the LLM use tools or populate schema to provide the user. Useful if your agent should generate structured content +- [Managing agent steps](managing-agent-steps.ipynb): How to format the intermediate steps of your workflow for the agent -### Alternative ways to define State +### Alternative ways to define state -- [Pydantic State](state-model.ipynb): Use a pydantic model as your state +- [Pydantic state](state-model.ipynb): Use a Pydantic model as your state -### Structured Output +### Structured output -- [Extraction with Re-prompting](./extraction/retries.ipynb): how to generate complex nested schemas using JSONPatch retries, for when function calling is insufficient, and regular reprompting still fails to generate valid results. \ No newline at end of file +- [Extraction with re-prompting](./extraction/retries.ipynb): How to generate complex nested schemas using JSONPatch retries, for when function calling is insufficient, and regular reprompting still fails to generate valid results \ No newline at end of file diff --git a/docs/docs/index.md b/docs/docs/index.md index 0dcefe428..8b627a016 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -7,6 +7,10 @@ hide_comments: true ⚡ Build language agents as graphs ⚡ +!!! note "Python version :material-language-python:" + + Looking for the JS version? Click [:fontawesome-brands-square-js: here](https://github.com/langchain-ai/langgraphjs) ([:simple-readme: JS docs](https://langchain-ai.github.io/langgraphjs/)). + ## Overview Suppose you're building a customer support assistant. You want your assistant to be able to: diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 49119e19c..e3593a21c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -208,6 +208,6 @@ extra: - icon: fontawesome/brands/js link: https://langchain-ai.github.io/langgraphjs/ - icon: fontawesome/brands/github - link: https://github.com/langchain-ai/langgraphjs + link: https://github.com/langchain-ai/langgraph - icon: fontawesome/brands/twitter link: https://twitter.com/LangChainAI \ No newline at end of file diff --git a/examples/persistence.ipynb b/examples/persistence.ipynb index 37edf6afb..c8f8bf913 100644 --- a/examples/persistence.ipynb +++ b/examples/persistence.ipynb @@ -173,9 +173,8 @@ "id": "01885785-b71a-44d1-b1d6-7b5b14d53b58", "metadata": {}, "source": [ - "We can now wrap these tools in a simple ToolExecutor.\n", - "This is a real simple class that takes in a ToolInvocation and calls that tool, returning the output.\n", - "A ToolInvocation is any class with `tool` and `tool_input` attribute.\n" + "Now we can create our [ToolNode](https://langchain-ai.github.io/langgraph/reference/prebuilt/?h=tool+node#toolnode). This \n", + "object actually **runs** the tools (aka functions) that the LLM has asked to use." ] }, { @@ -197,13 +196,19 @@ "source": [ "## Set up the model\n", "\n", - "Now we need to load the chat model we want to use.\n", - "Importantly, this should satisfy two criteria:\n", + "Now we need to load the [chat model](https://python.langchain.com/v0.2/docs/concepts/#chat-models) to power our agent.\n", + "For the design below, it must satisfy two criteria:\n", "\n", - "1. It should work with messages. We will represent all agent state in the form of messages, so it needs to be able to work well with them.\n", - "2. It should work with OpenAI function calling. This means it should either be an OpenAI model or a model that exposes a similar interface.\n", + "1. It should work with **messages** (since our state contains a list of chat messages)\n", + "2. It should work with [**tool calling**](https://python.langchain.com/v0.1/docs/modules/model_io/chat/function_calling/).\n", "\n", - "Note: these model requirements are not requirements for using LangGraph - they are just requirements for this one example." + "
\n", + "

Note

\n", + "

\n", + " These model requirements are not general requirements for using LangGraph - they are just requirements for this one example.\n", + "

\n", + "
\n", + " " ] }, { @@ -245,7 +250,7 @@ "id": "e03c5094-9297-4d19-a04e-3eedc75cefb4", "metadata": {}, "source": [ - "## Define the nodes\n", + "## Define the graph \n", "\n", "We now need to define a few different nodes in our graph.\n", "In `langgraph`, a node can be either a function or a [runnable](https://python.langchain.com/docs/expression_language/).\n", @@ -300,8 +305,6 @@ "id": "ffd6e892-946c-4899-8cc0-7c9291c1f73b", "metadata": {}, "source": [ - "## Define the graph\n", - "\n", "We can now put it all together and define the graph!" ] }, diff --git a/examples/streaming-tokens.ipynb b/examples/streaming-tokens.ipynb index 232cc5e12..40ef406a9 100644 --- a/examples/streaming-tokens.ipynb +++ b/examples/streaming-tokens.ipynb @@ -7,7 +7,7 @@ "source": [ "# Streaming Tokens\n", "\n", - "In this example we will stream tokens from the language model powering an agent. We will use a ReAct agent as an example. The main thing to bear in mind here is that using [async nodes](./async.ipynb) typically offers the best behavior for this, since we will be using the `async_log` method.\n", + "In this example we will stream tokens from the language model powering an agent. We will use a ReAct agent as an example. The main thing to bear in mind here is that using [async nodes](./async.ipynb) typically offers the best behavior for this, since we will be using the `astream_events` method.\n", "\n", "This how-to guide closely follows the others in this directory, so we will call out differences with the **STREAMING** tag below (if you just want to search for those).\n", "\n",