Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToolNode is not seting the status field of the ToolMessage #1251

Open
5 tasks done
thiagotps opened this issue Aug 7, 2024 · 0 comments · May be fixed by #1636
Open
5 tasks done

ToolNode is not seting the status field of the ToolMessage #1251

thiagotps opened this issue Aug 7, 2024 · 0 comments · May be fixed by #1636
Assignees

Comments

@thiagotps
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph/LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

import requests
from langgraph.prebuilt import ToolNode
from langchain_core.messages import AIMessage

def binance(symbol: str):
    """This tool get the symbol information from binance"""
    raise Exception("Network crashed !!!")


ToolNode([binance]).invoke({"messages": [
AIMessage(content=[{'type': 'tool_use', 'name': 'binance', 'input': {'symbol': 'BTCBRL'}, 'id': 'tooluse_82v7QpgYQv6uL2stXaFaQw'}], response_metadata={'ResponseMetadata': {'RequestId': '2bad89c2-9451-41ce-a360-221509ee434f', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Wed, 07 Aug 2024 13:03:07 GMT', 'content-type': 'application/json', 'content-length': '275', 'connection': 'keep-alive', 'x-amzn-requestid': '2bad89c2-9451-41ce-a360-221509ee434f'}, 'RetryAttempts': 0}, 'stopReason': 'tool_use', 'metrics': {'latencyMs': 748}}, id='run-808b9eb2-887d-43ab-addd-b77d37ecb026-0', tool_calls=[{'name': 'binance', 'args': {'symbol': 'BTCBRL'}, 'id': 'tooluse_82v7QpgYQv6uL2stXaFaQw', 'type': 'tool_call'}], usage_metadata={'input_tokens': 337, 'output_tokens': 56, 'total_tokens': 393})
    ]})

Error Message and Stack Trace (if applicable)

{'messages': [ToolMessage(content="Error: Exception('Network crashed !!!')\n Please fix your mistakes.", name='binance', tool_call_id='tooluse_82v7QpgYQv6uL2stXaFaQw')]}

Description

When a tool throws an exception, currently ToolNode doesn't set the status field of the ToolMessage

System Info

platform: linux

poetry show:
aiohappyeyeballs 2.3.5 Happy Eyeballs for asyncio
aiohttp 3.10.1 Async http client/server framework (asyncio)
aiosignal 1.3.1 aiosignal: a list of registered asynchronous callbacks
annotated-types 0.7.0 Reusable constraint types to use with typing.Annotated
anthropic 0.32.0 The official Python library for the anthropic API
anyio 4.4.0 High level compatibility layer for multiple asynchronous event loop implementations
asgiref 3.8.1 ASGI specs, helper code, and adapters
asttokens 2.4.1 Annotate AST trees with source code positions
attrs 24.2.0 Classes Without Boilerplate
awswrangler 3.9.0 Pandas on AWS.
backoff 2.2.1 Function decoration for backoff and retry
blinker 1.8.2 Fast, simple object-to-object and broadcast signaling
boto3 1.34.155 The AWS SDK for Python
botocore 1.34.155 Low-level, data-driven core of boto 3.
certifi 2024.7.4 Python package for providing Mozilla's CA Bundle.
charset-normalizer 3.3.2 The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
click 8.1.7 Composable command line interface toolkit
cohere 5.6.2
comm 0.2.2 Jupyter Python Comm implementation, for usage in ipykernel, xeus-python etc.
dataclasses-json 0.6.7 Easily serialize dataclasses to and from JSON.
debugpy 1.8.5 An implementation of the Debug Adapter Protocol for Python
decorator 5.1.1 Decorators for Humans
distro 1.9.0 Distro - an OS platform information API
et-xmlfile 1.1.0 An implementation of lxml.xmlfile for the standard library
executing 2.0.1 Get the currently executing AST node of a frame, and other information
fastavro 1.9.5 Fast read/write of AVRO files
filelock 3.15.4 A platform independent file lock.
flask 3.0.3 A simple framework for building complex web applications.
frozenlist 1.4.1 A list-like structure which implements collections.abc.MutableSequence
fsspec 2024.6.1 File-system specification
gql 3.5.0 GraphQL client for Python
graphql-core 3.2.3 GraphQL implementation for Python, a port of GraphQL.js, the JavaScript reference implementation for GraphQL.
greenlet 3.0.3 Lightweight in-process concurrent programming
h11 0.14.0 A pure-Python, bring-your-own-I/O implementation of HTTP/1.1
httpcore 1.0.5 A minimal low-level HTTP client.
httpx 0.27.0 The next generation HTTP client.
httpx-sse 0.4.0 Consume Server-Sent Event (SSE) messages with HTTPX.
huggingface-hub 0.24.5 Client library to download and publish models, datasets and other repos on the huggingface.co hub
idna 3.7 Internationalized Domain Names in Applications (IDNA)
ipykernel 6.29.5 IPython Kernel for Jupyter
ipython 8.26.0 IPython: Productive Interactive Computing
itsdangerous 2.2.0 Safely pass data to untrusted environments and back.
jedi 0.19.1 An autocompletion tool for Python that can be used for text editors.
jinja2 3.1.4 A very fast and expressive template engine.
jiter 0.5.0 Fast iterable JSON parser.
jmespath 1.0.1 JSON Matching Expressions
jsonpatch 1.33 Apply JSON-Patches (RFC 6902)
jsonpointer 3.0.0 Identify specific nodes in a JSON document (RFC 6901)
jupyter-client 8.6.2 Jupyter protocol implementation and client libraries
jupyter-core 5.7.2 Jupyter core package. A base package on which Jupyter projects rely.
langchain 0.2.12 Building applications with LLMs through composability
langchain-aws 0.1.15 ../../../../../../../mnt/secondary/thiago/github/langchain-aws-fork/libs/aws An integration package connecting AWS and LangChain
langchain-cohere 0.1.9 An integration package connecting Cohere and LangChain
langchain-community 0.2.11 Community contributed LangChain integrations.
langchain-core 0.2.28 Building applications with LLMs through composability
langchain-experimental 0.0.64 Building applications with LLMs through composability
langchain-openai 0.1.20 An integration package connecting OpenAI and LangChain
langchain-postgres 0.0.9 An integration package connecting Postgres and LangChain
langchain-text-splitters 0.2.2 LangChain text splitting utilities
langchainhub 0.1.20 The LangChain Hub API client
langgraph 0.2.1 Building stateful, multi-actor applications with LLMs
langgraph-checkpoint 1.0.2 Library with base interfaces for LangGraph checkpoint savers.
langsmith 0.1.98 Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.
markupsafe 2.1.5 Safely add untrusted strings to HTML/XML markup.
marshmallow 3.21.3 A lightweight library for converting complex datatypes to and from native Python datatypes.
matplotlib-inline 0.1.7 Inline Matplotlib backend for Jupyter
multidict 6.0.5 multidict implementation
mypy-extensions 1.0.0 Type system extensions for programs checked with the mypy type checker.
nest-asyncio 1.6.0 Patch asyncio to allow nested event loops
numpy 1.26.4 Fundamental package for array computing in Python
openai 1.40.0 The official Python library for the openai API
openpyxl 3.1.5 A Python library to read/write Excel 2010 xlsx/xlsm files
orjson 3.10.6 Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
packaging 24.1 Core utilities for Python packages
pandas 2.2.2 Powerful data structures for data analysis, time series, and statistics
parameterized 0.9.0 Parameterized testing with any Python test framework
parso 0.8.4 A Python Parser
pexpect 4.9.0 Pexpect allows easy control of interactive console applications.
pgvector 0.2.5 pgvector support for Python
platformdirs 4.2.2 A small Python package for determining appropriate platform-specific dirs, e.g. a user data dir.
prompt-toolkit 3.0.47 Library for building powerful interactive command lines in Python
psutil 6.0.0 Cross-platform lib for process and system monitoring in Python.
psycopg 3.2.1 PostgreSQL database adapter for Python
psycopg-pool 3.2.2 Connection Pool for Psycopg
psycopg2-binary 2.9.9 psycopg2 - Python-PostgreSQL Database Adapter
ptyprocess 0.7.0 Run a subprocess in a pseudo terminal
pure-eval 0.2.3 Safely evaluate AST nodes without side effects
pyarrow 17.0.0 Python library for Apache Arrow
pydantic 2.8.2 Data validation using Python type hints
pydantic-core 2.20.1 Core functionality for Pydantic validation and serialization
pygments 2.18.0 Pygments is a syntax highlighting package written in Python.
python-dateutil 2.9.0.post0 Extensions to the standard Python datetime module
python-dotenv 1.0.1 Read key-value pairs from a .env file and set them as environment variables
python-json-logger 2.0.7 A python library adding a json log formatter
pytz 2024.1 World timezone definitions, modern and historical
pywa 1.24.0 Python wrapper for the WhatsApp Cloud API
pyyaml 6.0.2 YAML parser and emitter for Python
pyzmq 26.1.0 Python bindings for 0MQ
redis 5.0.8 Python client for Redis database and key-value store
regex 2024.7.24 Alternative regular expression module, to replace re.
requests 2.32.3 Python HTTP for Humans.
requests-aws4auth 1.3.1 AWS4 authentication for Requests
requests-toolbelt 1.0.0 A utility belt for advanced users of python-requests
s3transfer 0.10.2 An Amazon S3 Transfer Manager
setuptools 72.1.0 Easily download, build, install, upgrade, and uninstall Python packages
six 1.16.0 Python 2 and 3 compatibility utilities
sniffio 1.3.1 Sniff out which async library your code is running under
sqlalchemy 2.0.32 Database Abstraction Library
stack-data 0.6.3 Extract data from python stack frames and tracebacks for informative displays
tabulate 0.9.0 Pretty-print tabular data
tavily-python 0.3.5 Python wrapper for the Tavily API
tenacity 8.5.0 Retry code until it succeeds
tiktoken 0.7.0 tiktoken is a fast BPE tokeniser for use with OpenAI's models
tokenizers 0.19.1
tornado 6.4.1 Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.
tqdm 4.66.5 Fast, Extensible Progress Meter
traitlets 5.14.3 Traitlets Python configuration system
types-requests 2.32.0.20240712 Typing stubs for requests
typing-extensions 4.12.2 Backported and Experimental Type Hints for Python 3.8+
typing-inspect 0.9.0 Runtime inspection utilities for typing module.
tzdata 2024.1 Provider of IANA time zone data
urllib3 2.2.2 HTTP library with thread-safe connection pooling, file post, and more.
wcwidth 0.2.13 Measures the displayed width of unicode strings in a terminal
websockets 11.0.3 An implementation of the WebSocket Protocol (RFC 6455 & 7692)
werkzeug 3.0.3 The comprehensive WSGI web application library.
yarl 1.9.4 Yet another URL library

@baskaryan baskaryan self-assigned this Aug 7, 2024
@hinthornw hinthornw linked a pull request Sep 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants