aixtools 0.2.12__py3-none-any.whl → 0.2.14__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.2.12'
32
- __version_tuple__ = version_tuple = (0, 2, 12)
31
+ __version__ = version = '0.2.14'
32
+ __version_tuple__ = version_tuple = (0, 2, 14)
33
33
 
34
34
  __commit_id__ = commit_id = None
aixtools/agents/agent.py CHANGED
@@ -51,17 +51,17 @@ def _get_model_bedrock(model_name=BEDROCK_MODEL_NAME, aws_region=AWS_REGION):
51
51
  return BedrockConverseModel(model_name=model_name, provider=provider)
52
52
 
53
53
 
54
- def _get_model_ollama(model_name=OLLAMA_MODEL_NAME, ollama_url=OLLAMA_URL):
54
+ def _get_model_ollama(model_name=OLLAMA_MODEL_NAME, ollama_url=OLLAMA_URL, http_client=None):
55
55
  assert ollama_url, "OLLAMA_URL is not set"
56
56
  assert model_name, "Model name is not set"
57
- provider = OpenAIProvider(base_url=ollama_url)
57
+ provider = OpenAIProvider(base_url=ollama_url, http_client=http_client)
58
58
  return OpenAIChatModel(model_name=model_name, provider=provider)
59
59
 
60
60
 
61
- def _get_model_openai(model_name=OPENAI_MODEL_NAME, openai_api_key=OPENAI_API_KEY):
61
+ def _get_model_openai(model_name=OPENAI_MODEL_NAME, openai_api_key=OPENAI_API_KEY, http_client=None):
62
62
  assert openai_api_key, "OPENAI_API_KEY is not set"
63
63
  assert model_name, "Model name is not set"
64
- provider = OpenAIProvider(api_key=openai_api_key)
64
+ provider = OpenAIProvider(api_key=openai_api_key, http_client=http_client)
65
65
  return OpenAIChatModel(model_name=model_name, provider=provider)
66
66
 
67
67
 
