[PR #1198] [CLOSED] docs: correct mistakes in customer-support.ipynb #1938

Closed
opened 2026-02-20 17:45:55 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/1198
Author: @CJack812
Created: 8/2/2024
Status: Closed

Base: mainHead: cjack/examples-customer-support


📝 Commits (3)

  • bae5b43 docs: correct mistakes in customer-support.ipynb
  • 9b03ff3 Merge branch 'main' into cjack/examples-customer-support
  • e60b4fa Merge branch 'main' into cjack/examples-customer-support

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 examples/customer-support/customer-support.ipynb (+2 -2)

📄 Description

In examples/customer-support/customer-support.ipynb, I found two same mistakes in 'Part3' and 'Part4'.
In the call method of the Assistant class, the lines messages = state["messages"] + [("user", "Respond with a real output.")] and state = {**state, "messages": messages} are repeated twice. I believe this is a mistake and could cause confusion for beginners. I have modified this part of the code.

original code:

class Assistant:
    def __init__(self, runnable: Runnable):
        self.runnable = runnable

    def __call__(self, state: State, config: RunnableConfig):
        while True:
            result = self.runnable.invoke(state)

            if not result.tool_calls and (
                not result.content
                or isinstance(result.content, list)
                and not result.content[0].get("text")
            ):
                messages = state["messages"] + [("user", "Respond with a real output.")]
                state = {**state, "messages": messages}
                messages = state["messages"] + [("user", "Respond with a real output.")]
                state = {**state, "messages": messages}
            else:
                break
        return {"messages": result}

modified code:

class Assistant:
    def __init__(self, runnable: Runnable):
        self.runnable = runnable

    def __call__(self, state: State, config: RunnableConfig):
        while True:
            result = self.runnable.invoke(state)

            if not result.tool_calls and (
                not result.content
                or isinstance(result.content, list)
                and not result.content[0].get("text")
            ):
                messages = state["messages"] + [("user", "Respond with a real output.")]
                state = {**state, "messages": messages}
            else:
                break
        return {"messages": result}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraph/pull/1198 **Author:** [@CJack812](https://github.com/CJack812) **Created:** 8/2/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `cjack/examples-customer-support` --- ### 📝 Commits (3) - [`bae5b43`](https://github.com/langchain-ai/langgraph/commit/bae5b43e8477bdbafb225f14d9777ce5253f551a) docs: correct mistakes in customer-support.ipynb - [`9b03ff3`](https://github.com/langchain-ai/langgraph/commit/9b03ff3b8c847f875ef06396e7629fc506853c0d) Merge branch 'main' into cjack/examples-customer-support - [`e60b4fa`](https://github.com/langchain-ai/langgraph/commit/e60b4fa587f195d8fd3e25318a1b565241d06780) Merge branch 'main' into cjack/examples-customer-support ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `examples/customer-support/customer-support.ipynb` (+2 -2) </details> ### 📄 Description In examples/customer-support/customer-support.ipynb, I found two same mistakes in 'Part3' and 'Part4'. In the call method of the `Assistant `class, the lines `messages = state["messages"] + [("user", "Respond with a real output.")]` and `state = {**state, "messages": messages}` are repeated twice. I believe this is a mistake and could cause confusion for beginners. I have modified this part of the code. original code: ```python class Assistant: def __init__(self, runnable: Runnable): self.runnable = runnable def __call__(self, state: State, config: RunnableConfig): while True: result = self.runnable.invoke(state) if not result.tool_calls and ( not result.content or isinstance(result.content, list) and not result.content[0].get("text") ): messages = state["messages"] + [("user", "Respond with a real output.")] state = {**state, "messages": messages} messages = state["messages"] + [("user", "Respond with a real output.")] state = {**state, "messages": messages} else: break return {"messages": result} ``` modified code: ```python class Assistant: def __init__(self, runnable: Runnable): self.runnable = runnable def __call__(self, state: State, config: RunnableConfig): while True: result = self.runnable.invoke(state) if not result.tool_calls and ( not result.content or isinstance(result.content, list) and not result.content[0].get("text") ): messages = state["messages"] + [("user", "Respond with a real output.")] state = {**state, "messages": messages} else: break return {"messages": result} ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-20 17:45:55 -05:00
yindo closed this issue 2026-02-20 17:45:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#1938