aixtools 0.1.2__py3-none-any.whl → 0.1.3__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.

Potentially problematic release.


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

aixtools/_version.py CHANGED
@@ -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.2'
32
- __version_tuple__ = version_tuple = (0, 1, 2)
31
+ __version__ = version = '0.1.3'
32
+ __version_tuple__ = version_tuple = (0, 1, 3)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -49,7 +49,7 @@ class Config:
49
49
 
50
50
  port: int = 9999
51
51
  prob_on_post_404: float = 0.5 # Probability of injecting a 404 error for POST requests
52
- prob_on_post_empty_crash: float = 0.3 # Probability of terminating the process on empty request
52
+ prob_on_get_crash: float = 0.3 # Probability of terminating the process on GET request
53
53
  prob_on_delete_404: float = 0.5 # Probability of injecting a 404 error for DELETE requests
54
54
  prob_in_list_tools_throw: float = 0.5 # Probability of throwing an exception in list tools handling
55
55
  prob_in_list_tools_crash: float = 0.3 # Probability of terminating the process in list tools handling
@@ -102,9 +102,9 @@ class StarletteErrorMiddleware: # pylint: disable=too-few-public-methods
102
102
  self.app = app
103
103
  logger.info("[StarletteErrorMiddleware] Middleware initialized!")
104
104
  logger.info("Current configuration:")
105
- logger.info("POST 404 probability: %f", config.prob_on_post_404)
106
- logger.info("POST empty crash probability: %f", config.prob_on_post_empty_crash)
107
- logger.info("DELETE 404 probability: %f", config.prob_on_delete_404)
105
+ logger.info("HTTP 404 on POST request probability: %f", config.prob_on_post_404)
106
+ logger.info("Terminate on GET request probability: %f", config.prob_on_get_crash)
107
+ logger.info("HTTP 404 on DELETE request probability: %f", config.prob_on_delete_404)
108
108
  logger.info("Exception in list tools handling probability: %f", config.prob_in_list_tools_throw)
109
109
  logger.info("Terminate in list handle probability: %f", config.prob_in_list_tools_crash)
110
110
 
@@ -125,22 +125,21 @@ class StarletteErrorMiddleware: # pylint: disable=too-few-public-methods
125
125
  random_number = random()
126
126
  logger.info("[StarletteErrorMiddleware] random number: %f", random_number)
127
127
  if random_number < config.prob_on_delete_404:
128
- logger.info("[StarletteErrorMiddleware] Simulating 404 error for DELETE request")
128
+ logger.info("[StarletteErrorMiddleware] Simulating 404 error on DELETE request")
129
129
  should_inject_404 = True
130
130
 
131
+ if http_method == "GET":
132
+ random_number = random()
133
+ logger.info("[StarletteErrorMiddleware] random number: %f", random_number)
134
+ if random_number < config.prob_on_get_crash:
135
+ logger.warning("[StarletteErrorMiddleware] Simulating server crash on GET request!")
136
+ os.kill(os.getpid(), 9)
137
+
131
138
  async def logging_receive():
132
139
  nonlocal should_inject_404
133
140
  message = await receive()
134
141
  logger.info("[StarletteErrorMiddleware] Received message: %s", str(message))
135
142
 
136
- # Check for empty request and possibly terminate the process
137
- if message["type"] == "http.request" and message["body"] == b"" and not message.get("more_body", False):
138
- random_number = random()
139
- logger.info("[StarletteErrorMiddleware] Empty request received, random number: %f", random_number)
140
- if random_number < config.prob_on_post_empty_crash:
141
- logger.warning("[StarletteErrorMiddleware] Simulating server crash on empty request!")
142
- os.kill(os.getpid(), 9)
143
-
144
143
  if message["type"] == "http.request": # pylint: disable=too-many-nested-blocks
145
144
  body = message.get("body", b"")
146
145
  if body:
@@ -280,9 +279,9 @@ if __name__ == "__main__":
280
279
  help=f"Probability of injecting a 404 error for POST requests (default: {config.prob_on_post_404})",
281
280
  )
282
281
  parser.add_argument(
283
- "--prob-on-post-empty-crash",
282
+ "--prob-on-get-crash",
284
283
  type=float,
285
- help=f"Probability of terminating on empty request (default: {config.prob_on_post_empty_crash})",
284
+ help=f"Probability of terminating on GET request (default: {config.prob_on_get_crash})",
286
285
  )
287
286
  parser.add_argument(
288
287
  "--prob-on-delete-404",
@@ -311,7 +310,7 @@ if __name__ == "__main__":
311
310
  # Update the global configuration with command line arguments
312
311
  config.port = args.port or config.port
313
312
  _update_config_value("prob_on_post_404")
314
- _update_config_value("prob_on_post_empty_crash")
313
+ _update_config_value("prob_on_get_crash")
315
314
  _update_config_value("prob_on_delete_404")
316
315
  _update_config_value("prob_in_list_tools_throw")
317
316
  _update_config_value("prob_in_list_tools_crash")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aixtools
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Tools for AI exploration and debugging
5
5
  Requires-Python: >=3.11.2
6
6
  Description-Content-Type: text/markdown
@@ -1,5 +1,5 @@
1
1
  aixtools/__init__.py,sha256=9NGHm7LjsQmsvjTZvw6QFJexSvAU4bCoN_KBk9SCa00,260
2
- aixtools/_version.py,sha256=Ok5oAXdWgR9aghaFXTafTeDW6sYO3uVe6d2Nket57R4,704
2
+ aixtools/_version.py,sha256=q5nF98G8SoVeJqaknL0xdyxtv0egsqb0fK06_84Izu8,704
3
3
  aixtools/app.py,sha256=JzQ0nrv_bjDQokllIlGHOV0HEb-V8N6k_nGQH-TEsVU,5227
4
4
  aixtools/chainlit.md,sha256=yC37Ly57vjKyiIvK4oUvf4DYxZCwH7iocTlx7bLeGLU,761
5
5
  aixtools/context.py,sha256=XuvSGjG8f-QHBJlI_yCPdjYo4rm_WrswmUE8GjLoRqI,491
@@ -46,7 +46,7 @@ aixtools/mcp/__init__.py,sha256=tLo2KZ1Ojo-rgEEJBGtZfUw-iOoopWoHDnYQTq3IzfE,163
46
46
  aixtools/mcp/example_client.py,sha256=QCFGP3NCNJMOKWjUOnFwjnbJhUSb879IA1ZYmwjRnmc,889
47
47
  aixtools/mcp/example_server.py,sha256=1SWCyrLWsAnOa81HC4QbPJo_lBVu0b3SZBWI-qDh1vQ,458
48
48
  aixtools/mcp/fast_mcp_log.py,sha256=XYOS406dVjn5YTHyGRsRvVNQ0SKlRObfrKj6EeLFjHg,1057
49
- aixtools/mcp/faulty_mcp.py,sha256=_qqiZs6SYa_baqLzBwV9ImqSjiW54bn2mbQqpy6Gb_w,12969
49
+ aixtools/mcp/faulty_mcp.py,sha256=IzayVeElQZRw-sw_QwOwHHh2PuK2T9NKikEi_tt8SPU,12759
50
50
  aixtools/model_patch/model_patch.py,sha256=JT-oHubIn2LeoSwWbzEQ5vLH7crJmFUecHyQfaAFHa0,1813
51
51
  aixtools/server/__init__.py,sha256=rwPx020YpOzCnrxA80Lc4yLLcIp-Mpe9hNqVO9wDPv0,448
52
52
  aixtools/server/app_mounter.py,sha256=0tJ0tC140ezAjnYdlhpLJQjY-TO8NVw7D8LseYCCVY8,3336
@@ -78,8 +78,8 @@ scripts/log_view.sh,sha256=bp8oXFRRbbHpyvHAN85wfDHTVK7vMJOYsBx_-bgECQc,511
78
78
  scripts/run_example_mcp_server.sh,sha256=f7m7h7O_wo6-nAsYlOXVWIASCOh3Qbuu0XWizlxMhl8,355
79
79
  scripts/run_faulty_mcp_server.sh,sha256=u_-8NbPDnJQt6IinNSjh8tc2ed-_MjGyipJXrUXaGR8,291
80
80
  scripts/run_server.sh,sha256=5iiB9bB5M2MuOgxVQqu7Oa_tBVtJpt0uB4z9uLu2J50,720
81
- aixtools-0.1.2.dist-info/METADATA,sha256=3bcgV9cnwdS8dqv1K78MVnwYmXEuV5dY0QDS5pSLzaM,10109
82
- aixtools-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
- aixtools-0.1.2.dist-info/entry_points.txt,sha256=dHoutULEZx7xXSqJrZdViSVjfInJibfLibi2nRXL3SE,56
84
- aixtools-0.1.2.dist-info/top_level.txt,sha256=IPyw70hj9gVDyugaIr3LRlanLYXzostW4azlTgdlALo,34
85
- aixtools-0.1.2.dist-info/RECORD,,
81
+ aixtools-0.1.3.dist-info/METADATA,sha256=EjMCZ1tNjNpNF95J0h08jI3Rb19Phe9-fDei7S1Syg0,10109
82
+ aixtools-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
+ aixtools-0.1.3.dist-info/entry_points.txt,sha256=dHoutULEZx7xXSqJrZdViSVjfInJibfLibi2nRXL3SE,56
84
+ aixtools-0.1.3.dist-info/top_level.txt,sha256=IPyw70hj9gVDyugaIr3LRlanLYXzostW4azlTgdlALo,34
85
+ aixtools-0.1.3.dist-info/RECORD,,