langchain 1.1.2__tar.gz → 1.1.3__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.
- {langchain-1.1.2 → langchain-1.1.3}/PKG-INFO +2 -2
- {langchain-1.1.2 → langchain-1.1.3}/langchain/__init__.py +1 -1
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/factory.py +4 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/summarization.py +11 -8
- {langchain-1.1.2 → langchain-1.1.3}/langchain/chat_models/base.py +10 -0
- {langchain-1.1.2 → langchain-1.1.3}/pyproject.toml +2 -2
- langchain-1.1.3/tests/unit_tests/agents/test_agent_name.py +99 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/chat_models/test_chat_models.py +1 -0
- {langchain-1.1.2 → langchain-1.1.3}/uv.lock +6 -6
- {langchain-1.1.2 → langchain-1.1.3}/.gitignore +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/LICENSE +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/Makefile +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/README.md +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/extended_testing_deps.txt +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/_execution.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/_redaction.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/context_editing.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/file_search.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/human_in_the_loop.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/model_call_limit.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/model_fallback.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/model_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/pii.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/shell_tool.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/todo.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/tool_call_limit.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/tool_emulator.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/tool_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/tool_selection.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/middleware/types.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/agents/structured_output.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/chat_models/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/embeddings/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/embeddings/base.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/messages/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/py.typed +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/rate_limiters/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/tools/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/langchain/tools/tool_node.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/scripts/check_imports.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_native_output[False].yaml.gz +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_native_output[True].yaml.gz +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_tool_output[False].yaml.gz +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_tool_output[True].yaml.gz +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/agents/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/agents/middleware/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/agents/middleware/test_shell_tool_integration.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/cache/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/cache/fake_embeddings.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/chat_models/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/chat_models/test_base.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/conftest.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/embeddings/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/embeddings/test_base.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/integration_tests/test_compile.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__snapshots__/test_middleware_agent.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__snapshots__/test_middleware_decorators.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__snapshots__/test_middleware_framework.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__snapshots__/test_return_direct_graph.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/any_str.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/compose-postgres.yml +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/compose-redis.yml +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/conftest.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/conftest_checkpointer.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/conftest_store.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/memory_assert.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/messages.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/__snapshots__/test_middleware_decorators.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/__snapshots__/test_middleware_diagram.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/__snapshots__/test_middleware_framework.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/__snapshots__/test_decorators.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/__snapshots__/test_diagram.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/__snapshots__/test_framework.ambr +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_composition.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_decorators.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_diagram.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_framework.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_overrides.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_tools.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_context_editing.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_file_search.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_human_in_the_loop.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_model_call_limit.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_model_fallback.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_model_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_pii.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_structured_output_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_summarization.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_todo.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_tool_call_limit.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_tool_emulator.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_tool_retry.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_tool_selection.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/model.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/specifications/responses.json +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/specifications/return_direct.json +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_create_agent_tool_validation.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_injected_runtime_create_agent.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_react_agent.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_response_format.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_response_format_integration.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_responses.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_responses_spec.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_return_direct_graph.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_return_direct_spec.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_state_schema.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_system_message.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/utils.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/chat_models/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/conftest.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/embeddings/test_base.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/embeddings/test_imports.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/stubs.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/test_dependencies.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/test_imports.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/test_pytest_config.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/tools/__init__.py +0 -0
- {langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/tools/test_imports.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: Building applications with LLMs through composability
|
|
5
5
|
Project-URL: Homepage, https://docs.langchain.com/
|
|
6
6
|
Project-URL: Documentation, https://reference.langchain.com/python/langchain/langchain/
|
|
@@ -12,7 +12,7 @@ Project-URL: Reddit, https://www.reddit.com/r/LangChain/
|
|
|
12
12
|
License: MIT
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Python: <4.0.0,>=3.10.0
|
|
15
|
-
Requires-Dist: langchain-core<2.0.0,>=1.1.
|
|
15
|
+
Requires-Dist: langchain-core<2.0.0,>=1.1.2
|
|
16
16
|
Requires-Dist: langgraph<1.1.0,>=1.0.2
|
|
17
17
|
Requires-Dist: pydantic<3.0.0,>=2.7.4
|
|
18
18
|
Provides-Extra: anthropic
|
|
@@ -1100,6 +1100,8 @@ def create_agent( # noqa: PLR0915
|
|
|
1100
1100
|
messages = [request.system_message, *messages]
|
|
1101
1101
|
|
|
1102
1102
|
output = model_.invoke(messages)
|
|
1103
|
+
if name:
|
|
1104
|
+
output.name = name
|
|
1103
1105
|
|
|
1104
1106
|
# Handle model output to get messages and structured_response
|
|
1105
1107
|
handled_output = _handle_model_output(output, effective_response_format)
|
|
@@ -1153,6 +1155,8 @@ def create_agent( # noqa: PLR0915
|
|
|
1153
1155
|
messages = [request.system_message, *messages]
|
|
1154
1156
|
|
|
1155
1157
|
output = await model_.ainvoke(messages)
|
|
1158
|
+
if name:
|
|
1159
|
+
output.name = name
|
|
1156
1160
|
|
|
1157
1161
|
# Handle model output to get messages and structured_response
|
|
1158
1162
|
handled_output = _handle_model_output(output, effective_response_format)
|
|
@@ -516,14 +516,17 @@ class SummarizationMiddleware(AgentMiddleware):
|
|
|
516
516
|
try:
|
|
517
517
|
if self.trim_tokens_to_summarize is None:
|
|
518
518
|
return messages
|
|
519
|
-
return
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
519
|
+
return cast(
|
|
520
|
+
"list[AnyMessage]",
|
|
521
|
+
trim_messages(
|
|
522
|
+
messages,
|
|
523
|
+
max_tokens=self.trim_tokens_to_summarize,
|
|
524
|
+
token_counter=self.token_counter,
|
|
525
|
+
start_on="human",
|
|
526
|
+
strategy="last",
|
|
527
|
+
allow_partial=True,
|
|
528
|
+
include_system=True,
|
|
529
|
+
),
|
|
527
530
|
)
|
|
528
531
|
except Exception: # noqa: BLE001
|
|
529
532
|
return messages[-_DEFAULT_FALLBACK_MESSAGE_COUNT:]
|
|
@@ -102,6 +102,7 @@ def init_chat_model(
|
|
|
102
102
|
- `deepseek...` -> `deepseek`
|
|
103
103
|
- `grok...` -> `xai`
|
|
104
104
|
- `sonar...` -> `perplexity`
|
|
105
|
+
- `solar...` -> `upstage`
|
|
105
106
|
model_provider: The model provider if not specified as part of the model arg
|
|
106
107
|
(see above).
|
|
107
108
|
|
|
@@ -129,6 +130,7 @@ def init_chat_model(
|
|
|
129
130
|
- `nvidia` -> [`langchain-nvidia-ai-endpoints`](https://docs.langchain.com/oss/python/integrations/providers/nvidia)
|
|
130
131
|
- `xai` -> [`langchain-xai`](https://docs.langchain.com/oss/python/integrations/providers/xai)
|
|
131
132
|
- `perplexity` -> [`langchain-perplexity`](https://docs.langchain.com/oss/python/integrations/providers/perplexity)
|
|
133
|
+
- `upstage` -> [`langchain-upstage`](https://docs.langchain.com/oss/python/integrations/providers/upstage)
|
|
132
134
|
|
|
133
135
|
configurable_fields: Which model parameters are configurable at runtime:
|
|
134
136
|
|
|
@@ -449,6 +451,11 @@ def _init_chat_model_helper(
|
|
|
449
451
|
from langchain_perplexity import ChatPerplexity
|
|
450
452
|
|
|
451
453
|
return ChatPerplexity(model=model, **kwargs)
|
|
454
|
+
if model_provider == "upstage":
|
|
455
|
+
_check_pkg("langchain_upstage")
|
|
456
|
+
from langchain_upstage import ChatUpstage
|
|
457
|
+
|
|
458
|
+
return ChatUpstage(model=model, **kwargs)
|
|
452
459
|
supported = ", ".join(_SUPPORTED_PROVIDERS)
|
|
453
460
|
msg = f"Unsupported {model_provider=}.\n\nSupported model providers are: {supported}"
|
|
454
461
|
raise ValueError(msg)
|
|
@@ -475,6 +482,7 @@ _SUPPORTED_PROVIDERS = {
|
|
|
475
482
|
"ibm",
|
|
476
483
|
"xai",
|
|
477
484
|
"perplexity",
|
|
485
|
+
"upstage",
|
|
478
486
|
}
|
|
479
487
|
|
|
480
488
|
|
|
@@ -499,6 +507,8 @@ def _attempt_infer_model_provider(model_name: str) -> str | None:
|
|
|
499
507
|
return "xai"
|
|
500
508
|
if model_name.startswith("sonar"):
|
|
501
509
|
return "perplexity"
|
|
510
|
+
if model_name.startswith("solar"):
|
|
511
|
+
return "upstage"
|
|
502
512
|
return None
|
|
503
513
|
|
|
504
514
|
|
|
@@ -9,10 +9,10 @@ license = { text = "MIT" }
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = []
|
|
11
11
|
|
|
12
|
-
version = "1.1.
|
|
12
|
+
version = "1.1.3"
|
|
13
13
|
requires-python = ">=3.10.0,<4.0.0"
|
|
14
14
|
dependencies = [
|
|
15
|
-
"langchain-core>=1.1.
|
|
15
|
+
"langchain-core>=1.1.2,<2.0.0",
|
|
16
16
|
"langgraph>=1.0.2,<1.1.0",
|
|
17
17
|
"pydantic>=2.7.4,<3.0.0",
|
|
18
18
|
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Test agent name parameter in create_agent.
|
|
2
|
+
|
|
3
|
+
This module tests that the name parameter correctly sets .name on AIMessage outputs.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
from langchain_core.messages import AIMessage, HumanMessage
|
|
10
|
+
from langchain_core.tools import tool
|
|
11
|
+
|
|
12
|
+
from langchain.agents import create_agent
|
|
13
|
+
|
|
14
|
+
from .model import FakeToolCallingModel
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@tool
|
|
18
|
+
def simple_tool(x: int) -> str:
|
|
19
|
+
"""Simple tool for basic tests."""
|
|
20
|
+
return f"Result: {x}"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_agent_name_set_on_ai_message() -> None:
|
|
24
|
+
"""Test that agent name is set on AIMessage when name is provided."""
|
|
25
|
+
agent = create_agent(
|
|
26
|
+
model=FakeToolCallingModel(tool_calls=[[]]),
|
|
27
|
+
name="test_agent",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
result = agent.invoke({"messages": [HumanMessage("Hello")]})
|
|
31
|
+
|
|
32
|
+
ai_messages = [m for m in result["messages"] if isinstance(m, AIMessage)]
|
|
33
|
+
assert len(ai_messages) == 1
|
|
34
|
+
assert ai_messages[0].name == "test_agent"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_agent_name_not_set_when_none() -> None:
|
|
38
|
+
"""Test that AIMessage.name is not set when name is not provided."""
|
|
39
|
+
agent = create_agent(
|
|
40
|
+
model=FakeToolCallingModel(tool_calls=[[]]),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
result = agent.invoke({"messages": [HumanMessage("Hello")]})
|
|
44
|
+
|
|
45
|
+
ai_messages = [m for m in result["messages"] if isinstance(m, AIMessage)]
|
|
46
|
+
assert len(ai_messages) == 1
|
|
47
|
+
assert ai_messages[0].name is None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_agent_name_on_multiple_iterations() -> None:
|
|
51
|
+
"""Test that agent name is set on all AIMessages in multi-turn conversation."""
|
|
52
|
+
agent = create_agent(
|
|
53
|
+
model=FakeToolCallingModel(
|
|
54
|
+
tool_calls=[[{"args": {"x": 1}, "id": "call_1", "name": "simple_tool"}], []]
|
|
55
|
+
),
|
|
56
|
+
tools=[simple_tool],
|
|
57
|
+
name="multi_turn_agent",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
result = agent.invoke({"messages": [HumanMessage("Call a tool")]})
|
|
61
|
+
|
|
62
|
+
ai_messages = [m for m in result["messages"] if isinstance(m, AIMessage)]
|
|
63
|
+
assert len(ai_messages) == 2
|
|
64
|
+
for msg in ai_messages:
|
|
65
|
+
assert msg.name == "multi_turn_agent"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@pytest.mark.asyncio
|
|
69
|
+
async def test_agent_name_async() -> None:
|
|
70
|
+
"""Test that agent name is set on AIMessage in async execution."""
|
|
71
|
+
agent = create_agent(
|
|
72
|
+
model=FakeToolCallingModel(tool_calls=[[]]),
|
|
73
|
+
name="async_agent",
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
result = await agent.ainvoke({"messages": [HumanMessage("Hello async")]})
|
|
77
|
+
|
|
78
|
+
ai_messages = [m for m in result["messages"] if isinstance(m, AIMessage)]
|
|
79
|
+
assert len(ai_messages) == 1
|
|
80
|
+
assert ai_messages[0].name == "async_agent"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@pytest.mark.asyncio
|
|
84
|
+
async def test_agent_name_async_multiple_iterations() -> None:
|
|
85
|
+
"""Test that agent name is set on all AIMessages in async multi-turn."""
|
|
86
|
+
agent = create_agent(
|
|
87
|
+
model=FakeToolCallingModel(
|
|
88
|
+
tool_calls=[[{"args": {"x": 5}, "id": "call_1", "name": "simple_tool"}], []]
|
|
89
|
+
),
|
|
90
|
+
tools=[simple_tool],
|
|
91
|
+
name="async_multi_agent",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
result = await agent.ainvoke({"messages": [HumanMessage("Call tool async")]})
|
|
95
|
+
|
|
96
|
+
ai_messages = [m for m in result["messages"] if isinstance(m, AIMessage)]
|
|
97
|
+
assert len(ai_messages) == 2
|
|
98
|
+
for msg in ai_messages:
|
|
99
|
+
assert msg.name == "async_multi_agent"
|
|
@@ -1925,7 +1925,7 @@ wheels = [
|
|
|
1925
1925
|
|
|
1926
1926
|
[[package]]
|
|
1927
1927
|
name = "langchain"
|
|
1928
|
-
version = "1.1.
|
|
1928
|
+
version = "1.1.3"
|
|
1929
1929
|
source = { editable = "." }
|
|
1930
1930
|
dependencies = [
|
|
1931
1931
|
{ name = "langchain-core" },
|
|
@@ -2166,7 +2166,7 @@ wheels = [
|
|
|
2166
2166
|
|
|
2167
2167
|
[[package]]
|
|
2168
2168
|
name = "langchain-core"
|
|
2169
|
-
version = "1.1.
|
|
2169
|
+
version = "1.1.2"
|
|
2170
2170
|
source = { editable = "../core" }
|
|
2171
2171
|
dependencies = [
|
|
2172
2172
|
{ name = "jsonpatch" },
|
|
@@ -2347,7 +2347,7 @@ wheels = [
|
|
|
2347
2347
|
|
|
2348
2348
|
[[package]]
|
|
2349
2349
|
name = "langchain-openai"
|
|
2350
|
-
version = "1.1.
|
|
2350
|
+
version = "1.1.1"
|
|
2351
2351
|
source = { editable = "../partners/openai" }
|
|
2352
2352
|
dependencies = [
|
|
2353
2353
|
{ name = "langchain-core" },
|
|
@@ -2548,7 +2548,7 @@ wheels = [
|
|
|
2548
2548
|
|
|
2549
2549
|
[[package]]
|
|
2550
2550
|
name = "langgraph"
|
|
2551
|
-
version = "1.0.
|
|
2551
|
+
version = "1.0.4"
|
|
2552
2552
|
source = { registry = "https://pypi.org/simple" }
|
|
2553
2553
|
dependencies = [
|
|
2554
2554
|
{ name = "langchain-core" },
|
|
@@ -2558,9 +2558,9 @@ dependencies = [
|
|
|
2558
2558
|
{ name = "pydantic" },
|
|
2559
2559
|
{ name = "xxhash" },
|
|
2560
2560
|
]
|
|
2561
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
2561
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d6/3c/af87902d300c1f467165558c8966d8b1e1f896dace271d3f35a410a5c26a/langgraph-1.0.4.tar.gz", hash = "sha256:86d08e25d7244340f59c5200fa69fdd11066aa999b3164b531e2a20036fac156", size = 484397, upload-time = "2025-11-25T20:31:48.608Z" }
|
|
2562
2562
|
wheels = [
|
|
2563
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
2563
|
+
{ url = "https://files.pythonhosted.org/packages/14/52/4eb25a3f60399da34ba34adff1b3e324cf0d87eb7a08cebf1882a9b5e0d5/langgraph-1.0.4-py3-none-any.whl", hash = "sha256:b1a835ceb0a8d69b9db48075e1939e28b1ad70ee23fa3fa8f90149904778bacf", size = 157271, upload-time = "2025-11-25T20:31:47.518Z" },
|
|
2564
2564
|
]
|
|
2565
2565
|
|
|
2566
2566
|
[[package]]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_native_output[False].yaml.gz
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_native_output[True].yaml.gz
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_tool_output[False].yaml.gz
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/cassettes/test_inference_to_tool_output[True].yaml.gz
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
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/__snapshots__/test_middleware_agent.ambr
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
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_composition.py
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_framework.py
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_overrides.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_pii.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/middleware/implementations/test_todo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/specifications/return_direct.json
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_create_agent_tool_validation.py
RENAMED
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_injected_runtime_create_agent.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain-1.1.2 → langchain-1.1.3}/tests/unit_tests/agents/test_response_format_integration.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
|