mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-29 11:19:54 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac16bdb795 | ||
|
|
0d4ac836e3 | ||
|
|
201c8015ea |
@@ -282,8 +282,8 @@ REDIRECT_MAP = {
|
||||
"reference/supervisor.md": "https://reference.langchain.com/python/langgraph/supervisor/",
|
||||
"reference/swarm.md": "https://reference.langchain.com/python/langgraph/swarm/",
|
||||
"reference/mcp.md": "https://reference.langchain.com/python/langgraph/mcp/",
|
||||
"cloud/reference/sdk/python_sdk_ref.md": "https://reference.langchain.com/python/platform/python_sdk/",
|
||||
"reference/remote_graph.md": "https://reference.langchain.com/python/platform/remote_graph/",
|
||||
"cloud/reference/sdk/python_sdk_ref.md": "https://reference.langchain.com/python/langsmith/deployment/sdk/",
|
||||
"reference/remote_graph.md": "https://reference.langchain.com/python/langsmith/deployment/remote_graph/",
|
||||
|
||||
# additional exclude-search entries from mkdocs.yml
|
||||
"additional-resources/index.md": "https://docs.langchain.com/oss/python/langchain/overview",
|
||||
|
||||
@@ -316,10 +316,7 @@ class RunnableCallable(Runnable):
|
||||
continue
|
||||
|
||||
# If the kwarg is accepted by the function, store the key / runtime attribute to inject
|
||||
# Use the actual parameter default from the function signature if available,
|
||||
# otherwise fall back to the default from KWARGS_CONFIG_KEYS
|
||||
param_default = p.default if p.default is not inspect.Parameter.empty else default
|
||||
self.func_accepts[kw] = (runtime_key, param_default)
|
||||
self.func_accepts[kw] = (runtime_key, default)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
repr_args = {
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "langgraph"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
description = "Building stateful, multi-actor applications with LLMs"
|
||||
authors = []
|
||||
requires-python = ">=3.10"
|
||||
|
||||
Generated
+3
-3
@@ -1,5 +1,5 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
revision = 2
|
||||
requires-python = ">=3.10"
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.14'",
|
||||
@@ -1345,7 +1345,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
@@ -1710,7 +1710,7 @@ test = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph-prebuilt"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = { editable = "../prebuilt" }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
|
||||
@@ -84,7 +84,6 @@ from langchain_core.tools.base import (
|
||||
from langgraph._internal._runnable import RunnableCallable
|
||||
from langgraph.errors import GraphBubbleUp
|
||||
from langgraph.graph.message import REMOVE_ALL_MESSAGES
|
||||
from langgraph.runtime import DEFAULT_RUNTIME
|
||||
from langgraph.store.base import BaseStore # noqa: TC002
|
||||
from langgraph.types import Command, Send, StreamWriter
|
||||
from pydantic import BaseModel, ValidationError
|
||||
@@ -703,7 +702,7 @@ class ToolNode(RunnableCallable):
|
||||
self,
|
||||
input: list[AnyMessage] | dict[str, Any] | BaseModel,
|
||||
config: RunnableConfig,
|
||||
runtime: Runtime = DEFAULT_RUNTIME,
|
||||
runtime: Runtime,
|
||||
) -> Any:
|
||||
tool_calls, input_type = self._parse_input(input)
|
||||
config_list = get_config_list(config, len(tool_calls))
|
||||
@@ -735,7 +734,7 @@ class ToolNode(RunnableCallable):
|
||||
self,
|
||||
input: list[AnyMessage] | dict[str, Any] | BaseModel,
|
||||
config: RunnableConfig,
|
||||
runtime: Runtime = DEFAULT_RUNTIME,
|
||||
runtime: Runtime,
|
||||
) -> Any:
|
||||
tool_calls, input_type = self._parse_input(input)
|
||||
config_list = get_config_list(config, len(tool_calls))
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "langgraph-prebuilt"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
description = "Library with high-level APIs for creating and executing LangGraph agents and tools."
|
||||
authors = []
|
||||
requires-python = ">=3.10"
|
||||
|
||||
@@ -9,6 +9,7 @@ from typing import (
|
||||
NoReturn,
|
||||
TypeVar,
|
||||
)
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
from langchain_core.messages import (
|
||||
@@ -50,26 +51,27 @@ from .model import FakeToolCallingModel
|
||||
pytestmark = pytest.mark.anyio
|
||||
|
||||
|
||||
def _create_mock_runtime(store: BaseStore | None = None) -> Mock:
|
||||
"""Create a mock Runtime object for testing ToolNode outside of graph context.
|
||||
|
||||
This helper is needed because ToolNode._func expects a Runtime parameter
|
||||
which is injected by RunnableCallable from config["configurable"]["__pregel_runtime"].
|
||||
When testing ToolNode directly (outside a graph), we need to provide this manually.
|
||||
"""
|
||||
mock_runtime = Mock()
|
||||
mock_runtime.store = store
|
||||
mock_runtime.context = None
|
||||
mock_runtime.stream_writer = lambda *args, **kwargs: None
|
||||
return mock_runtime
|
||||
|
||||
|
||||
def _create_config_with_runtime(store: BaseStore | None = None) -> RunnableConfig:
|
||||
"""Create a RunnableConfig for testing ToolNode.
|
||||
|
||||
Since ToolNode now has a default Runtime, this helper can be simplified.
|
||||
It only needs to inject a store if one is provided, otherwise an empty config works.
|
||||
|
||||
Args:
|
||||
store: Optional store to inject via runtime. If None, no runtime is needed.
|
||||
"""Create a RunnableConfig with mock Runtime for testing ToolNode.
|
||||
|
||||
Returns:
|
||||
RunnableConfig, optionally with __pregel_runtime if store is provided.
|
||||
RunnableConfig with __pregel_runtime in configurable dict.
|
||||
"""
|
||||
if store is None:
|
||||
# No runtime needed - ToolNode will use DEFAULT_RUNTIME
|
||||
return {}
|
||||
|
||||
# Create a mock runtime only when we need to inject a store
|
||||
from langgraph.runtime import Runtime
|
||||
runtime = Runtime(context=None, store=store, stream_writer=lambda *args, **kwargs: None)
|
||||
return {"configurable": {"__pregel_runtime": runtime}}
|
||||
return {"configurable": {"__pregel_runtime": _create_mock_runtime(store)}}
|
||||
|
||||
|
||||
def tool1(some_val: int, some_other_val: str) -> str:
|
||||
|
||||
Generated
+3
-3
@@ -1,5 +1,5 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
revision = 2
|
||||
requires-python = ">=3.10"
|
||||
|
||||
[[package]]
|
||||
@@ -246,7 +246,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = { editable = "../langgraph" }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
@@ -467,7 +467,7 @@ test = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph-prebuilt"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
|
||||
Reference in New Issue
Block a user