aixtools 0.1.9__tar.gz → 0.1.11__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 aixtools might be problematic. Click here for more details.
- {aixtools-0.1.9 → aixtools-0.1.11}/PKG-INFO +2 -1
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/_version.py +3 -3
- aixtools-0.1.11/aixtools/compliance/__init__.py +9 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/compliance/private_data.py +5 -3
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/client.py +102 -1
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/testing/aix_test_model.py +2 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools.egg-info/SOURCES.txt +2 -54
- {aixtools-0.1.9 → aixtools-0.1.11}/pyproject.toml +1 -0
- aixtools-0.1.9/.env_template +0 -49
- aixtools-0.1.9/.github/workflows/lint-and-test.yml +0 -41
- aixtools-0.1.9/.github/workflows/release.yml +0 -58
- aixtools-0.1.9/.gitignore +0 -188
- aixtools-0.1.9/.python-version +0 -1
- aixtools-0.1.9/.roo/rules/rules-mcp.md +0 -170
- aixtools-0.1.9/.roo/rules/rules.md +0 -76
- aixtools-0.1.9/.vscode/settings.json +0 -8
- aixtools-0.1.9/README.ori.md +0 -350
- aixtools-0.1.9/aixtools.egg-info/PKG-INFO +0 -668
- aixtools-0.1.9/aixtools.egg-info/dependency_links.txt +0 -1
- aixtools-0.1.9/aixtools.egg-info/entry_points.txt +0 -2
- aixtools-0.1.9/aixtools.egg-info/requires.txt +0 -25
- aixtools-0.1.9/aixtools.egg-info/top_level.txt +0 -6
- aixtools-0.1.9/docker/mcp-base/Dockerfile +0 -33
- aixtools-0.1.9/docker/mcp-base/zscaler.crt +0 -28
- aixtools-0.1.9/notebooks/example_faulty_mcp_server.ipynb +0 -74
- aixtools-0.1.9/notebooks/example_mcp_server_stdio.ipynb +0 -76
- aixtools-0.1.9/notebooks/example_raw_mcp_client.ipynb +0 -84
- aixtools-0.1.9/notebooks/example_tool_doctor.ipynb +0 -65
- aixtools-0.1.9/scripts/config.sh +0 -28
- aixtools-0.1.9/scripts/lint.sh +0 -32
- aixtools-0.1.9/scripts/log_view.sh +0 -18
- aixtools-0.1.9/scripts/run_example_mcp_server.sh +0 -14
- aixtools-0.1.9/scripts/run_faulty_mcp_server.sh +0 -13
- aixtools-0.1.9/scripts/run_server.sh +0 -29
- aixtools-0.1.9/scripts/test.sh +0 -30
- aixtools-0.1.9/tests/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/a2a/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/a2a/google_sdk/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/a2a/google_sdk/pydantic_ai_adapter/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/a2a/google_sdk/pydantic_ai_adapter/test_agent_executor.py +0 -188
- aixtools-0.1.9/tests/unit/a2a/google_sdk/pydantic_ai_adapter/test_storage.py +0 -156
- aixtools-0.1.9/tests/unit/a2a/google_sdk/test_card.py +0 -114
- aixtools-0.1.9/tests/unit/a2a/google_sdk/test_remote_agent_connection.py +0 -413
- aixtools-0.1.9/tests/unit/a2a/google_sdk/test_utils.py +0 -208
- aixtools-0.1.9/tests/unit/agents/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/agents/test_prompt.py +0 -363
- aixtools-0.1.9/tests/unit/compliance/test_private_data.py +0 -329
- aixtools-0.1.9/tests/unit/google/__init__.py +0 -1
- aixtools-0.1.9/tests/unit/google/test_client.py +0 -233
- aixtools-0.1.9/tests/unit/mcp/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/mcp/test_client.py +0 -242
- aixtools-0.1.9/tests/unit/server/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/server/test_path.py +0 -225
- aixtools-0.1.9/tests/unit/server/test_utils.py +0 -362
- aixtools-0.1.9/tests/unit/utils/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/utils/test_files.py +0 -146
- aixtools-0.1.9/tests/unit/vault/__init__.py +0 -0
- aixtools-0.1.9/tests/unit/vault/test_vault.py +0 -246
- aixtools-0.1.9/uv.lock +0 -5308
- {aixtools-0.1.9 → aixtools-0.1.11}/README.md +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/config.toml +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/bn.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/en-US.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/gu.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/he-IL.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/hi.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/ja.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/kn.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/ml.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/mr.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/nl.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/ta.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/te.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/.chainlit/translations/zh-CN.json +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/app.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/card.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/remote_agent_connection.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/google_sdk/utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/a2a/utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/agents/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/agents/agent.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/agents/agent_batch.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/agents/prompt.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/app.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/chainlit.md +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/context.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/db/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/db/database.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/db/vector_db.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/google/client.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/app.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/display.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/export.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/filters.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/log_utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/log_view/node_summary.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logfilters/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logfilters/context_filter.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/log_objects.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/logging_config.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/mcp_log_models.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/mcp_logger.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/model_patch_logging.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/logging/open_telemetry.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/example_client.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/example_server.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/fast_mcp_log.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/mcp/faulty_mcp.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/model_patch/model_patch.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/server/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/server/app_mounter.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/server/path.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/server/utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/server/workspace_privacy.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/testing/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/testing/mock_tool.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/testing/model_patch_cache.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/tools/doctor/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/tools/doctor/tool_doctor.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/tools/doctor/tool_recommendation.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/chainlit/cl_agent_show.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/chainlit/cl_utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/config.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/config_util.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/enum_with_description.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/files.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/persisted_dict.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/utils/utils.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/vault/__init__.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/aixtools/vault/vault.py +0 -0
- {aixtools-0.1.9 → aixtools-0.1.11}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aixtools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Tools for AI exploration and debugging
|
|
5
5
|
Requires-Python: >=3.11.2
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -16,6 +16,7 @@ Requires-Dist: langchain-chroma>=0.2.3
|
|
|
16
16
|
Requires-Dist: langchain-ollama>=0.3.2
|
|
17
17
|
Requires-Dist: langchain-openai>=0.3.14
|
|
18
18
|
Requires-Dist: mcp>=1.11.0
|
|
19
|
+
Requires-Dist: mypy>=1.18.2
|
|
19
20
|
Requires-Dist: pandas>=2.2.3
|
|
20
21
|
Requires-Dist: pydantic-ai>=0.4.10
|
|
21
22
|
Requires-Dist: pylint>=3.3.7
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.11'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 11)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g32157e2f8'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Private data management module for aixtools compliance."""
|
|
2
|
+
|
|
1
3
|
import json
|
|
2
4
|
from pathlib import Path
|
|
3
5
|
|
|
@@ -90,7 +92,7 @@ class PrivateData:
|
|
|
90
92
|
|
|
91
93
|
def _has_private_data_file(self) -> bool:
|
|
92
94
|
"""Check if the private data file exists in the workspace."""
|
|
93
|
-
private_data_path = self.
|
|
95
|
+
private_data_path = self._get_private_data_path()
|
|
94
96
|
return private_data_path.exists()
|
|
95
97
|
|
|
96
98
|
def save(self) -> None:
|
|
@@ -102,7 +104,7 @@ class PrivateData:
|
|
|
102
104
|
return
|
|
103
105
|
# If there is private data, serialize this object as JSON
|
|
104
106
|
private_data_path.parent.mkdir(parents=True, exist_ok=True)
|
|
105
|
-
with open(private_data_path, "w") as f:
|
|
107
|
+
with open(private_data_path, "w", encoding="utf-8") as f:
|
|
106
108
|
# Dump class as JSON, excluding the context
|
|
107
109
|
data_dict = self.__dict__.copy()
|
|
108
110
|
data_dict["ctx"] = None
|
|
@@ -118,7 +120,7 @@ class PrivateData:
|
|
|
118
120
|
self._private_datasets = []
|
|
119
121
|
self._idap_datasets = []
|
|
120
122
|
return
|
|
121
|
-
with open(private_data_path, "r") as f:
|
|
123
|
+
with open(private_data_path, "r", encoding="utf-8") as f:
|
|
122
124
|
data = json.load(f)
|
|
123
125
|
self.has_private_data = data.get("_has_private_data", False)
|
|
124
126
|
self._private_datasets = data.get("_private_datasets", [])
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"""MCP server utilities with caching and robust error handling."""
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
|
-
from
|
|
4
|
+
from contextlib import asynccontextmanager
|
|
5
|
+
from datetime import timedelta
|
|
6
|
+
from typing import Any, AsyncGenerator
|
|
5
7
|
|
|
6
8
|
import anyio
|
|
9
|
+
import httpx
|
|
10
|
+
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
|
|
7
11
|
from cachebox import TTLCache
|
|
8
12
|
from mcp import types as mcp_types
|
|
13
|
+
from mcp.client import streamable_http
|
|
9
14
|
from mcp.shared.exceptions import McpError
|
|
15
|
+
from mcp.shared.message import SessionMessage
|
|
10
16
|
from pydantic_ai import RunContext, exceptions
|
|
11
17
|
from pydantic_ai.mcp import MCPServerStreamableHTTP, ToolResult
|
|
12
18
|
from pydantic_ai.toolsets.abstract import ToolsetTool
|
|
@@ -16,6 +22,7 @@ from aixtools.logging.logging_config import get_logger
|
|
|
16
22
|
|
|
17
23
|
MCP_TOOL_CACHE_TTL = 300 # 5 minutes
|
|
18
24
|
DEFAULT_MCP_CONNECTION_TIMEOUT = 30
|
|
25
|
+
DEFAULT_MCP_READ_TIMEOUT = float(60 * 5) # 5 minutes
|
|
19
26
|
CACHE_KEY = "TOOL_LIST"
|
|
20
27
|
|
|
21
28
|
logger = get_logger(__name__)
|
|
@@ -145,6 +152,23 @@ class CachedMCPServerStreamableHTTP(MCPServerStreamableHTTP):
|
|
|
145
152
|
logger.warning("MCP %s: %s exception %s: %s", self.url, func.__name__, type(exc), exc)
|
|
146
153
|
return fallback(exc)
|
|
147
154
|
|
|
155
|
+
@property
|
|
156
|
+
def _transport_client(self):
|
|
157
|
+
"""Override base transport client with wrapper logging and suppressing exceptions"""
|
|
158
|
+
return patched_streamablehttp_client
|
|
159
|
+
|
|
160
|
+
@asynccontextmanager
|
|
161
|
+
async def client_streams(self):
|
|
162
|
+
"""Override base client_streams with wrapper logging and suppressing exceptions"""
|
|
163
|
+
try:
|
|
164
|
+
async with super().client_streams() as streams: # pylint: disable=contextmanager-generator-missing-cleanup
|
|
165
|
+
try:
|
|
166
|
+
yield streams
|
|
167
|
+
except Exception as exc: # pylint: disable=broad-except
|
|
168
|
+
logger.error("MCP %s: client_streams; %s: %s", self.url, type(exc).__name__, exc)
|
|
169
|
+
except Exception as exc: # pylint: disable=broad-except
|
|
170
|
+
logger.error("MCP %s: client_streams: %s: %s", self.url, type(exc).__name__, exc)
|
|
171
|
+
|
|
148
172
|
async def __aenter__(self):
|
|
149
173
|
"""Enter the context of the cached MCP server with complete cancellation isolation."""
|
|
150
174
|
async with self._isolation_lock:
|
|
@@ -272,3 +296,80 @@ class CachedMCPServerStreamableHTTP(MCPServerStreamableHTTP):
|
|
|
272
296
|
raise exceptions.ModelRetry(text)
|
|
273
297
|
|
|
274
298
|
return content[0] if len(content) == 1 else content
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class PatchedStreamableHTTPTransport(streamable_http.StreamableHTTPTransport):
|
|
302
|
+
"""Patched StreamableHTTPTransport with exception suppression for _handle_post_request."""
|
|
303
|
+
|
|
304
|
+
async def _handle_post_request(self, ctx: streamable_http.RequestContext) -> None:
|
|
305
|
+
"""Patched _handle_post_request with proper error handling."""
|
|
306
|
+
try:
|
|
307
|
+
await super()._handle_post_request(ctx)
|
|
308
|
+
except Exception as exc: # pylint: disable=broad-except
|
|
309
|
+
logger.error("MCP %s: _handle_post_request %s: %s", self.url, type(exc).__name__, exc)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
@asynccontextmanager
|
|
313
|
+
async def patched_streamablehttp_client( # noqa: PLR0913, pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals
|
|
314
|
+
url: str,
|
|
315
|
+
headers: dict[str, str] | None = None,
|
|
316
|
+
timeout: float | timedelta = 30,
|
|
317
|
+
sse_read_timeout: float | timedelta = DEFAULT_MCP_READ_TIMEOUT,
|
|
318
|
+
terminate_on_close: bool = True,
|
|
319
|
+
httpx_client_factory: streamable_http.McpHttpClientFactory = streamable_http.create_mcp_http_client,
|
|
320
|
+
auth: httpx.Auth | None = None,
|
|
321
|
+
) -> AsyncGenerator[
|
|
322
|
+
tuple[
|
|
323
|
+
MemoryObjectReceiveStream[SessionMessage | Exception],
|
|
324
|
+
MemoryObjectSendStream[SessionMessage],
|
|
325
|
+
streamable_http.GetSessionIdCallback,
|
|
326
|
+
],
|
|
327
|
+
None,
|
|
328
|
+
]:
|
|
329
|
+
"""Patched version of `streamablehttp_client` with exception suppression."""
|
|
330
|
+
try:
|
|
331
|
+
transport = PatchedStreamableHTTPTransport(url, headers, timeout, sse_read_timeout, auth)
|
|
332
|
+
|
|
333
|
+
read_stream_writer, read_stream = anyio.create_memory_object_stream[SessionMessage | Exception](0)
|
|
334
|
+
write_stream, write_stream_reader = anyio.create_memory_object_stream[SessionMessage](0)
|
|
335
|
+
async with anyio.create_task_group() as tg:
|
|
336
|
+
try:
|
|
337
|
+
async with httpx_client_factory(
|
|
338
|
+
headers=transport.request_headers,
|
|
339
|
+
timeout=httpx.Timeout(transport.timeout, read=transport.sse_read_timeout),
|
|
340
|
+
auth=transport.auth,
|
|
341
|
+
) as client:
|
|
342
|
+
# Define callbacks that need access to tg
|
|
343
|
+
def start_get_stream() -> None:
|
|
344
|
+
tg.start_soon(transport.handle_get_stream, client, read_stream_writer)
|
|
345
|
+
|
|
346
|
+
tg.start_soon(
|
|
347
|
+
transport.post_writer,
|
|
348
|
+
client,
|
|
349
|
+
write_stream_reader,
|
|
350
|
+
read_stream_writer,
|
|
351
|
+
write_stream,
|
|
352
|
+
start_get_stream,
|
|
353
|
+
tg,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
try:
|
|
357
|
+
yield (
|
|
358
|
+
read_stream,
|
|
359
|
+
write_stream,
|
|
360
|
+
transport.get_session_id,
|
|
361
|
+
)
|
|
362
|
+
except GeneratorExit:
|
|
363
|
+
logger.warning("patched_streamablehttp_client: GeneratorExit caught, closing streams.")
|
|
364
|
+
finally:
|
|
365
|
+
if transport.session_id and terminate_on_close:
|
|
366
|
+
await transport.terminate_session(client)
|
|
367
|
+
tg.cancel_scope.cancel()
|
|
368
|
+
finally:
|
|
369
|
+
await read_stream_writer.aclose()
|
|
370
|
+
await write_stream.aclose()
|
|
371
|
+
except Exception as exc: # pylint: disable=broad-except
|
|
372
|
+
if str(exc) == "Attempted to exit cancel scope in a different task than it was entered in":
|
|
373
|
+
logger.warning("MCP %s: patched_streamablehttp_client: enter/exit cancel scope task mismatch.", url)
|
|
374
|
+
else:
|
|
375
|
+
logger.error("MCP %s: patched_streamablehttp_client: %s: %s", url, type(exc).__name__, exc)
|
|
@@ -108,6 +108,8 @@ class AixTestModel(Model):
|
|
|
108
108
|
messages: list[ModelMessage],
|
|
109
109
|
model_settings: ModelSettings | None,
|
|
110
110
|
model_request_parameters: ModelRequestParameters,
|
|
111
|
+
*args, # pylint: disable=unused-argument # Accept additional arguments for compatibility with pydantic-ai 1.0.9
|
|
112
|
+
**kwargs, # pylint: disable=unused-argument
|
|
111
113
|
) -> AsyncIterator[StreamedResponse]:
|
|
112
114
|
model_response = await self._request(messages, model_settings, model_request_parameters)
|
|
113
115
|
yield TestStreamedResponse(_model_name=self.model_name, _structured_response=model_response, _messages=messages)
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
.env_template
|
|
2
|
-
.gitignore
|
|
3
|
-
.python-version
|
|
4
1
|
README.md
|
|
5
|
-
README.ori.md
|
|
6
2
|
pyproject.toml
|
|
7
|
-
uv.lock
|
|
8
|
-
.github/workflows/lint-and-test.yml
|
|
9
|
-
.github/workflows/release.yml
|
|
10
|
-
.roo/rules/rules-mcp.md
|
|
11
|
-
.roo/rules/rules.md
|
|
12
|
-
.vscode/settings.json
|
|
13
3
|
aixtools/__init__.py
|
|
14
4
|
aixtools/_version.py
|
|
15
5
|
aixtools/app.py
|
|
16
6
|
aixtools/chainlit.md
|
|
17
7
|
aixtools/context.py
|
|
18
|
-
aixtools.egg-info/PKG-INFO
|
|
19
|
-
aixtools.egg-info/SOURCES.txt
|
|
20
|
-
aixtools.egg-info/dependency_links.txt
|
|
21
|
-
aixtools.egg-info/entry_points.txt
|
|
22
|
-
aixtools.egg-info/requires.txt
|
|
23
|
-
aixtools.egg-info/top_level.txt
|
|
24
8
|
aixtools/.chainlit/config.toml
|
|
25
9
|
aixtools/.chainlit/translations/bn.json
|
|
26
10
|
aixtools/.chainlit/translations/en-US.json
|
|
@@ -47,6 +31,7 @@ aixtools/agents/__init__.py
|
|
|
47
31
|
aixtools/agents/agent.py
|
|
48
32
|
aixtools/agents/agent_batch.py
|
|
49
33
|
aixtools/agents/prompt.py
|
|
34
|
+
aixtools/compliance/__init__.py
|
|
50
35
|
aixtools/compliance/private_data.py
|
|
51
36
|
aixtools/db/__init__.py
|
|
52
37
|
aixtools/db/database.py
|
|
@@ -97,41 +82,4 @@ aixtools/utils/utils.py
|
|
|
97
82
|
aixtools/utils/chainlit/cl_agent_show.py
|
|
98
83
|
aixtools/utils/chainlit/cl_utils.py
|
|
99
84
|
aixtools/vault/__init__.py
|
|
100
|
-
aixtools/vault/vault.py
|
|
101
|
-
docker/mcp-base/Dockerfile
|
|
102
|
-
docker/mcp-base/zscaler.crt
|
|
103
|
-
notebooks/example_faulty_mcp_server.ipynb
|
|
104
|
-
notebooks/example_mcp_server_stdio.ipynb
|
|
105
|
-
notebooks/example_raw_mcp_client.ipynb
|
|
106
|
-
notebooks/example_tool_doctor.ipynb
|
|
107
|
-
scripts/config.sh
|
|
108
|
-
scripts/lint.sh
|
|
109
|
-
scripts/log_view.sh
|
|
110
|
-
scripts/run_example_mcp_server.sh
|
|
111
|
-
scripts/run_faulty_mcp_server.sh
|
|
112
|
-
scripts/run_server.sh
|
|
113
|
-
scripts/test.sh
|
|
114
|
-
tests/__init__.py
|
|
115
|
-
tests/unit/__init__.py
|
|
116
|
-
tests/unit/a2a/__init__.py
|
|
117
|
-
tests/unit/a2a/google_sdk/__init__.py
|
|
118
|
-
tests/unit/a2a/google_sdk/test_card.py
|
|
119
|
-
tests/unit/a2a/google_sdk/test_remote_agent_connection.py
|
|
120
|
-
tests/unit/a2a/google_sdk/test_utils.py
|
|
121
|
-
tests/unit/a2a/google_sdk/pydantic_ai_adapter/__init__.py
|
|
122
|
-
tests/unit/a2a/google_sdk/pydantic_ai_adapter/test_agent_executor.py
|
|
123
|
-
tests/unit/a2a/google_sdk/pydantic_ai_adapter/test_storage.py
|
|
124
|
-
tests/unit/agents/__init__.py
|
|
125
|
-
tests/unit/agents/test_prompt.py
|
|
126
|
-
tests/unit/compliance/test_private_data.py
|
|
127
|
-
tests/unit/google/__init__.py
|
|
128
|
-
tests/unit/google/test_client.py
|
|
129
|
-
tests/unit/mcp/__init__.py
|
|
130
|
-
tests/unit/mcp/test_client.py
|
|
131
|
-
tests/unit/server/__init__.py
|
|
132
|
-
tests/unit/server/test_path.py
|
|
133
|
-
tests/unit/server/test_utils.py
|
|
134
|
-
tests/unit/utils/__init__.py
|
|
135
|
-
tests/unit/utils/test_files.py
|
|
136
|
-
tests/unit/vault/__init__.py
|
|
137
|
-
tests/unit/vault/test_vault.py
|
|
85
|
+
aixtools/vault/vault.py
|
aixtools-0.1.9/.env_template
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#-----------------------------------------------------------------------------
|
|
2
|
-
#
|
|
3
|
-
# Template for .env file
|
|
4
|
-
#
|
|
5
|
-
#-----------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
# Select which credentials to use
|
|
8
|
-
# Options: azure, openai, bedrock, ollama, openrouter
|
|
9
|
-
MODEL_FAMILY=azure
|
|
10
|
-
VDB_EMBEDDINGS_MODEL_FAMILY=azure
|
|
11
|
-
|
|
12
|
-
MODEL_TIMEOUT=120
|
|
13
|
-
|
|
14
|
-
# Azure OpenAI credentials
|
|
15
|
-
# If 'MODEL_FAMILY=azure'
|
|
16
|
-
AZURE_OPENAI_ENDPOINT=https://your_endpoint.openai.azure.com
|
|
17
|
-
AZURE_OPENAI_API_VERSION=2024-06-01
|
|
18
|
-
AZURE_OPENAI_API_KEY=your_secret_key
|
|
19
|
-
AZURE_MODEL_NAME=gpt-4o
|
|
20
|
-
AZURE_OPENAI_PROVIDER_ID=azure
|
|
21
|
-
AZURE_VDB_EMBEDDINGS_MODEL_NAME=text-embedding-3-small
|
|
22
|
-
|
|
23
|
-
# OpenAI credentials
|
|
24
|
-
# If 'MODEL_FAMILY=openai'
|
|
25
|
-
OPENAI_MODEL_NAME=gpt-4.5-preview
|
|
26
|
-
OPENAI_API_KEY=openai_api_key
|
|
27
|
-
|
|
28
|
-
# Bedrock credentials
|
|
29
|
-
# If 'MODEL_FAMILY=bedrock'
|
|
30
|
-
BEDROCK_MODEL_NAME=us.anthropic.claude-sonnet-4-20250514-v1:0 # or any other enabled model
|
|
31
|
-
AWS_REGION=us-east-1
|
|
32
|
-
|
|
33
|
-
# OpenRouter credentials
|
|
34
|
-
# If 'MODEL_FAMILY=openrouter'
|
|
35
|
-
OPENROUTER_API_URL=https://openrouter.ai/api/v1
|
|
36
|
-
OPENROUTER_MODEL_NAME=anthropic/claude-3.7-sonnet
|
|
37
|
-
OPENROUTER_API_KEY=your_openrouter_api_key
|
|
38
|
-
|
|
39
|
-
# Ollama models
|
|
40
|
-
# If 'MODEL_FAMILY=ollama'
|
|
41
|
-
OLLAMA_MODEL_NAME=llama3.2:3b-instruct-fp16
|
|
42
|
-
OLLAMA_URL=http://localhost:11434/v1
|
|
43
|
-
|
|
44
|
-
# Vector DB embeddings
|
|
45
|
-
OPENAI_VDB_EMBEDDINGS_MODEL_NAME=text-embedding-3-small
|
|
46
|
-
OLLAMA_VDB_EMBEDDINGS_MODEL_NAME=snowflake-arctic-embed2:latest
|
|
47
|
-
|
|
48
|
-
# Custom certificate for Docker builds (optional)
|
|
49
|
-
# CUSTOM_CERT_FILE=/path/to/your/certificate.crt
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
name: Lint and Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
lint-and-test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout code
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Set up Python 3.12
|
|
18
|
-
uses: actions/setup-python@v4
|
|
19
|
-
with:
|
|
20
|
-
python-version: "3.12"
|
|
21
|
-
|
|
22
|
-
- name: Install uv
|
|
23
|
-
run: |
|
|
24
|
-
pip install uv
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: |
|
|
28
|
-
uv sync
|
|
29
|
-
uv pip install -e ".[feature]"
|
|
30
|
-
|
|
31
|
-
- name: Set up environment
|
|
32
|
-
run: |
|
|
33
|
-
touch .env
|
|
34
|
-
|
|
35
|
-
- name: Run linting
|
|
36
|
-
run: |
|
|
37
|
-
./scripts/lint.sh
|
|
38
|
-
|
|
39
|
-
- name: Test
|
|
40
|
-
run: |
|
|
41
|
-
./scripts/test.sh
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build-and-publish:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
environment: release
|
|
11
|
-
env:
|
|
12
|
-
DOCKER_IMAGE_NAME: mcp-base
|
|
13
|
-
AZ_ARTIFACTORY_ODSP_DOCKER_REGISTRY: docker-l-odsp.artifactory.astrazeneca.com
|
|
14
|
-
AZ_ARTIFACTORY_ODSP_DOCKER_NAMESPACE: navari
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout code
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0 # Fetch full history for setuptools_scm
|
|
21
|
-
|
|
22
|
-
- name: Install uv
|
|
23
|
-
uses: astral-sh/setup-uv@v4
|
|
24
|
-
|
|
25
|
-
- name: Install build dependencies
|
|
26
|
-
run: uv sync --group dev
|
|
27
|
-
|
|
28
|
-
- name: Build Python package
|
|
29
|
-
run: uv run python -m build
|
|
30
|
-
|
|
31
|
-
- name: Check Python package contents
|
|
32
|
-
run: |
|
|
33
|
-
ls -la dist/
|
|
34
|
-
uv run python -m twine check dist/*
|
|
35
|
-
|
|
36
|
-
- name: Publish Python package to PyPI
|
|
37
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
-
with:
|
|
39
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
40
|
-
skip-existing: true
|
|
41
|
-
|
|
42
|
-
- name: Login to Docker Registry (JFrog Artifactory 🐸)
|
|
43
|
-
uses: docker/login-action@v3
|
|
44
|
-
with:
|
|
45
|
-
registry: ${{ env.AZ_ARTIFACTORY_ODSP_DOCKER_REGISTRY }}
|
|
46
|
-
username: ${{ vars.AZ_ARTIFACTORY_ODSP_DOCKER_USER }}
|
|
47
|
-
password: ${{ secrets.AZ_ARTIFACTORY_ODSP_DOCKER_PASSWORD }}
|
|
48
|
-
|
|
49
|
-
- name: Build and push Docker image 🐳
|
|
50
|
-
id: docker_build
|
|
51
|
-
uses: docker/build-push-action@v6
|
|
52
|
-
env:
|
|
53
|
-
AZ_ARTIFACTORY_ODSP_DOCKER_IMAGE_REF: ${{ env.AZ_ARTIFACTORY_ODSP_DOCKER_REGISTRY }}/${{ env.AZ_ARTIFACTORY_ODSP_DOCKER_NAMESPACE }}/${{ env.DOCKER_IMAGE_NAME }}
|
|
54
|
-
with:
|
|
55
|
-
push: true
|
|
56
|
-
context: docker/${{ env.DOCKER_IMAGE_NAME }}
|
|
57
|
-
tags: |
|
|
58
|
-
${{ env.AZ_ARTIFACTORY_ODSP_DOCKER_IMAGE_REF }}:${{ github.ref_name }}
|
aixtools-0.1.9/.gitignore
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# Byte-compiled / optimized / DLL files
|
|
2
|
-
__pycache__/
|
|
3
|
-
*.py[cod]
|
|
4
|
-
*$py.class
|
|
5
|
-
.DS_Store
|
|
6
|
-
agents/.DS_Store
|
|
7
|
-
|
|
8
|
-
# C extensions
|
|
9
|
-
*.so
|
|
10
|
-
|
|
11
|
-
# Distribution / packaging
|
|
12
|
-
.Python
|
|
13
|
-
build/
|
|
14
|
-
develop-eggs/
|
|
15
|
-
dist/
|
|
16
|
-
downloads/
|
|
17
|
-
eggs/
|
|
18
|
-
.eggs/
|
|
19
|
-
lib/
|
|
20
|
-
lib64/
|
|
21
|
-
parts/
|
|
22
|
-
sdist/
|
|
23
|
-
var/
|
|
24
|
-
wheels/
|
|
25
|
-
share/python-wheels/
|
|
26
|
-
*.egg-info/
|
|
27
|
-
.installed.cfg
|
|
28
|
-
*.egg
|
|
29
|
-
MANIFEST
|
|
30
|
-
|
|
31
|
-
# PyInstaller
|
|
32
|
-
# Usually these files are written by a python script from a template
|
|
33
|
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
-
*.manifest
|
|
35
|
-
*.spec
|
|
36
|
-
|
|
37
|
-
# Installer logs
|
|
38
|
-
pip-log.txt
|
|
39
|
-
pip-delete-this-directory.txt
|
|
40
|
-
|
|
41
|
-
# Unit test / coverage reports
|
|
42
|
-
htmlcov/
|
|
43
|
-
.tox/
|
|
44
|
-
.nox/
|
|
45
|
-
.coverage
|
|
46
|
-
.coverage.*
|
|
47
|
-
.cache
|
|
48
|
-
nosetests.xml
|
|
49
|
-
coverage.xml
|
|
50
|
-
*.cover
|
|
51
|
-
*.py,cover
|
|
52
|
-
.hypothesis/
|
|
53
|
-
.pytest_cache/
|
|
54
|
-
cover/
|
|
55
|
-
|
|
56
|
-
# Translations
|
|
57
|
-
*.mo
|
|
58
|
-
*.pot
|
|
59
|
-
|
|
60
|
-
# Django stuff:
|
|
61
|
-
*.log
|
|
62
|
-
local_settings.py
|
|
63
|
-
db.sqlite3
|
|
64
|
-
db.sqlite3-journal
|
|
65
|
-
|
|
66
|
-
# Flask stuff:
|
|
67
|
-
instance/
|
|
68
|
-
.webassets-cache
|
|
69
|
-
|
|
70
|
-
# Scrapy stuff:
|
|
71
|
-
.scrapy
|
|
72
|
-
|
|
73
|
-
# Sphinx documentation
|
|
74
|
-
docs/_build/
|
|
75
|
-
|
|
76
|
-
# PyBuilder
|
|
77
|
-
.pybuilder/
|
|
78
|
-
target/
|
|
79
|
-
|
|
80
|
-
# Jupyter Notebook
|
|
81
|
-
.ipynb_checkpoints
|
|
82
|
-
|
|
83
|
-
# IPython
|
|
84
|
-
profile_default/
|
|
85
|
-
ipython_config.py
|
|
86
|
-
|
|
87
|
-
# pyenv
|
|
88
|
-
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
-
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
-
# .python-version
|
|
91
|
-
|
|
92
|
-
# pipenv
|
|
93
|
-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
-
# install all needed dependencies.
|
|
97
|
-
#Pipfile.lock
|
|
98
|
-
|
|
99
|
-
# UV
|
|
100
|
-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
-
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
-
# commonly ignored for libraries.
|
|
103
|
-
#uv.lock
|
|
104
|
-
|
|
105
|
-
# poetry
|
|
106
|
-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
-
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
-
# commonly ignored for libraries.
|
|
109
|
-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
-
#poetry.lock
|
|
111
|
-
|
|
112
|
-
# pdm
|
|
113
|
-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
-
#pdm.lock
|
|
115
|
-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
116
|
-
# in version control.
|
|
117
|
-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
118
|
-
.pdm.toml
|
|
119
|
-
.pdm-python
|
|
120
|
-
.pdm-build/
|
|
121
|
-
|
|
122
|
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
123
|
-
__pypackages__/
|
|
124
|
-
|
|
125
|
-
# Celery stuff
|
|
126
|
-
celerybeat-schedule
|
|
127
|
-
celerybeat.pid
|
|
128
|
-
|
|
129
|
-
# SageMath parsed files
|
|
130
|
-
*.sage.py
|
|
131
|
-
|
|
132
|
-
# Environments
|
|
133
|
-
.env
|
|
134
|
-
.venv
|
|
135
|
-
env/
|
|
136
|
-
venv/
|
|
137
|
-
ENV/
|
|
138
|
-
env.bak/
|
|
139
|
-
venv.bak/
|
|
140
|
-
|
|
141
|
-
# Spyder project settings
|
|
142
|
-
.spyderproject
|
|
143
|
-
.spyproject
|
|
144
|
-
|
|
145
|
-
# Rope project settings
|
|
146
|
-
.ropeproject
|
|
147
|
-
|
|
148
|
-
# mkdocs documentation
|
|
149
|
-
/site
|
|
150
|
-
|
|
151
|
-
# mypy
|
|
152
|
-
.mypy_cache/
|
|
153
|
-
.dmypy.json
|
|
154
|
-
dmypy.json
|
|
155
|
-
|
|
156
|
-
# Pyre type checker
|
|
157
|
-
.pyre/
|
|
158
|
-
|
|
159
|
-
# pytype static type analyzer
|
|
160
|
-
.pytype/
|
|
161
|
-
|
|
162
|
-
# Cython debug symbols
|
|
163
|
-
cython_debug/
|
|
164
|
-
|
|
165
|
-
# PyCharm
|
|
166
|
-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
167
|
-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
168
|
-
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
169
|
-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
170
|
-
#.idea/
|
|
171
|
-
|
|
172
|
-
#IDEs
|
|
173
|
-
.idea/
|
|
174
|
-
|
|
175
|
-
# Ruff stuff:
|
|
176
|
-
.ruff_cache/
|
|
177
|
-
|
|
178
|
-
# PyPI configuration file
|
|
179
|
-
.pypirc
|
|
180
|
-
|
|
181
|
-
# Chainlit stuff
|
|
182
|
-
.files/
|
|
183
|
-
|
|
184
|
-
# Data directories
|
|
185
|
-
data/
|
|
186
|
-
aixtools/data/
|
|
187
|
-
logs/
|
|
188
|
-
aixtools/_version.py
|
aixtools-0.1.9/.python-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.12.2
|