@@ -76,22 +76,27 @@ def _get_model_openai_azure(
76
76
  assert azure_openai_api_version, "AZURE_OPENAI_API_VERSION is not set"
77
77
  assert model_name, "Model name is not set"
78
78
  client = AsyncAzureOpenAI(
79
- azure_endpoint=azure_openai_endpoint, api_version=azure_openai_api_version, api_key=azure_openai_api_key
79
+ azure_endpoint=azure_openai_endpoint,
80
+ api_version=azure_openai_api_version,
81
+ api_key=azure_openai_api_key,
80
82
  )
81
83
  return OpenAIChatModel(model_name=model_name, provider=OpenAIProvider(openai_client=client))
82
84
 
83
85
 
84
86
  def _get_model_open_router(
85
- model_name=OPENROUTER_MODEL_NAME, openrouter_api_url=OPENROUTER_API_URL, openrouter_api_key=OPENROUTER_API_KEY
87
+ model_name=OPENROUTER_MODEL_NAME,
88
+ openrouter_api_url=OPENROUTER_API_URL,
89
+ openrouter_api_key=OPENROUTER_API_KEY,
90
+ http_client=None,
86
91
  ):
87
92
  assert openrouter_api_url, "OPENROUTER_API_URL is not set"
88
93
  assert openrouter_api_key, "OPENROUTER_API_KEY is not set"
89
94
  assert model_name, "Model name is not set, missing 'OPENROUTER_MODEL_NAME' environment variable?"
90
- provider = OpenAIProvider(base_url=openrouter_api_url, api_key=openrouter_api_key)
95
+ provider = OpenAIProvider(base_url=openrouter_api_url, api_key=openrouter_api_key, http_client=http_client)
91
96
  return OpenAIChatModel(model_name, provider=provider)
92
97
 
93
98
 
94
- def get_model(model_family=MODEL_FAMILY, model_name=None, **kwargs):
99
+ def get_model(model_family=MODEL_FAMILY, model_name=None, http_client=None, **kwargs):
95
100
  """Create and return appropriate model instance based on specified family and name."""
96
101
  assert model_family is not None and model_family != "", f"Model family '{model_family}' is not set"
97
102
  match model_family:
@@ -100,11 +105,13 @@ def get_model(model_family=MODEL_FAMILY, model_name=None, **kwargs):
100
105
  case "bedrock":
101
106
  return _get_model_bedrock(model_name=model_name or BEDROCK_MODEL_NAME, **kwargs)
102
107
  case "ollama":
103
- return _get_model_ollama(model_name=model_name or OLLAMA_MODEL_NAME, **kwargs)
108
+ return _get_model_ollama(model_name=model_name or OLLAMA_MODEL_NAME, http_client=http_client, **kwargs)
104
109
  case "openai":
105
- return _get_model_openai(model_name=model_name or OPENAI_MODEL_NAME, **kwargs)
110
+ return _get_model_openai(model_name=model_name or OPENAI_MODEL_NAME, http_client=http_client, **kwargs)
106
111
  case "openrouter":
107
- return _get_model_open_router(model_name=model_name or OPENROUTER_MODEL_NAME, **kwargs)
112
+ return _get_model_open_router(
113
+ model_name=model_name or OPENROUTER_MODEL_NAME, http_client=http_client, **kwargs
114
+ )
108
115
  case _:
109
116
  raise ValueError(f"Model family '{model_family}' not supported")
110
117
 
@@ -119,12 +126,15 @@ def get_agent( # noqa: PLR0913, pylint: disable=too-many-arguments,too-many-pos
119
126
  model_settings=None,
120
127
  output_type: Any = str,
121
128
  deps_type=NoneType,
129
+ http_client=None,
122
130
  ) -> Agent:
123
131
  """Get a PydanticAI agent"""
124
132
  if model_settings is None:
125
133
  model_settings = ModelSettings(timeout=MODEL_TIMEOUT)
126
134
  if model is None:
127
- model = get_model()
135
+ model = get_model(
136
+ http_client=http_client,
137
+ )
128
138
  agent = Agent(
129
139
  model=model,
130
140
  output_type=output_type,
aixtools/mcp/__init__.py CHANGED
@@ -2,8 +2,10 @@
2
2
  Model Context Protocol (MCP) implementation for AI agent communication.
3
3
  """
4
4
 
5
+ from aixtools.mcp.exceptions import AixToolError
5
6
  from aixtools.mcp.fast_mcp_log import FastMcpLog
6
7
 
7
8
  __all__ = [
8
9
  "FastMcpLog",
10
+ "AixToolError",
9
11
  ]
@@ -0,0 +1,5 @@
1
+ """Custom exceptions for MCP services."""
2
+
3
+
4
+ class AixToolError(Exception):
5
+ """Retryable tool error. Raise this when a tool fails but the operation should be retried."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aixtools
3
- Version: 0.2.12
3
+ Version: 0.2.14
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=kUi3MrWsIVQiHrXbB13_ffDrVNg8qWHnVa_kbLjcxME,706
2
+ aixtools/_version.py,sha256=lOOOEggb8ag564aDqoOp-6k18Oo-qSEBUsWUUBMG5Qs,706
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=I_MD40ZnvRm5WPKAKqBUAdXIf8YaurkYUUHSVVy-QvU,598
@@ -25,7 +25,7 @@ aixtools/a2a/google_sdk/utils.py,sha256=4VIPV2GtG5IRY-KSZN6iRMS3ntxG2uKgd_d5tQvn
25
25
  aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py,sha256=8VuU2WXeSHUK3_rRm_mjX6elqdC9NA2uz1aELzeC8BU,9784
26
26
  aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py,sha256=nGoVL7MPoZJW7iVR71laqpUYP308yFKZIifJtvUgpiU,878
27
27
  aixtools/agents/__init__.py,sha256=MAW196S2_G7uGqv-VNjvlOETRfuV44WlU1leO7SiR0A,282
28
- aixtools/agents/agent.py,sha256=tceQByn-RGBIhW8BOjKoP0yhNzZLwAa6CxwhPhRe3PU,7270
28
+ aixtools/agents/agent.py,sha256=JRbWWo3lueXyNSd9UgnTztm4bZr7dPxeNOzCFNFG7RE,7620
29
29
  aixtools/agents/agent_batch.py,sha256=0Zu9yNCRPAQZPjXQ-dIUAmP1uGTVbxVt7xvnMpoJMjU,2251
30
30
  aixtools/agents/print_nodes.py,sha256=wVTngNfqM0As845WTRz6G3Rei_Gr3HuBlvu-G_eXuig,1665
31
31
  aixtools/agents/prompt.py,sha256=p9OYnyJ4-MyGXwHPrQeJBhZ2a3RV2HqhtdUUCrTMsAQ,3361
@@ -58,10 +58,11 @@ aixtools/logging/mcp_log_models.py,sha256=7-H2GJXiiyLhpImuyLLftAGG4skxJal8Swax0o
58
58
  aixtools/logging/mcp_logger.py,sha256=d2I5l4t0d6rQH17w23FpE1IUD8Ax-mSaKfByCH86q4I,6257
59
59
  aixtools/logging/model_patch_logging.py,sha256=MY2EvR7ZSctC4hJxNMe8iACeVayUJ2V5In2GAnKdgOo,2880
60
60
  aixtools/logging/open_telemetry.py,sha256=fJjF1ou_8GyfNfbyWDQPGK6JAUrUaPwURYPHhXEtDBE,1121
61
- aixtools/mcp/__init__.py,sha256=tLo2KZ1Ojo-rgEEJBGtZfUw-iOoopWoHDnYQTq3IzfE,163
61
+ aixtools/mcp/__init__.py,sha256=Qp4uD1RtypCYgzWrt_ThBVxa5-CFBgcwMWkHbHFUQ54,232
62
62
  aixtools/mcp/client.py,sha256=aCDLc_AfrjV8JtZLWnKCTnScvFdNoMJZiGQhBUO8t8w,18289
63
63
  aixtools/mcp/example_client.py,sha256=QCFGP3NCNJMOKWjUOnFwjnbJhUSb879IA1ZYmwjRnmc,889
64
64
  aixtools/mcp/example_server.py,sha256=1SWCyrLWsAnOa81HC4QbPJo_lBVu0b3SZBWI-qDh1vQ,458
65
+ aixtools/mcp/exceptions.py,sha256=9m3hy9fRINbXTSgkE71XW_luklgH6xBRp7VnSRfpyzQ,173
65
66
  aixtools/mcp/fast_mcp_log.py,sha256=XYOS406dVjn5YTHyGRsRvVNQ0SKlRObfrKj6EeLFjHg,1057
66
67
  aixtools/mcp/faulty_mcp.py,sha256=uU9vlNGCS_i2k20wocVMaDHTlYjMQxuzjILad9O1cjA,12807
67
68
  aixtools/model_patch/model_patch.py,sha256=JT-oHubIn2LeoSwWbzEQ5vLH7crJmFUecHyQfaAFHa0,1813
@@ -88,8 +89,8 @@ aixtools/utils/chainlit/cl_agent_show.py,sha256=vaRuowp4BRvhxEr5hw0zHEJ7iaSF_5bo
88
89
  aixtools/utils/chainlit/cl_utils.py,sha256=fxaxdkcZg6uHdM8uztxdPowg3a2f7VR7B26VPY4t-3c,5738
89
90
  aixtools/vault/__init__.py,sha256=fsr_NuX3GZ9WZ7dGfe0gp_5-z3URxAfwVRXw7Xyc0dU,141
90
91
  aixtools/vault/vault.py,sha256=9dZLWdZQk9qN_Q9Djkofw9LUKnJqnrX5H0fGusVLBhA,6037
91
- aixtools-0.2.12.dist-info/METADATA,sha256=KnSz22SzcgaKB4P39ouB8gy-efFU3ZlhBpGJohIfoRw,27230
92
- aixtools-0.2.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
- aixtools-0.2.12.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
94
- aixtools-0.2.12.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
95
- aixtools-0.2.12.dist-info/RECORD,,
92
+ aixtools-0.2.14.dist-info/METADATA,sha256=BVCtc_kv3nt7TFaIeOMK8APeIMu1ya4T5wnRdrAqams,27230
93
+ aixtools-0.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
94
+ aixtools-0.2.14.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
95
+ aixtools-0.2.14.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
96
+ aixtools-0.2.14.dist-info/RECORD,,