[PR #1064] [MERGED] [docs]Fix runtime error README.md example #1867

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/1064
Author: @KYUUUW
Created: 7/18/2024
Status: Merged
Merged: 7/22/2024
Merged by: @nfcampos

Base: mainHead: patch-1


📝 Commits (3)

📊 Changes

2 files changed (+4 additions, -4 deletions)

View changed files

📝 README.md (+2 -2)
📝 libs/langgraph/README.md (+2 -2)

📄 Description

version

langchain==0.2.5
langchain-anthropic==0.1.20
langgraph==0.1.9

AS-IS (Error)

# Define the tools for the agent to use
@tool
def search(query: str):
    """Call to surf the web."""
    # This is a placeholder, but don't tell the LLM that...
    if "sf" in query.lower() or "san francisco" in query.lower():
        
        return ["It's 60 degrees and foggy."]
    return ["It's 90 degrees and sunny."]

BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.2.content.0.tool_result.content.0: Input should be a valid dictionary or object to extract fields from'}}

To-be

# Define the tools for the agent to use
@tool
def search(query: str):
    """Call to surf the web."""
    # This is a placeholder, but don't tell the LLM that...
    if "sf" in query.lower() or "san francisco" in query.lower():
        
        return "It's 60 degrees and foggy."
    return "It's 90 degrees and sunny."

Result:
"Based on the search results, I can tell you that the current weather in San Francisco is:\n\nTemperature: 60 degrees Fahrenheit\nConditions: Foggy\n\nSan Francisco is known for its microclimates and frequent fog, especially during the summer months. The cool temperature and foggy conditions are quite typical for the city. Remember that the weather can change throughout the day, so if you're planning any activities, it's a good idea to dress in layers and be prepared for potential changes in temperature and visibility.\n\nIs there anything else you'd like to know about the weather in San Francisco or any other information I can help you with?"

Done😎


🔄 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/1064 **Author:** [@KYUUUW](https://github.com/KYUUUW) **Created:** 7/18/2024 **Status:** ✅ Merged **Merged:** 7/22/2024 **Merged by:** [@nfcampos](https://github.com/nfcampos) **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (3) - [`58af2c7`](https://github.com/langchain-ai/langgraph/commit/58af2c7d9fa70432c4f29443c35f95b44586baf8) Fix error in example - [`e8b05fa`](https://github.com/langchain-ai/langgraph/commit/e8b05faff47ad19c2a520d506546803df3a1d985) Merge branch 'main' into patch-1 - [`b3e44be`](https://github.com/langchain-ai/langgraph/commit/b3e44bed220de72138b6d20f18730e32c7d8028c) Fix example error ### 📊 Changes **2 files changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -2) 📝 `libs/langgraph/README.md` (+2 -2) </details> ### 📄 Description ## version ``` langchain==0.2.5 langchain-anthropic==0.1.20 langgraph==0.1.9 ``` ## AS-IS (Error) ```python # Define the tools for the agent to use @tool def search(query: str): """Call to surf the web.""" # This is a placeholder, but don't tell the LLM that... if "sf" in query.lower() or "san francisco" in query.lower(): return ["It's 60 degrees and foggy."] return ["It's 90 degrees and sunny."] ``` `BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.2.content.0.tool_result.content.0: Input should be a valid dictionary or object to extract fields from'}}` ## To-be ```python # Define the tools for the agent to use @tool def search(query: str): """Call to surf the web.""" # This is a placeholder, but don't tell the LLM that... if "sf" in query.lower() or "san francisco" in query.lower(): return "It's 60 degrees and foggy." return "It's 90 degrees and sunny." ``` Result: `"Based on the search results, I can tell you that the current weather in San Francisco is:\n\nTemperature: 60 degrees Fahrenheit\nConditions: Foggy\n\nSan Francisco is known for its microclimates and frequent fog, especially during the summer months. The cool temperature and foggy conditions are quite typical for the city. Remember that the weather can change throughout the day, so if you're planning any activities, it's a good idea to dress in layers and be prepared for potential changes in temperature and visibility.\n\nIs there anything else you'd like to know about the weather in San Francisco or any other information I can help you with?" ` ## Done😎 --- <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:44 -05:00
yindo closed this issue 2026-02-20 17:45:44 -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#1867