chuk-tool-processor 0.3__py3-none-any.whl → 0.4.1__py3-none-any.whl
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.
- chuk_tool_processor/core/processor.py +1 -1
- chuk_tool_processor/execution/strategies/inprocess_strategy.py +1 -1
- chuk_tool_processor/execution/tool_executor.py +47 -9
- chuk_tool_processor/execution/wrappers/caching.py +3 -3
- chuk_tool_processor/execution/wrappers/retry.py +163 -174
- chuk_tool_processor/logging/context.py +6 -6
- chuk_tool_processor/mcp/mcp_tool.py +48 -36
- chuk_tool_processor/mcp/register_mcp_tools.py +3 -3
- chuk_tool_processor/mcp/setup_mcp_sse.py +4 -4
- chuk_tool_processor/mcp/setup_mcp_stdio.py +2 -2
- chuk_tool_processor/mcp/stream_manager.py +72 -16
- chuk_tool_processor/mcp/transport/base_transport.py +2 -2
- chuk_tool_processor/mcp/transport/sse_transport.py +68 -13
- chuk_tool_processor/mcp/transport/stdio_transport.py +2 -2
- chuk_tool_processor/models/validated_tool.py +6 -6
- chuk_tool_processor/plugins/discovery.py +3 -3
- chuk_tool_processor/plugins/parsers/base.py +1 -1
- chuk_tool_processor/plugins/parsers/xml_tool.py +2 -2
- chuk_tool_processor/registry/auto_register.py +5 -5
- chuk_tool_processor/registry/interface.py +2 -2
- chuk_tool_processor/registry/providers/memory.py +2 -2
- chuk_tool_processor/utils/validation.py +1 -1
- chuk_tool_processor-0.4.1.dist-info/METADATA +831 -0
- {chuk_tool_processor-0.3.dist-info → chuk_tool_processor-0.4.1.dist-info}/RECORD +26 -26
- chuk_tool_processor-0.3.dist-info/METADATA +0 -401
- {chuk_tool_processor-0.3.dist-info → chuk_tool_processor-0.4.1.dist-info}/WHEEL +0 -0
- {chuk_tool_processor-0.3.dist-info → chuk_tool_processor-0.4.1.dist-info}/top_level.txt +0 -0
|
@@ -68,7 +68,7 @@ class XmlToolPlugin(ParserPlugin):
|
|
|
68
68
|
return calls
|
|
69
69
|
|
|
70
70
|
# ------------------------------------------------------------------ #
|
|
71
|
-
# Helper
|
|
71
|
+
# Helper - robust JSON decode for the args attribute
|
|
72
72
|
# ------------------------------------------------------------------ #
|
|
73
73
|
@staticmethod
|
|
74
74
|
def _decode_args(raw_args: str) -> dict:
|
|
@@ -89,7 +89,7 @@ class XmlToolPlugin(ParserPlugin):
|
|
|
89
89
|
except json.JSONDecodeError:
|
|
90
90
|
parsed = None
|
|
91
91
|
|
|
92
|
-
# 3️⃣ Last resort
|
|
92
|
+
# 3️⃣ Last resort - naive unescaping of \" → "
|
|
93
93
|
if parsed is None:
|
|
94
94
|
try:
|
|
95
95
|
parsed = json.loads(raw_args.replace(r"\"", "\""))
|
|
@@ -22,7 +22,7 @@ from pydantic import BaseModel, create_model
|
|
|
22
22
|
try: # optional dependency
|
|
23
23
|
from langchain.tools.base import BaseTool # type: ignore
|
|
24
24
|
except ModuleNotFoundError: # pragma: no cover
|
|
25
|
-
BaseTool = None # noqa: N816
|
|
25
|
+
BaseTool = None # noqa: N816 - keep the name for isinstance() checks
|
|
26
26
|
|
|
27
27
|
# registry
|
|
28
28
|
from .decorators import register_tool
|
|
@@ -30,7 +30,7 @@ from .provider import ToolRegistryProvider
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
# ────────────────────────────────────────────────────────────────────────────
|
|
33
|
-
# internals
|
|
33
|
+
# internals - build a Pydantic schema from an arbitrary callable
|
|
34
34
|
# ────────────────────────────────────────────────────────────────────────────
|
|
35
35
|
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ def _auto_schema(func: Callable) -> Type[BaseModel]:
|
|
|
39
39
|
Turn a function signature into a `pydantic.BaseModel` subclass.
|
|
40
40
|
|
|
41
41
|
*Unknown* or *un-imported* annotations (common with third-party libs that
|
|
42
|
-
use forward-refs without importing the target
|
|
42
|
+
use forward-refs without importing the target - e.g. ``uuid.UUID`` in
|
|
43
43
|
LangChain's `CallbackManagerForToolRun`) default to ``str`` instead of
|
|
44
44
|
crashing `get_type_hints()`.
|
|
45
45
|
"""
|
|
@@ -90,7 +90,7 @@ async def register_fn_tool(
|
|
|
90
90
|
tool_description = (description or func.__doc__ or "").strip()
|
|
91
91
|
|
|
92
92
|
# Create the tool wrapper class
|
|
93
|
-
class _Tool: # noqa: D401, N801
|
|
93
|
+
class _Tool: # noqa: D401, N801 - internal auto-wrapper
|
|
94
94
|
"""Auto-generated tool wrapper for function."""
|
|
95
95
|
|
|
96
96
|
async def execute(self, **kwargs: Any) -> Any:
|
|
@@ -154,7 +154,7 @@ async def register_langchain_tool(
|
|
|
154
154
|
|
|
155
155
|
if not isinstance(tool, BaseTool): # pragma: no cover
|
|
156
156
|
raise TypeError(
|
|
157
|
-
"Expected a langchain.tools.base.BaseTool instance
|
|
157
|
+
"Expected a langchain.tools.base.BaseTool instance - got "
|
|
158
158
|
f"{type(tool).__name__}"
|
|
159
159
|
)
|
|
160
160
|
|
|
@@ -104,8 +104,8 @@ class ToolRegistryInterface(Protocol):
|
|
|
104
104
|
|
|
105
105
|
Args:
|
|
106
106
|
namespace: Optional filter by namespace.
|
|
107
|
-
• None (default)
|
|
108
|
-
• "some_ns"
|
|
107
|
+
• None (default) - metadata from all namespaces
|
|
108
|
+
• "some_ns" - only that namespace
|
|
109
109
|
|
|
110
110
|
Returns:
|
|
111
111
|
List of ToolMetadata objects.
|
|
@@ -125,8 +125,8 @@ class InMemoryToolRegistry(ToolRegistryInterface):
|
|
|
125
125
|
|
|
126
126
|
Args:
|
|
127
127
|
namespace: Optional filter by namespace.
|
|
128
|
-
• None (default)
|
|
129
|
-
• "some_ns"
|
|
128
|
+
• None (default) - metadata from all namespaces
|
|
129
|
+
• "some_ns" - only that namespace
|
|
130
130
|
|
|
131
131
|
Returns:
|
|
132
132
|
List of ToolMetadata objects.
|
|
@@ -25,7 +25,7 @@ __all__ = [
|
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
# --------------------------------------------------------------------------- #
|
|
28
|
-
# helpers
|
|
28
|
+
# helpers - create & cache ad-hoc pydantic models
|
|
29
29
|
# --------------------------------------------------------------------------- #
|
|
30
30
|
|
|
31
31
|
|