aiqtoolkit 1.1.0a20250507__py3-none-any.whl → 1.1.0a20250508__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 aiqtoolkit might be problematic. Click here for more details.
- aiq/builder/eval_builder.py +5 -1
- aiq/builder/workflow_builder.py +10 -2
- aiq/cli/commands/info/info.py +2 -0
- aiq/cli/commands/info/list_mcp.py +126 -0
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/METADATA +1 -1
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/RECORD +11 -10
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/WHEEL +0 -0
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/entry_points.txt +0 -0
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/licenses/LICENSE.md +0 -0
- {aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/top_level.txt +0 -0
aiq/builder/eval_builder.py
CHANGED
|
@@ -27,6 +27,7 @@ from aiq.data_models.config import AIQConfig
|
|
|
27
27
|
from aiq.data_models.config import GeneralConfig
|
|
28
28
|
from aiq.data_models.evaluate import EvalGeneralConfig
|
|
29
29
|
from aiq.data_models.evaluator import EvaluatorBaseConfig
|
|
30
|
+
from aiq.data_models.function import EmptyFunctionConfig
|
|
30
31
|
from aiq.utils.type_utils import override
|
|
31
32
|
|
|
32
33
|
logger = logging.getLogger(__name__)
|
|
@@ -102,7 +103,10 @@ class WorkflowEvalBuilder(WorkflowBuilder, EvalBuilder):
|
|
|
102
103
|
return tools
|
|
103
104
|
|
|
104
105
|
async def populate_builder(self, config: AIQConfig):
|
|
105
|
-
|
|
106
|
+
# Skip setting workflow if workflow config is EmptyFunctionConfig
|
|
107
|
+
skip_workflow = isinstance(config.workflow, EmptyFunctionConfig)
|
|
108
|
+
|
|
109
|
+
await super().populate_builder(config, skip_workflow)
|
|
106
110
|
# Instantiate the evaluators
|
|
107
111
|
for name, evaluator_config in config.eval.evaluators.items():
|
|
108
112
|
await self.add_evaluator(name, evaluator_config)
|
aiq/builder/workflow_builder.py
CHANGED
|
@@ -586,8 +586,15 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
586
586
|
def get_user_manager(self):
|
|
587
587
|
return UserManagerHolder(context=AIQContext(self._context_state))
|
|
588
588
|
|
|
589
|
-
async def populate_builder(self, config: AIQConfig):
|
|
589
|
+
async def populate_builder(self, config: AIQConfig, skip_workflow: bool = False):
|
|
590
|
+
"""
|
|
591
|
+
Populate the builder with components and optionally set up the workflow.
|
|
592
|
+
|
|
593
|
+
Args:
|
|
594
|
+
config (AIQConfig): The configuration object containing component definitions.
|
|
595
|
+
skip_workflow (bool): If True, skips the workflow instantiation step. Defaults to False.
|
|
590
596
|
|
|
597
|
+
"""
|
|
591
598
|
# Generate the build sequence
|
|
592
599
|
build_sequence = build_dependency_sequence(config)
|
|
593
600
|
|
|
@@ -614,7 +621,8 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
614
621
|
raise ValueError(f"Unknown component group {component_instance.component_group}")
|
|
615
622
|
|
|
616
623
|
# Instantiate the workflow
|
|
617
|
-
|
|
624
|
+
if not skip_workflow:
|
|
625
|
+
await self.set_workflow(config.workflow)
|
|
618
626
|
|
|
619
627
|
@classmethod
|
|
620
628
|
@asynccontextmanager
|
aiq/cli/commands/info/info.py
CHANGED
|
@@ -19,6 +19,7 @@ import click
|
|
|
19
19
|
|
|
20
20
|
from aiq.cli.commands.info.list_channels import list_channels
|
|
21
21
|
from aiq.cli.commands.info.list_components import list_components
|
|
22
|
+
from aiq.cli.commands.info.list_mcp import list_mcp
|
|
22
23
|
|
|
23
24
|
logger = logging.getLogger(__name__)
|
|
24
25
|
|
|
@@ -35,3 +36,4 @@ def info_command(**kwargs):
|
|
|
35
36
|
|
|
36
37
|
info_command.add_command(list_components, name="components")
|
|
37
38
|
info_command.add_command(list_channels, "channels")
|
|
39
|
+
info_command.add_command(list_mcp, "mcp")
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
|
|
19
|
+
import anyio
|
|
20
|
+
import click
|
|
21
|
+
|
|
22
|
+
from aiq.tool.mcp.mcp_client import MCPBuilder
|
|
23
|
+
|
|
24
|
+
# Suppress verbose logs from mcp.client.sse and httpx
|
|
25
|
+
logging.getLogger("mcp.client.sse").setLevel(logging.WARNING)
|
|
26
|
+
logging.getLogger("httpx").setLevel(logging.WARNING)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def format_tool(tool):
|
|
30
|
+
name = getattr(tool, 'name', None)
|
|
31
|
+
description = getattr(tool, 'description', '')
|
|
32
|
+
input_schema = getattr(tool, 'input_schema', None) or getattr(tool, 'inputSchema', None)
|
|
33
|
+
|
|
34
|
+
schema_str = None
|
|
35
|
+
if input_schema:
|
|
36
|
+
if hasattr(input_schema, "schema_json"):
|
|
37
|
+
schema_str = input_schema.schema_json(indent=2)
|
|
38
|
+
else:
|
|
39
|
+
schema_str = str(input_schema)
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
"name": name,
|
|
43
|
+
"description": description,
|
|
44
|
+
"input_schema": schema_str,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def print_tool(tool_dict, detail=False):
|
|
49
|
+
click.echo(f"Tool: {tool_dict['name']}")
|
|
50
|
+
if detail or tool_dict.get('input_schema') or tool_dict.get('description'):
|
|
51
|
+
click.echo(f"Description: {tool_dict['description']}")
|
|
52
|
+
if tool_dict["input_schema"]:
|
|
53
|
+
click.echo("Input Schema:")
|
|
54
|
+
click.echo(tool_dict["input_schema"])
|
|
55
|
+
else:
|
|
56
|
+
click.echo("Input Schema: None")
|
|
57
|
+
click.echo("-" * 60)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
async def list_tools_and_schemas(url, tool_name=None):
|
|
61
|
+
builder = MCPBuilder(url=url)
|
|
62
|
+
try:
|
|
63
|
+
if tool_name:
|
|
64
|
+
tool = await builder.get_tool(tool_name)
|
|
65
|
+
return [format_tool(tool)]
|
|
66
|
+
else:
|
|
67
|
+
tools = await builder.get_tools()
|
|
68
|
+
return [format_tool(tool) for tool in tools.values()]
|
|
69
|
+
except Exception as e:
|
|
70
|
+
click.echo(f"[ERROR] Failed to fetch tools via MCPBuilder: {e}", err=True)
|
|
71
|
+
return []
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
async def list_tools_direct(url, tool_name=None):
|
|
75
|
+
from mcp import ClientSession
|
|
76
|
+
from mcp.client.sse import sse_client
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
async with sse_client(url=url) as (read, write):
|
|
80
|
+
async with ClientSession(read, write) as session:
|
|
81
|
+
await session.initialize()
|
|
82
|
+
response = await session.list_tools()
|
|
83
|
+
|
|
84
|
+
tools = []
|
|
85
|
+
for tool in response.tools:
|
|
86
|
+
if tool_name:
|
|
87
|
+
if tool.name == tool_name:
|
|
88
|
+
return [format_tool(tool)]
|
|
89
|
+
else:
|
|
90
|
+
tools.append(format_tool(tool))
|
|
91
|
+
if tool_name and not tools:
|
|
92
|
+
click.echo(f"[INFO] Tool '{tool_name}' not found.")
|
|
93
|
+
return tools
|
|
94
|
+
except Exception as e:
|
|
95
|
+
click.echo(f"[ERROR] Failed to fetch tools via direct protocol: {e}", err=True)
|
|
96
|
+
return []
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@click.group(invoke_without_command=True, help="List tool names (default), or show details with --detail or --tool.")
|
|
100
|
+
@click.option('--direct', is_flag=True, help='Bypass MCPBuilder and use direct MCP protocol')
|
|
101
|
+
@click.option('--url', default='http://localhost:9901/sse', show_default=True, help='MCP server URL')
|
|
102
|
+
@click.option('--tool', default=None, help='Get details for a specific tool by name')
|
|
103
|
+
@click.option('--detail', is_flag=True, help='Show full details for all tools')
|
|
104
|
+
@click.option('--json-output', is_flag=True, help='Output tool metadata in JSON format')
|
|
105
|
+
@click.pass_context
|
|
106
|
+
def list_mcp(ctx, direct, url, tool, detail, json_output):
|
|
107
|
+
"""
|
|
108
|
+
List tool names (default). Use --detail for full output. If --tool is provided,
|
|
109
|
+
always show full output for that tool.
|
|
110
|
+
"""
|
|
111
|
+
if ctx.invoked_subcommand is not None:
|
|
112
|
+
return
|
|
113
|
+
fetcher = list_tools_direct if direct else list_tools_and_schemas
|
|
114
|
+
tools = anyio.run(fetcher, url, tool)
|
|
115
|
+
|
|
116
|
+
if json_output:
|
|
117
|
+
click.echo(json.dumps(tools, indent=2))
|
|
118
|
+
elif tool:
|
|
119
|
+
for tool_dict in tools:
|
|
120
|
+
print_tool(tool_dict, detail=True)
|
|
121
|
+
elif detail:
|
|
122
|
+
for tool_dict in tools:
|
|
123
|
+
print_tool(tool_dict, detail=True)
|
|
124
|
+
else:
|
|
125
|
+
for tool_dict in tools:
|
|
126
|
+
click.echo(tool_dict['name'])
|
|
@@ -21,7 +21,7 @@ aiq/builder/builder.py,sha256=JE3uCw6qTmWX2akUfS-Ga5WSiJVTzBjDQPniiONMjy4,7448
|
|
|
21
21
|
aiq/builder/component_utils.py,sha256=2jIXWSLIlKxDKAO7kdXz_4BHqQNWw4t9GmcQfw0ER4g,12923
|
|
22
22
|
aiq/builder/context.py,sha256=Sk2Vcduz7zbGkJe28VxCDt8GC5GKDhwvl1zLuRBTmss,8574
|
|
23
23
|
aiq/builder/embedder.py,sha256=M-n2oXSlwE7u-nmpzRbPq6UVWtFtMvrEdKqqsbKQZLk,965
|
|
24
|
-
aiq/builder/eval_builder.py,sha256=
|
|
24
|
+
aiq/builder/eval_builder.py,sha256=UnNgtQiDAUfT3yuwjZQVerenI09-4q0Cse9uwLjk3Fg,4657
|
|
25
25
|
aiq/builder/evaluator.py,sha256=O6Gu0cUwQkrPxPX29Vf_-RopgijxPnhy7mhg_j-9A84,1162
|
|
26
26
|
aiq/builder/framework_enum.py,sha256=eYwHQifZ86dx-OTubVA3qhCLRqhB4ElMBYBGA0gYtic,885
|
|
27
27
|
aiq/builder/front_end.py,sha256=Xhvfi4VcDh5EoCtLr6AlLQfbRm8_TyugUc_IRfirN6Y,2225
|
|
@@ -33,7 +33,7 @@ aiq/builder/llm.py,sha256=DcoYCyschsRjkW_yGsa_Ci7ELSpk5KRbi9778Dm_B9c,951
|
|
|
33
33
|
aiq/builder/retriever.py,sha256=GM7L1T4NdNZKerFZiCfLcQOwsGoX0NRlF8my7SMq3l4,970
|
|
34
34
|
aiq/builder/user_interaction_manager.py,sha256=OXr-RxWf1sEZjzQH_jt0nmqrLBtYLHGEZEcfDYYFV88,2913
|
|
35
35
|
aiq/builder/workflow.py,sha256=UOjrXmu1sxWTxTjygszqYgK0gK65r_beLKUwOpxtXuc,5894
|
|
36
|
-
aiq/builder/workflow_builder.py,sha256=
|
|
36
|
+
aiq/builder/workflow_builder.py,sha256=LBlNc3HiKzMxI5XNiV4hj9PVLH1N6p9ErHWgWaRZsZM,29694
|
|
37
37
|
aiq/cli/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
38
38
|
aiq/cli/entrypoint.py,sha256=BJsCZgC2nVyAWj7tBXwW67OIteg833xAI54R-e9O8oc,4757
|
|
39
39
|
aiq/cli/main.py,sha256=yVTX5-5-21OOfG8qAdcK3M1fCQUxdr3G37Mb5OldPQc,1772
|
|
@@ -55,9 +55,10 @@ aiq/cli/commands/configure/channel/channel.py,sha256=3y4lCk1PqqKPLlPtBo-B7jkUZ-K
|
|
|
55
55
|
aiq/cli/commands/configure/channel/remove.py,sha256=zvLw1gRwF58erC1EWbPiWbPMRYXfNNcf2SKusBqsm24,1104
|
|
56
56
|
aiq/cli/commands/configure/channel/update.py,sha256=vsQzt4vFAg5PsmbRimrKoChtkGUSsVywusOrUxgLWd0,1100
|
|
57
57
|
aiq/cli/commands/info/__init__.py,sha256=GUJrgGtpvyMUCjUBvR3faAdv-tZzbU9W-izgx9aMEQg,680
|
|
58
|
-
aiq/cli/commands/info/info.py,sha256=
|
|
58
|
+
aiq/cli/commands/info/info.py,sha256=ePgsfHfmfAkjg-MoS9AIfY0Zqm0GSEG3Blid821-woc,1359
|
|
59
59
|
aiq/cli/commands/info/list_channels.py,sha256=OVmb_BtCQiH5j2KVd0srwMUW90JUHyNIU7tqo2GdiGc,1292
|
|
60
60
|
aiq/cli/commands/info/list_components.py,sha256=1qkJazV_dsoCVd4T8Vjv3F7Kg7P7xmzMjLs2o0fkpws,4483
|
|
61
|
+
aiq/cli/commands/info/list_mcp.py,sha256=OOTtmCUFoeWX3SslMACsDvhlu_BAf-4grIT0gf04cbs,4632
|
|
61
62
|
aiq/cli/commands/registry/__init__.py,sha256=GUJrgGtpvyMUCjUBvR3faAdv-tZzbU9W-izgx9aMEQg,680
|
|
62
63
|
aiq/cli/commands/registry/publish.py,sha256=uPKJ_pvHkDohvIYlGtkGSoo6KCftBtC-vRDUfmUyceE,3234
|
|
63
64
|
aiq/cli/commands/registry/pull.py,sha256=jMR9NP7rV4g1WuUxGXUXjMgv0tV3UAJTKrTZvstx-Tc,4119
|
|
@@ -305,10 +306,10 @@ aiq/utils/reactive/base/observer_base.py,sha256=UAlyAY_ky4q2t0P81RVFo2Bs_R7z5Nde
|
|
|
305
306
|
aiq/utils/reactive/base/subject_base.py,sha256=Ed-AC6P7cT3qkW1EXjzbd5M9WpVoeN_9KCe3OM3FLU4,2521
|
|
306
307
|
aiq/utils/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
307
308
|
aiq/utils/settings/global_settings.py,sha256=U9TCLdoZsKq5qOVGjREipGVv9e-FlStzqy5zv82_VYk,7454
|
|
308
|
-
aiqtoolkit-1.1.
|
|
309
|
-
aiqtoolkit-1.1.
|
|
310
|
-
aiqtoolkit-1.1.
|
|
311
|
-
aiqtoolkit-1.1.
|
|
312
|
-
aiqtoolkit-1.1.
|
|
313
|
-
aiqtoolkit-1.1.
|
|
314
|
-
aiqtoolkit-1.1.
|
|
309
|
+
aiqtoolkit-1.1.0a20250508.dist-info/licenses/LICENSE-3rd-party.txt,sha256=8o7aySJa9CBvFshPcsRdJbczzdNyDGJ8b0J67WRUQ2k,183936
|
|
310
|
+
aiqtoolkit-1.1.0a20250508.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
311
|
+
aiqtoolkit-1.1.0a20250508.dist-info/METADATA,sha256=3ObPTxU1YJrCIjaMj6_zd5j00ARoGBxSCmMFncnsfrc,20138
|
|
312
|
+
aiqtoolkit-1.1.0a20250508.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
313
|
+
aiqtoolkit-1.1.0a20250508.dist-info/entry_points.txt,sha256=gRlPfR5g21t328WNEQ4CcEz80S1sJNS8A7rMDYnzl4A,452
|
|
314
|
+
aiqtoolkit-1.1.0a20250508.dist-info/top_level.txt,sha256=fo7AzYcNhZ_tRWrhGumtxwnxMew4xrT1iwouDy_f0Kc,4
|
|
315
|
+
aiqtoolkit-1.1.0a20250508.dist-info/RECORD,,
|
|
File without changes
|
{aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{aiqtoolkit-1.1.0a20250507.dist-info → aiqtoolkit-1.1.0a20250508.dist-info}/licenses/LICENSE.md
RENAMED
|
File without changes
|
|
File without changes
|