aixtools 0.2.2__tar.gz → 0.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.

Potentially problematic release.


This version of aixtools might be problematic. Click here for more details.

Files changed (95) hide show
  1. {aixtools-0.2.2 → aixtools-0.2.3}/PKG-INFO +2 -1
  2. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/_version.py +3 -3
  3. aixtools-0.2.3/aixtools/auth/auth.py +70 -0
  4. aixtools-0.2.3/aixtools/evals/__init__.py +0 -0
  5. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/config.py +14 -5
  6. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools.egg-info/SOURCES.txt +2 -0
  7. {aixtools-0.2.2 → aixtools-0.2.3}/pyproject.toml +2 -1
  8. {aixtools-0.2.2 → aixtools-0.2.3}/README.md +0 -0
  9. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/config.toml +0 -0
  10. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/bn.json +0 -0
  11. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/en-US.json +0 -0
  12. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/gu.json +0 -0
  13. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/he-IL.json +0 -0
  14. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/hi.json +0 -0
  15. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/ja.json +0 -0
  16. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/kn.json +0 -0
  17. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/ml.json +0 -0
  18. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/mr.json +0 -0
  19. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/nl.json +0 -0
  20. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/ta.json +0 -0
  21. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/te.json +0 -0
  22. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/.chainlit/translations/zh-CN.json +0 -0
  23. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/__init__.py +0 -0
  24. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/app.py +0 -0
  25. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/__init__.py +0 -0
  26. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/card.py +0 -0
  27. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py +0 -0
  28. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py +0 -0
  29. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/remote_agent_connection.py +0 -0
  30. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/google_sdk/utils.py +0 -0
  31. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/a2a/utils.py +0 -0
  32. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/agents/__init__.py +0 -0
  33. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/agents/agent.py +0 -0
  34. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/agents/agent_batch.py +0 -0
  35. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/agents/print_nodes.py +0 -0
  36. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/agents/prompt.py +0 -0
  37. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/app.py +0 -0
  38. {aixtools-0.2.2/aixtools/evals → aixtools-0.2.3/aixtools/auth}/__init__.py +0 -0
  39. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/chainlit.md +0 -0
  40. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/compliance/__init__.py +0 -0
  41. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/compliance/private_data.py +0 -0
  42. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/context.py +0 -0
  43. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/db/__init__.py +0 -0
  44. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/db/database.py +0 -0
  45. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/db/vector_db.py +0 -0
  46. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/evals/discovery.py +0 -0
  47. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/evals/evals.py +0 -0
  48. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/evals/run_evals.py +0 -0
  49. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/google/client.py +0 -0
  50. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/__init__.py +0 -0
  51. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/app.py +0 -0
  52. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/display.py +0 -0
  53. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/export.py +0 -0
  54. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/filters.py +0 -0
  55. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/log_utils.py +0 -0
  56. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/log_view/node_summary.py +0 -0
  57. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logfilters/__init__.py +0 -0
  58. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logfilters/context_filter.py +0 -0
  59. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/__init__.py +0 -0
  60. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/log_objects.py +0 -0
  61. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/logging_config.py +0 -0
  62. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/mcp_log_models.py +0 -0
  63. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/mcp_logger.py +0 -0
  64. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/model_patch_logging.py +0 -0
  65. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/logging/open_telemetry.py +0 -0
  66. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/__init__.py +0 -0
  67. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/client.py +0 -0
  68. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/example_client.py +0 -0
  69. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/example_server.py +0 -0
  70. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/fast_mcp_log.py +0 -0
  71. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/mcp/faulty_mcp.py +0 -0
  72. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/model_patch/model_patch.py +0 -0
  73. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/server/__init__.py +0 -0
  74. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/server/app_mounter.py +0 -0
  75. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/server/path.py +0 -0
  76. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/server/utils.py +0 -0
  77. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/testing/__init__.py +0 -0
  78. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/testing/aix_test_model.py +0 -0
  79. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/testing/mock_tool.py +0 -0
  80. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/testing/model_patch_cache.py +0 -0
  81. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/tools/doctor/__init__.py +0 -0
  82. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/tools/doctor/mcp_tool_doctor.py +0 -0
  83. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/tools/doctor/tool_doctor.py +0 -0
  84. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/tools/doctor/tool_recommendation.py +0 -0
  85. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/__init__.py +0 -0
  86. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/chainlit/cl_agent_show.py +0 -0
  87. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/chainlit/cl_utils.py +0 -0
  88. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/config_util.py +0 -0
  89. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/enum_with_description.py +0 -0
  90. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/files.py +0 -0
  91. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/persisted_dict.py +0 -0
  92. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/utils/utils.py +0 -0
  93. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/vault/__init__.py +0 -0
  94. {aixtools-0.2.2 → aixtools-0.2.3}/aixtools/vault/vault.py +0 -0
  95. {aixtools-0.2.2 → aixtools-0.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aixtools
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Tools for AI exploration and debugging
5
5
  Requires-Python: >=3.11.2
6
6
  Description-Content-Type: text/markdown
@@ -20,6 +20,7 @@ Requires-Dist: mypy>=1.18.2
20
20
  Requires-Dist: pandas>=2.2.3
21
21
  Requires-Dist: pydantic-evals>=0.4.10
22
22
  Requires-Dist: pydantic-ai>=1.0.9
23
+ Requires-Dist: pyjwt>=2.10.1
23
24
  Requires-Dist: pylint>=3.3.7
24
25
  Requires-Dist: rich>=14.0.0
25
26
  Requires-Dist: ruff>=0.11.6
@@ -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.2.2'
32
- __version_tuple__ = version_tuple = (0, 2, 2)
31
+ __version__ = version = '0.2.3'
32
+ __version_tuple__ = version_tuple = (0, 2, 3)
33
33
 
34
- __commit_id__ = commit_id = 'g407a0cb96'
34
+ __commit_id__ = commit_id = 'g3c3244a8d'
@@ -0,0 +1,70 @@
1
+ """
2
+ Module that manages OAuth2 functions for authentication
3
+ """
4
+
5
+ import logging
6
+
7
+ import jwt
8
+ from jwt import ExpiredSignatureError, InvalidAudienceError, InvalidIssuerError, PyJWKClient
9
+
10
+ from aixtools.utils import config
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ class AuthTokenError(Exception):
16
+ """Exception raised for authentication token errors."""
17
+
18
+
19
+ # pylint: disable=too-few-public-methods
20
+ class AccessTokenVerifier:
21
+ """
22
+ Verifies Microsoft SSO JWT token against the configured Tenant ID, Audience, API ID and Issuer URL.
23
+ """
24
+
25
+ def __init__(self):
26
+ tenant_id = config.APP_TENANT_ID
27
+ self.api_id = config.APP_API_ID
28
+ self.issuer_url = config.APP_ISSUER_URL
29
+ # Azure AD endpoints
30
+ jwks_url = f"https://login.microsoftonline.com/{tenant_id}/discovery/v2.0/keys"
31
+ self.jwks_client = PyJWKClient(
32
+ uri=jwks_url,
33
+ # cache keys url response to reduce SSO server network calls,
34
+ # as public keys are not expected to change frequently
35
+ cache_jwk_set=True,
36
+ # cache resolved public keys
37
+ cache_keys=True,
38
+ # cache url response for 10 hours
39
+ lifespan=36000,
40
+ )
41
+
42
+ logger.info("Using JWKS: %s", jwks_url)
43
+
44
+ def verify(self, token: str) -> dict:
45
+ """
46
+ Verifies The JWT access token and returns decoded claims as a dictionary if the token is
47
+ valid, otherwise raises an AuthTokenError
48
+ """
49
+ try:
50
+ signing_key = self.jwks_client.get_signing_key_from_jwt(token)
51
+
52
+ claims = jwt.decode(
53
+ token,
54
+ signing_key.key,
55
+ algorithms=["RS256"],
56
+ audience=self.api_id,
57
+ issuer=self.issuer_url,
58
+ # ensure audience verification is carried out
59
+ options={"verify_aud": True},
60
+ )
61
+ return claims
62
+
63
+ except ExpiredSignatureError as e:
64
+ raise AuthTokenError("Token expired") from e
65
+ except InvalidAudienceError as e:
66
+ raise AuthTokenError(f"Token not for expected audience: {e}") from e
67
+ except InvalidIssuerError as e:
68
+ raise AuthTokenError(f"Token not for expected issuer: {e}") from e
69
+ except jwt.exceptions.PyJWTError as e:
70
+ raise AuthTokenError(f"Invalid token: {e}") from e
File without changes
@@ -56,7 +56,6 @@ else:
56
56
  logging.error("No '.env' file found in any of the search paths, or their parents: %s", env_dirs)
57
57
  sys.exit(1)
58
58
 
59
-
60
59
  # ---
61
60
  # Directories
62
61
  # ---
@@ -124,7 +123,17 @@ GOOGLE_CLOUD_LOCATION = get_variable_env("GOOGLE_CLOUD_LOCATION", True)
124
123
 
125
124
  # vault parameters.
126
125
  VAULT_ADDRESS = get_variable_env("VAULT_ADDRESS", default="http://localhost:8200")
127
- VAULT_TOKEN = get_variable_env("VAULT_TOKEN", default="vault-token")
128
- VAULT_ENV = get_variable_env("ENV", default="dev")
129
- VAULT_MOUNT_POINT = get_variable_env("VAULT_MOUNT_POINT", default="secret")
130
- VAULT_PATH_PREFIX = get_variable_env("VAULT_PATH_PREFIX", default="path")
126
+ VAULT_TOKEN = get_variable_env("VAULT_TOKEN", allow_empty=True)
127
+ VAULT_ENV = get_variable_env("ENV", allow_empty=True)
128
+ VAULT_MOUNT_POINT = get_variable_env("VAULT_MOUNT_POINT", allow_empty=True)
129
+ VAULT_PATH_PREFIX = get_variable_env("VAULT_PATH_PREFIX", allow_empty=True)
130
+
131
+ # OAuth parameters
132
+ APP_SECRET_ID = get_variable_env("APP_SECRET_ID")
133
+ APP_CLIENT_ID = get_variable_env("APP_CLIENT_ID")
134
+
135
+ # used for token audience check
136
+ APP_API_ID = get_variable_env("APP_API_ID")
137
+ APP_TENANT_ID = get_variable_env("APP_TENANT_ID")
138
+ # used for token issuer check
139
+ APP_ISSUER_URL = get_variable_env("APP_ISSUER_URL")
@@ -32,6 +32,8 @@ aixtools/agents/agent.py
32
32
  aixtools/agents/agent_batch.py
33
33
  aixtools/agents/print_nodes.py
34
34
  aixtools/agents/prompt.py
35
+ aixtools/auth/__init__.py
36
+ aixtools/auth/auth.py
35
37
  aixtools/compliance/__init__.py
36
38
  aixtools/compliance/private_data.py
37
39
  aixtools/db/__init__.py
@@ -28,11 +28,12 @@ dependencies = [
28
28
  "pandas>=2.2.3",
29
29
  "pydantic-evals>=0.4.10",
30
30
  "pydantic-ai>=1.0.9",
31
+ "pyjwt>=2.10.1",
31
32
  "pylint>=3.3.7",
32
33
  "rich>=14.0.0",
33
34
  "ruff>=0.11.6",
34
35
  "streamlit>=1.44.1",
35
- "watchdog>=6.0.0",
36
+ "watchdog>=6.0.0"
36
37
  ]
37
38
 
38
39
  [project.scripts]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes