langchain 1.0.0rc1__tar.gz → 1.0.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langchain might be problematic. Click here for more details.
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/PKG-INFO +2 -2
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/__init__.py +1 -1
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/factory.py +1 -10
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/tools/tool_node.py +2 -1
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/pyproject.toml +2 -2
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/__snapshots__/test_middleware_agent.ambr +7 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/uv.lock +2 -2
- langchain-1.0.0rc1/tests/unit_tests/agents/__snapshots__/test_return_direct_graph.ambr +0 -69
- langchain-1.0.0rc1/tests/unit_tests/agents/test_return_direct_graph.py +0 -73
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/.gitignore +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/LICENSE +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/Makefile +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/README.md +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/extended_testing_deps.txt +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/context_editing.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/human_in_the_loop.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/model_call_limit.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/model_fallback.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/pii.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/summarization.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/todo.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/tool_call_limit.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/tool_emulator.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/tool_retry.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/tool_selection.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/middleware/types.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/agents/structured_output.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/chat_models/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/chat_models/base.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/embeddings/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/embeddings/base.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/messages/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/py.typed +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/rate_limiters/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/langchain/tools/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/scripts/check_imports.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/agents/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/agents/test_response_format.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/cache/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/cache/fake_embeddings.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/chat_models/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/chat_models/test_base.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/conftest.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/embeddings/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/embeddings/test_base.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/test_compile.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/__snapshots__/test_middleware_decorators.ambr +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/any_str.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/compose-postgres.yml +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/compose-redis.yml +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/conftest.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/conftest_checkpointer.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/conftest_store.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/memory_assert.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/messages.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_before_after_agent.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_llm_tool_selection.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_override_methods.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_tool_emulator.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_tool_retry.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_wrap_model_call_decorator.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_wrap_model_call_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_wrap_tool_call_decorator.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/model.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/specifications/responses.json +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/specifications/return_direct.json +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_context_editing_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_handler_composition.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_injected_runtime_create_agent.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_middleware_agent.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_middleware_decorators.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_middleware_tools.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_model_fallback_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_on_tool_call_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_pii_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_react_agent.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_response_format.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_responses.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_responses_spec.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_return_direct_spec.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_state_schema.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_sync_async_tool_wrapper_composition.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_todo_middleware.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_tool_call_limit.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_tool_node.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_tool_node_interceptor_unregistered.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/utils.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/chat_models/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/chat_models/test_chat_models.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/conftest.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/embeddings/test_base.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/embeddings/test_imports.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/stubs.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/test_dependencies.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/test_imports.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/test_pytest_config.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/tools/__init__.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/tools/test_imports.py +0 -0
- {langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/tools/test_on_tool_call.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0rc2
|
|
4
4
|
Summary: Building applications with LLMs through composability
|
|
5
5
|
Project-URL: homepage, https://docs.langchain.com/
|
|
6
6
|
Project-URL: repository, https://github.com/langchain-ai/langchain/tree/master/libs/langchain
|
|
@@ -11,7 +11,7 @@ Project-URL: reddit, https://www.reddit.com/r/LangChain/
|
|
|
11
11
|
License: MIT
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Python: <4.0.0,>=3.10.0
|
|
14
|
-
Requires-Dist: langchain-core<2.0.0,>=1.0.
|
|
14
|
+
Requires-Dist: langchain-core<2.0.0,>=1.0.0rc3
|
|
15
15
|
Requires-Dist: langgraph<2.0.0,>=1.0.0a4
|
|
16
16
|
Requires-Dist: pydantic<3.0.0,>=2.7.4
|
|
17
17
|
Provides-Extra: anthropic
|
|
@@ -1225,15 +1225,6 @@ def create_agent( # noqa: PLR0915
|
|
|
1225
1225
|
graph.add_edge(START, entry_node)
|
|
1226
1226
|
# add conditional edges only if tools exist
|
|
1227
1227
|
if tool_node is not None:
|
|
1228
|
-
# Only include exit_node in destinations if any tool has return_direct=True
|
|
1229
|
-
# or if there are structured output tools
|
|
1230
|
-
tools_to_model_destinations = [loop_entry_node]
|
|
1231
|
-
if (
|
|
1232
|
-
any(tool.return_direct for tool in tool_node.tools_by_name.values())
|
|
1233
|
-
or structured_output_tools
|
|
1234
|
-
):
|
|
1235
|
-
tools_to_model_destinations.append(exit_node)
|
|
1236
|
-
|
|
1237
1228
|
graph.add_conditional_edges(
|
|
1238
1229
|
"tools",
|
|
1239
1230
|
_make_tools_to_model_edge(
|
|
@@ -1242,7 +1233,7 @@ def create_agent( # noqa: PLR0915
|
|
|
1242
1233
|
structured_output_tools=structured_output_tools,
|
|
1243
1234
|
end_destination=exit_node,
|
|
1244
1235
|
),
|
|
1245
|
-
|
|
1236
|
+
[loop_entry_node, exit_node],
|
|
1246
1237
|
)
|
|
1247
1238
|
|
|
1248
1239
|
# base destinations are tools and exit_node
|
|
@@ -75,6 +75,7 @@ from langchain_core.tools import tool as create_tool
|
|
|
75
75
|
from langchain_core.tools.base import (
|
|
76
76
|
TOOL_MESSAGE_BLOCK_TYPES,
|
|
77
77
|
ToolException,
|
|
78
|
+
_DirectlyInjectedToolArg,
|
|
78
79
|
get_all_basemodel_annotations,
|
|
79
80
|
)
|
|
80
81
|
from langgraph._internal._runnable import RunnableCallable
|
|
@@ -1349,7 +1350,7 @@ def tools_condition(
|
|
|
1349
1350
|
|
|
1350
1351
|
|
|
1351
1352
|
@dataclass
|
|
1352
|
-
class ToolRuntime(
|
|
1353
|
+
class ToolRuntime(_DirectlyInjectedToolArg, Generic[ContextT, StateT]):
|
|
1353
1354
|
"""Runtime context automatically injected into tools.
|
|
1354
1355
|
|
|
1355
1356
|
When a tool function has a parameter named 'tool_runtime' with type hint
|
|
@@ -7,13 +7,13 @@ authors = []
|
|
|
7
7
|
license = { text = "MIT" }
|
|
8
8
|
requires-python = ">=3.10.0,<4.0.0"
|
|
9
9
|
dependencies = [
|
|
10
|
-
"langchain-core>=1.0.
|
|
10
|
+
"langchain-core>=1.0.0rc3,<2.0.0",
|
|
11
11
|
"langgraph>=1.0.0a4,<2.0.0",
|
|
12
12
|
"pydantic>=2.7.4,<3.0.0",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
name = "langchain"
|
|
16
|
-
version = "1.0.
|
|
16
|
+
version = "1.0.0rc2"
|
|
17
17
|
description = "Building applications with LLMs through composability"
|
|
18
18
|
readme = "README.md"
|
|
19
19
|
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
__start__ --> NoopZero\2ebefore_agent;
|
|
21
21
|
model -.-> NoopTwo\2eafter_agent;
|
|
22
22
|
model -.-> tools;
|
|
23
|
+
tools -.-> NoopTwo\2eafter_agent;
|
|
23
24
|
tools -.-> model;
|
|
24
25
|
NoopOne\2eafter_agent --> __end__;
|
|
25
26
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
@@ -342,6 +343,7 @@
|
|
|
342
343
|
__start__ --> NoopSeven\2ebefore_model;
|
|
343
344
|
model --> NoopEight\2eafter_model;
|
|
344
345
|
tools -.-> NoopSeven\2ebefore_model;
|
|
346
|
+
tools -.-> __end__;
|
|
345
347
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
346
348
|
classDef first fill-opacity:0
|
|
347
349
|
classDef last fill:#bfb6fc
|
|
@@ -374,6 +376,7 @@
|
|
|
374
376
|
__start__ --> NoopSeven\2ebefore_model;
|
|
375
377
|
model --> NoopEight\2eafter_model;
|
|
376
378
|
tools -.-> NoopSeven\2ebefore_model;
|
|
379
|
+
tools -.-> __end__;
|
|
377
380
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
378
381
|
classDef first fill-opacity:0
|
|
379
382
|
classDef last fill:#bfb6fc
|
|
@@ -406,6 +409,7 @@
|
|
|
406
409
|
__start__ --> NoopSeven\2ebefore_model;
|
|
407
410
|
model --> NoopEight\2eafter_model;
|
|
408
411
|
tools -.-> NoopSeven\2ebefore_model;
|
|
412
|
+
tools -.-> __end__;
|
|
409
413
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
410
414
|
classDef first fill-opacity:0
|
|
411
415
|
classDef last fill:#bfb6fc
|
|
@@ -438,6 +442,7 @@
|
|
|
438
442
|
__start__ --> NoopSeven\2ebefore_model;
|
|
439
443
|
model --> NoopEight\2eafter_model;
|
|
440
444
|
tools -.-> NoopSeven\2ebefore_model;
|
|
445
|
+
tools -.-> __end__;
|
|
441
446
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
442
447
|
classDef first fill-opacity:0
|
|
443
448
|
classDef last fill:#bfb6fc
|
|
@@ -470,6 +475,7 @@
|
|
|
470
475
|
__start__ --> NoopSeven\2ebefore_model;
|
|
471
476
|
model --> NoopEight\2eafter_model;
|
|
472
477
|
tools -.-> NoopSeven\2ebefore_model;
|
|
478
|
+
tools -.-> __end__;
|
|
473
479
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
474
480
|
classDef first fill-opacity:0
|
|
475
481
|
classDef last fill:#bfb6fc
|
|
@@ -491,6 +497,7 @@
|
|
|
491
497
|
__start__ --> model;
|
|
492
498
|
model -.-> __end__;
|
|
493
499
|
model -.-> tools;
|
|
500
|
+
tools -.-> __end__;
|
|
494
501
|
tools -.-> model;
|
|
495
502
|
classDef default fill:#f2f0ff,line-height:1.2
|
|
496
503
|
classDef first fill-opacity:0
|
|
@@ -1550,7 +1550,7 @@ wheels = [
|
|
|
1550
1550
|
|
|
1551
1551
|
[[package]]
|
|
1552
1552
|
name = "langchain"
|
|
1553
|
-
version = "1.0.
|
|
1553
|
+
version = "1.0.0rc2"
|
|
1554
1554
|
source = { editable = "." }
|
|
1555
1555
|
dependencies = [
|
|
1556
1556
|
{ name = "langchain-core" },
|
|
@@ -1740,7 +1740,7 @@ wheels = [
|
|
|
1740
1740
|
|
|
1741
1741
|
[[package]]
|
|
1742
1742
|
name = "langchain-core"
|
|
1743
|
-
version = "1.0.
|
|
1743
|
+
version = "1.0.0rc3"
|
|
1744
1744
|
source = { editable = "../core" }
|
|
1745
1745
|
dependencies = [
|
|
1746
1746
|
{ name = "jsonpatch" },
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# serializer version: 1
|
|
2
|
-
# name: test_agent_graph_with_mixed_tools
|
|
3
|
-
'''
|
|
4
|
-
---
|
|
5
|
-
config:
|
|
6
|
-
flowchart:
|
|
7
|
-
curve: linear
|
|
8
|
-
---
|
|
9
|
-
graph TD;
|
|
10
|
-
__start__([<p>__start__</p>]):::first
|
|
11
|
-
model(model)
|
|
12
|
-
tools(tools)
|
|
13
|
-
__end__([<p>__end__</p>]):::last
|
|
14
|
-
__start__ --> model;
|
|
15
|
-
model -.-> __end__;
|
|
16
|
-
model -.-> tools;
|
|
17
|
-
tools -.-> __end__;
|
|
18
|
-
tools -.-> model;
|
|
19
|
-
classDef default fill:#f2f0ff,line-height:1.2
|
|
20
|
-
classDef first fill-opacity:0
|
|
21
|
-
classDef last fill:#bfb6fc
|
|
22
|
-
|
|
23
|
-
'''
|
|
24
|
-
# ---
|
|
25
|
-
# name: test_agent_graph_with_return_direct_tool
|
|
26
|
-
'''
|
|
27
|
-
---
|
|
28
|
-
config:
|
|
29
|
-
flowchart:
|
|
30
|
-
curve: linear
|
|
31
|
-
---
|
|
32
|
-
graph TD;
|
|
33
|
-
__start__([<p>__start__</p>]):::first
|
|
34
|
-
model(model)
|
|
35
|
-
tools(tools)
|
|
36
|
-
__end__([<p>__end__</p>]):::last
|
|
37
|
-
__start__ --> model;
|
|
38
|
-
model -.-> __end__;
|
|
39
|
-
model -.-> tools;
|
|
40
|
-
tools -.-> __end__;
|
|
41
|
-
tools -.-> model;
|
|
42
|
-
classDef default fill:#f2f0ff,line-height:1.2
|
|
43
|
-
classDef first fill-opacity:0
|
|
44
|
-
classDef last fill:#bfb6fc
|
|
45
|
-
|
|
46
|
-
'''
|
|
47
|
-
# ---
|
|
48
|
-
# name: test_agent_graph_without_return_direct_tools
|
|
49
|
-
'''
|
|
50
|
-
---
|
|
51
|
-
config:
|
|
52
|
-
flowchart:
|
|
53
|
-
curve: linear
|
|
54
|
-
---
|
|
55
|
-
graph TD;
|
|
56
|
-
__start__([<p>__start__</p>]):::first
|
|
57
|
-
model(model)
|
|
58
|
-
tools(tools)
|
|
59
|
-
__end__([<p>__end__</p>]):::last
|
|
60
|
-
__start__ --> model;
|
|
61
|
-
model -.-> __end__;
|
|
62
|
-
model -.-> tools;
|
|
63
|
-
tools -.-> model;
|
|
64
|
-
classDef default fill:#f2f0ff,line-height:1.2
|
|
65
|
-
classDef first fill-opacity:0
|
|
66
|
-
classDef last fill:#bfb6fc
|
|
67
|
-
|
|
68
|
-
'''
|
|
69
|
-
# ---
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"""Tests for return_direct tool graph structure."""
|
|
2
|
-
|
|
3
|
-
from langchain_core.tools import tool
|
|
4
|
-
from syrupy.assertion import SnapshotAssertion
|
|
5
|
-
|
|
6
|
-
from langchain.agents.factory import create_agent
|
|
7
|
-
|
|
8
|
-
from .model import FakeToolCallingModel
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_agent_graph_without_return_direct_tools(snapshot: SnapshotAssertion) -> None:
|
|
12
|
-
"""Test that graph WITHOUT return_direct tools does NOT have edge from tools to end."""
|
|
13
|
-
|
|
14
|
-
@tool
|
|
15
|
-
def normal_tool(input_string: str) -> str:
|
|
16
|
-
"""A normal tool without return_direct."""
|
|
17
|
-
return input_string
|
|
18
|
-
|
|
19
|
-
agent = create_agent(
|
|
20
|
-
model=FakeToolCallingModel(),
|
|
21
|
-
tools=[normal_tool],
|
|
22
|
-
system_prompt="You are a helpful assistant.",
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# The mermaid diagram should NOT include an edge from tools to __end__
|
|
26
|
-
# when no tools have return_direct=True
|
|
27
|
-
mermaid_diagram = agent.get_graph().draw_mermaid()
|
|
28
|
-
assert mermaid_diagram == snapshot
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_agent_graph_with_return_direct_tool(snapshot: SnapshotAssertion) -> None:
|
|
32
|
-
"""Test that graph WITH return_direct tools has correct edge from tools to end."""
|
|
33
|
-
|
|
34
|
-
@tool(return_direct=True)
|
|
35
|
-
def return_direct_tool(input_string: str) -> str:
|
|
36
|
-
"""A tool with return_direct=True."""
|
|
37
|
-
return input_string
|
|
38
|
-
|
|
39
|
-
agent = create_agent(
|
|
40
|
-
model=FakeToolCallingModel(),
|
|
41
|
-
tools=[return_direct_tool],
|
|
42
|
-
system_prompt="You are a helpful assistant.",
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
# The mermaid diagram SHOULD include an edge from tools to __end__
|
|
46
|
-
# when at least one tool has return_direct=True
|
|
47
|
-
mermaid_diagram = agent.get_graph().draw_mermaid()
|
|
48
|
-
assert mermaid_diagram == snapshot
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def test_agent_graph_with_mixed_tools(snapshot: SnapshotAssertion) -> None:
|
|
52
|
-
"""Test that graph with mixed tools (some return_direct, some not) has correct edges."""
|
|
53
|
-
|
|
54
|
-
@tool(return_direct=True)
|
|
55
|
-
def return_direct_tool(input_string: str) -> str:
|
|
56
|
-
"""A tool with return_direct=True."""
|
|
57
|
-
return input_string
|
|
58
|
-
|
|
59
|
-
@tool
|
|
60
|
-
def normal_tool(input_string: str) -> str:
|
|
61
|
-
"""A normal tool without return_direct."""
|
|
62
|
-
return input_string
|
|
63
|
-
|
|
64
|
-
agent = create_agent(
|
|
65
|
-
model=FakeToolCallingModel(),
|
|
66
|
-
tools=[return_direct_tool, normal_tool],
|
|
67
|
-
system_prompt="You are a helpful assistant.",
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
# The mermaid diagram SHOULD include an edge from tools to __end__
|
|
71
|
-
# because at least one tool has return_direct=True
|
|
72
|
-
mermaid_diagram = agent.get_graph().draw_mermaid()
|
|
73
|
-
assert mermaid_diagram == snapshot
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/integration_tests/agents/test_response_format.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_tool_emulator.py
RENAMED
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/middleware/test_tool_retry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/specifications/responses.json
RENAMED
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/specifications/return_direct.json
RENAMED
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_context_editing_middleware.py
RENAMED
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_handler_composition.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_middleware_decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_model_fallback_middleware.py
RENAMED
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_on_tool_call_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.0.0rc1 → langchain-1.0.0rc2}/tests/unit_tests/agents/test_return_direct_spec.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|