langchain-dev-utils 1.2.1__tar.gz → 1.2.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_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/PKG-INFO +5 -6
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/README.md +4 -4
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/README_cn.md +1 -1
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/pyproject.toml +2 -6
- langchain_dev_utils-1.2.3/src/langchain_dev_utils/__init__.py +1 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/model_fallback.py +1 -1
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/plan.py +5 -1
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/adapters/openai_compatible.py +7 -0
- langchain_dev_utils-1.2.1/src/langchain_dev_utils/__init__.py +0 -1
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/.gitignore +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/.python-version +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/.vscode/settings.json +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/LICENSE +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/factory.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/file_system.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/model_router.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/summarization.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/tool_emulator.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/middleware/tool_selection.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/plan.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/wrap.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/adapters/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/base.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/types.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/embeddings/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/embeddings/base.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/message_convert/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/message_convert/content.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/message_convert/format.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/parallel.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/sequential.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/types.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/py.typed +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/tool_calling/__init__.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/tool_calling/human_in_the_loop.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/tool_calling/utils.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_agent.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_chat_models.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_human_in_the_loop.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_load_embbeding.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_load_model.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_messages.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_model_tool_emulator.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_pipline.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_plan_middleware.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_router_model.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_tool_calling.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/tests/test_wrap_agent.py +0 -0
- {langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-dev-utils
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
4
4
|
Summary: A practical utility library for LangChain and LangGraph development
|
|
5
5
|
Project-URL: Source Code, https://github.com/TBice123123/langchain-dev-utils
|
|
6
6
|
Project-URL: repository, https://github.com/TBice123123/langchain-dev-utils
|
|
@@ -8,7 +8,6 @@ Project-URL: documentation, https://tbice123123.github.io/langchain-dev-utils-do
|
|
|
8
8
|
Author-email: tiebingice <tiebingice123@outlook.com>
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Python: >=3.11
|
|
11
|
-
Requires-Dist: langchain-deepseek>=1.0.1
|
|
12
11
|
Requires-Dist: langchain>=1.1.0
|
|
13
12
|
Requires-Dist: langgraph>=1.0.0
|
|
14
13
|
Provides-Extra: standard
|
|
@@ -172,7 +171,7 @@ text = format_sequence([
|
|
|
172
171
|
], separator="\n", with_num=True)
|
|
173
172
|
```
|
|
174
173
|
|
|
175
|
-
**For more information about message conversion, please refer to**: [Message
|
|
174
|
+
**For more information about message conversion, please refer to**: [Message Process](https://tbice123123.github.io/langchain-dev-utils-docs/en/message-conversion/message.html), [Formatting List Content](https://tbice123123.github.io/langchain-dev-utils-docs/en/message-conversion/format.html)
|
|
176
175
|
|
|
177
176
|
### 3. **Tool Calling**
|
|
178
177
|
|
|
@@ -232,7 +231,7 @@ def get_current_time() -> str:
|
|
|
232
231
|
return str(datetime.datetime.now().timestamp())
|
|
233
232
|
```
|
|
234
233
|
|
|
235
|
-
**For more information about tool calling, please refer to**: [Add Human-in-the-Loop Support](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/human-in-the-loop.html), [Tool Call
|
|
234
|
+
**For more information about tool calling, please refer to**: [Add Human-in-the-Loop Support](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/human-in-the-loop.html), [Tool Call Handling](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/tool.html)
|
|
236
235
|
|
|
237
236
|
### 4. **Agent Development**
|
|
238
237
|
|
|
@@ -279,7 +278,7 @@ response = agent.invoke({"messages": [{"role": "user", "content": "Give me a tra
|
|
|
279
278
|
print(response)
|
|
280
279
|
```
|
|
281
280
|
|
|
282
|
-
**For more information about agent development and all built-in middleware, please refer to**: [
|
|
281
|
+
**For more information about agent development and all built-in middleware, please refer to**: [Pre-built Agent Functions](https://tbice123123.github.io/langchain-dev-utils-docs/en/agent-development/prebuilt.html), [Middleware](https://tbice123123.github.io/langchain-dev-utils-docs/en/agent-development/middleware.html)
|
|
283
282
|
|
|
284
283
|
### 5. **State Graph Orchestration**
|
|
285
284
|
|
|
@@ -392,7 +391,7 @@ response = graph.invoke({"messages": [HumanMessage("Hello")]})
|
|
|
392
391
|
print(response)
|
|
393
392
|
```
|
|
394
393
|
|
|
395
|
-
**For more information about state graph orchestration, please refer to**: [State Graph Orchestration
|
|
394
|
+
**For more information about state graph orchestration, please refer to**: [State Graph Orchestration](https://tbice123123.github.io/langchain-dev-utils-docs/en/graph-orchestration/pipeline.html)
|
|
396
395
|
|
|
397
396
|
## 💬 Join the Community
|
|
398
397
|
|
|
@@ -155,7 +155,7 @@ text = format_sequence([
|
|
|
155
155
|
], separator="\n", with_num=True)
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
**For more information about message conversion, please refer to**: [Message
|
|
158
|
+
**For more information about message conversion, please refer to**: [Message Process](https://tbice123123.github.io/langchain-dev-utils-docs/en/message-conversion/message.html), [Formatting List Content](https://tbice123123.github.io/langchain-dev-utils-docs/en/message-conversion/format.html)
|
|
159
159
|
|
|
160
160
|
### 3. **Tool Calling**
|
|
161
161
|
|
|
@@ -215,7 +215,7 @@ def get_current_time() -> str:
|
|
|
215
215
|
return str(datetime.datetime.now().timestamp())
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
**For more information about tool calling, please refer to**: [Add Human-in-the-Loop Support](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/human-in-the-loop.html), [Tool Call
|
|
218
|
+
**For more information about tool calling, please refer to**: [Add Human-in-the-Loop Support](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/human-in-the-loop.html), [Tool Call Handling](https://tbice123123.github.io/langchain-dev-utils-docs/en/tool-calling/tool.html)
|
|
219
219
|
|
|
220
220
|
### 4. **Agent Development**
|
|
221
221
|
|
|
@@ -262,7 +262,7 @@ response = agent.invoke({"messages": [{"role": "user", "content": "Give me a tra
|
|
|
262
262
|
print(response)
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
**For more information about agent development and all built-in middleware, please refer to**: [
|
|
265
|
+
**For more information about agent development and all built-in middleware, please refer to**: [Pre-built Agent Functions](https://tbice123123.github.io/langchain-dev-utils-docs/en/agent-development/prebuilt.html), [Middleware](https://tbice123123.github.io/langchain-dev-utils-docs/en/agent-development/middleware.html)
|
|
266
266
|
|
|
267
267
|
### 5. **State Graph Orchestration**
|
|
268
268
|
|
|
@@ -375,7 +375,7 @@ response = graph.invoke({"messages": [HumanMessage("Hello")]})
|
|
|
375
375
|
print(response)
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
**For more information about state graph orchestration, please refer to**: [State Graph Orchestration
|
|
378
|
+
**For more information about state graph orchestration, please refer to**: [State Graph Orchestration](https://tbice123123.github.io/langchain-dev-utils-docs/en/graph-orchestration/pipeline.html)
|
|
379
379
|
|
|
380
380
|
## 💬 Join the Community
|
|
381
381
|
|
|
@@ -375,7 +375,7 @@ response = graph.invoke({"messages": [HumanMessage("你好")]})
|
|
|
375
375
|
print(response)
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
**对于更多关于状态图编排的相关介绍,请参考**: [
|
|
378
|
+
**对于更多关于状态图编排的相关介绍,请参考**: [状态图编排](https://tbice123123.github.io/langchain-dev-utils-docs/zh/graph-orchestration/pipeline.html)
|
|
379
379
|
|
|
380
380
|
## 💬 加入社区
|
|
381
381
|
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "langchain-dev-utils"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.3"
|
|
4
4
|
description = "A practical utility library for LangChain and LangGraph development"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "tiebingice", email = "tiebingice123@outlook.com" }]
|
|
7
7
|
requires-python = ">=3.11"
|
|
8
|
-
dependencies = [
|
|
9
|
-
"langchain>=1.1.0",
|
|
10
|
-
"langchain-deepseek>=1.0.1",
|
|
11
|
-
"langgraph>=1.0.0",
|
|
12
|
-
]
|
|
8
|
+
dependencies = ["langchain>=1.1.0", "langgraph>=1.0.0"]
|
|
13
9
|
|
|
14
10
|
[project.urls]
|
|
15
11
|
"Source Code" = "https://github.com/TBice123123/langchain-dev-utils"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.3"
|
|
@@ -17,7 +17,7 @@ class ModelFallbackMiddleware(_ModelFallbackMiddleware):
|
|
|
17
17
|
|
|
18
18
|
Example:
|
|
19
19
|
```python
|
|
20
|
-
from langchain_dev_utils.agents.middleware
|
|
20
|
+
from langchain_dev_utils.agents.middleware import ModelFallbackMiddleware
|
|
21
21
|
from langchain_dev_utils.agents import create_agent
|
|
22
22
|
|
|
23
23
|
fallback = ModelFallbackMiddleware(
|
|
@@ -250,6 +250,8 @@ _PLAN_SYSTEM_PROMPT_NOT_READ_PLAN = """You can manage task plans using two simpl
|
|
|
250
250
|
## finish_sub_plan
|
|
251
251
|
- Call it **only when the current task is 100% done**. It automatically marks it `"done"` and promotes the next `"pending"` task to `"in_progress"`. No parameters needed. Never use it mid-task or if anything’s incomplete.
|
|
252
252
|
Keep plans lean, update immediately, and never batch completions.
|
|
253
|
+
|
|
254
|
+
**Note**: Make sure that all tasks end up with the status `"done"`.
|
|
253
255
|
"""
|
|
254
256
|
|
|
255
257
|
_PLAN_SYSTEM_PROMPT = """You can manage task plans using three simple tools:
|
|
@@ -263,6 +265,8 @@ _PLAN_SYSTEM_PROMPT = """You can manage task plans using three simple tools:
|
|
|
263
265
|
## read_plan
|
|
264
266
|
- Retrieve the full current plan list with statuses, especially when you forget which sub-plan you're supposed to execute next.
|
|
265
267
|
- No parameters required—returns a current plan list with statuses.
|
|
268
|
+
|
|
269
|
+
**Note**: Make sure that all tasks end up with the status `"done"`.
|
|
266
270
|
"""
|
|
267
271
|
|
|
268
272
|
|
|
@@ -290,7 +294,7 @@ class PlanMiddleware(AgentMiddleware):
|
|
|
290
294
|
message_key: The key of the message to be updated. Defaults to "messages".
|
|
291
295
|
Example:
|
|
292
296
|
```python
|
|
293
|
-
from langchain_dev_utils.agents.middleware
|
|
297
|
+
from langchain_dev_utils.agents.middleware import PlanMiddleware
|
|
294
298
|
from langchain_dev_utils.agents import create_agent
|
|
295
299
|
|
|
296
300
|
agent = create_agent("vllm:qwen3-4b", middleware=[PlanMiddleware()])
|
|
@@ -182,6 +182,13 @@ class _BaseChatOpenAICompatible(BaseChatOpenAI):
|
|
|
182
182
|
self.async_client = self.root_async_client.chat.completions
|
|
183
183
|
return self
|
|
184
184
|
|
|
185
|
+
@model_validator(mode="after")
|
|
186
|
+
def _set_model_profile(self) -> Self:
|
|
187
|
+
"""Set model profile if not overridden."""
|
|
188
|
+
if self.profile is None:
|
|
189
|
+
self.profile = {}
|
|
190
|
+
return self
|
|
191
|
+
|
|
185
192
|
def _create_chat_result(
|
|
186
193
|
self,
|
|
187
194
|
response: Union[dict, openai.BaseModel],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/__init__.py
RENAMED
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/plan.py
RENAMED
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/agents/wrap.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/base.py
RENAMED
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/chat_models/types.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/embeddings/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/__init__.py
RENAMED
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/parallel.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_dev_utils-1.2.1 → langchain_dev_utils-1.2.3}/src/langchain_dev_utils/pipeline/types.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
|