Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Jan 24, 2025
1 parent bd0a3b5 commit 076fbe6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions libs/langgraph/langgraph/prebuilt/tool_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from langgraph.errors import GraphBubbleUp
from langgraph.store.base import BaseStore
from langgraph.types import Command
from langgraph.utils.runnable import INJECTION_PLACEHOLDER, RunnableCallable
from langgraph.utils.runnable import PLACEHOLDER_FOR_INJECTABLE, RunnableCallable

INVALID_TOOL_NAME_ERROR_TEMPLATE = (
"Error: {requested_tool} is not a valid tool, try one of [{available_tools}]."
Expand Down Expand Up @@ -250,7 +250,7 @@ def invoke(
# The sentinel value is used to allow users to pass a custom value to `store`
# including a None.
if "store" not in kwargs:
kwargs["store"] = INJECTION_PLACEHOLDER
kwargs["store"] = PLACEHOLDER_FOR_INJECTABLE
return super().invoke(input, config, **kwargs)

async def ainvoke(
Expand All @@ -265,7 +265,7 @@ async def ainvoke(
# The sentinel value is used to allow users to pass a custom value to `store`
# including a None.
if "store" not in kwargs:
kwargs["store"] = INJECTION_PLACEHOLDER
kwargs["store"] = PLACEHOLDER_FOR_INJECTABLE
return await super().ainvoke(input, config, **kwargs)

async def _afunc(
Expand Down
8 changes: 4 additions & 4 deletions libs/langgraph/langgraph/utils/runnable.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class StrEnum(str, enum.Enum):

# Special type to denote any type is accepted
ANY_TYPE = object()
# Sentinel value for a named argument used to specify that a value should be injected.
INJECTION_PLACEHOLDER = object()
# Special type to denote that a corresponding named argument should be injected.
PLACEHOLDER_FOR_INJECTABLE = object()


ASYNCIO_ACCEPTS_CONTEXT = sys.version_info >= (3, 11)
Expand Down Expand Up @@ -192,7 +192,7 @@ def invoke(
for kw, _, config_key, default_value in KWARGS_CONFIG_KEYS:
# Check that the kwarg is not already set and that the function accepts it
# If it's set check that it was set by the user and isn't a placeholder
if kw in kwargs and kwargs[kw] is not INJECTION_PLACEHOLDER:
if kw in kwargs and kwargs[kw] is not PLACEHOLDER_FOR_INJECTABLE:
continue
if not self.func_accepts[kw]:
continue
Expand Down Expand Up @@ -252,7 +252,7 @@ async def ainvoke(
for kw, _, config_key, default_value in KWARGS_CONFIG_KEYS:
# Check that the kwarg is not already set and that the function accepts it
# If it's set check that it was set by the user and isn't a placeholder
if kw in kwargs and kwargs[kw] is not INJECTION_PLACEHOLDER:
if kw in kwargs and kwargs[kw] is not PLACEHOLDER_FOR_INJECTABLE:
continue
if not self.func_accepts[kw]:
continue
Expand Down

0 comments on commit 076fbe6

Please sign in to comment.