trustgraph-cli 1.4.13__tar.gz → 1.4.14__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 trustgraph-cli might be problematic. Click here for more details.

Files changed (77) hide show
  1. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/PKG-INFO +1 -1
  2. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/pyproject.toml +1 -0
  3. trustgraph_cli-1.4.14/trustgraph/cli/show_flow_classes.py +122 -0
  4. trustgraph_cli-1.4.14/trustgraph/cli/show_flows.py +215 -0
  5. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/start_flow.py +40 -1
  6. trustgraph_cli-1.4.14/trustgraph/cli_version.py +1 -0
  7. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/PKG-INFO +1 -1
  8. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/entry_points.txt +1 -0
  9. trustgraph_cli-1.4.13/trustgraph/cli/show_flow_classes.py +0 -67
  10. trustgraph_cli-1.4.13/trustgraph/cli/show_flows.py +0 -119
  11. trustgraph_cli-1.4.13/trustgraph/cli_version.py +0 -1
  12. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/README.md +0 -0
  13. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/setup.cfg +0 -0
  14. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/__init__.py +0 -0
  15. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/add_library_document.py +0 -0
  16. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_collection.py +0 -0
  17. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_config_item.py +0 -0
  18. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_flow_class.py +0 -0
  19. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_kg_core.py +0 -0
  20. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_mcp_tool.py +0 -0
  21. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/delete_tool.py +0 -0
  22. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/dump_msgpack.py +0 -0
  23. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/get_config_item.py +0 -0
  24. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/get_flow_class.py +0 -0
  25. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/get_kg_core.py +0 -0
  26. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/graph_to_turtle.py +0 -0
  27. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/init_pulsar_manager.py +0 -0
  28. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/init_trustgraph.py +0 -0
  29. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_agent.py +0 -0
  30. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_document_rag.py +0 -0
  31. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_graph_rag.py +0 -0
  32. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_llm.py +0 -0
  33. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_mcp_tool.py +0 -0
  34. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_nlp_query.py +0 -0
  35. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_objects_query.py +0 -0
  36. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_prompt.py +0 -0
  37. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/invoke_structured_query.py +0 -0
  38. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/list_collections.py +0 -0
  39. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/list_config_items.py +0 -0
  40. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_doc_embeds.py +0 -0
  41. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_kg_core.py +0 -0
  42. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_knowledge.py +0 -0
  43. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_pdf.py +0 -0
  44. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_sample_documents.py +0 -0
  45. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_structured_data.py +0 -0
  46. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_text.py +0 -0
  47. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/load_turtle.py +0 -0
  48. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/put_config_item.py +0 -0
  49. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/put_flow_class.py +0 -0
  50. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/put_kg_core.py +0 -0
  51. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/remove_library_document.py +0 -0
  52. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/save_doc_embeds.py +0 -0
  53. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/set_collection.py +0 -0
  54. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/set_mcp_tool.py +0 -0
  55. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/set_prompt.py +0 -0
  56. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/set_token_costs.py +0 -0
  57. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/set_tool.py +0 -0
  58. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_config.py +0 -0
  59. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_flow_state.py +0 -0
  60. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_graph.py +0 -0
  61. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_kg_cores.py +0 -0
  62. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_library_documents.py +0 -0
  63. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_library_processing.py +0 -0
  64. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_mcp_tools.py +0 -0
  65. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_processor_state.py +0 -0
  66. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_prompts.py +0 -0
  67. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_token_costs.py +0 -0
  68. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_token_rate.py +0 -0
  69. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/show_tools.py +0 -0
  70. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/start_library_processing.py +0 -0
  71. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/stop_flow.py +0 -0
  72. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/stop_library_processing.py +0 -0
  73. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph/cli/unload_kg_core.py +0 -0
  74. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/SOURCES.txt +0 -0
  75. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
  76. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/requires.txt +0 -0
  77. {trustgraph_cli-1.4.13 → trustgraph_cli-1.4.14}/trustgraph_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-cli
3
- Version: 1.4.13
3
+ Version: 1.4.14
4
4
  Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
5
  Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
6
  Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
@@ -72,6 +72,7 @@ tg-show-kg-cores = "trustgraph.cli.show_kg_cores:main"
72
72
  tg-show-library-documents = "trustgraph.cli.show_library_documents:main"
73
73
  tg-show-library-processing = "trustgraph.cli.show_library_processing:main"
74
74
  tg-show-mcp-tools = "trustgraph.cli.show_mcp_tools:main"
75
+ tg-show-parameter-types = "trustgraph.cli.show_parameter_types:main"
75
76
  tg-show-processor-state = "trustgraph.cli.show_processor_state:main"
76
77
  tg-show-prompts = "trustgraph.cli.show_prompts:main"
77
78
  tg-show-token-costs = "trustgraph.cli.show_token_costs:main"
@@ -0,0 +1,122 @@
1
+ """
2
+ Shows all defined flow classes.
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import tabulate
8
+ from trustgraph.api import Api, ConfigKey
9
+ import json
10
+
11
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
+
13
+ def format_parameters(params_metadata, config_api):
14
+ """
15
+ Format parameter metadata for display
16
+
17
+ Args:
18
+ params_metadata: Parameter definitions from flow class
19
+ config_api: API client to get parameter type information
20
+
21
+ Returns:
22
+ Formatted string describing parameters
23
+ """
24
+ if not params_metadata:
25
+ return "None"
26
+
27
+ param_list = []
28
+
29
+ # Sort parameters by order if available
30
+ sorted_params = sorted(
31
+ params_metadata.items(),
32
+ key=lambda x: x[1].get("order", 999)
33
+ )
34
+
35
+ for param_name, param_meta in sorted_params:
36
+ description = param_meta.get("description", param_name)
37
+ param_type = param_meta.get("type", "unknown")
38
+
39
+ # Get type information if available
40
+ type_info = param_type
41
+ if config_api:
42
+ try:
43
+ key = ConfigKey("parameter-types", param_type)
44
+ type_def_value = config_api.get([key])[0].value
45
+ param_type_def = json.loads(type_def_value)
46
+
47
+ # Add default value if available
48
+ default = param_type_def.get("default")
49
+ if default is not None:
50
+ type_info = f"{param_type} (default: {default})"
51
+
52
+ except:
53
+ # If we can't get type definition, just show the type name
54
+ pass
55
+
56
+ param_list.append(f" {param_name}: {description} [{type_info}]")
57
+
58
+ return "\n".join(param_list)
59
+
60
+ def show_flow_classes(url):
61
+
62
+ api = Api(url)
63
+ flow_api = api.flow()
64
+ config_api = api.config()
65
+
66
+ class_names = flow_api.list_classes()
67
+
68
+ if len(class_names) == 0:
69
+ print("No flow classes.")
70
+ return
71
+
72
+ for class_name in class_names:
73
+ cls = flow_api.get_class(class_name)
74
+
75
+ table = []
76
+ table.append(("name", class_name))
77
+ table.append(("description", cls.get("description", "")))
78
+
79
+ tags = cls.get("tags", [])
80
+ if tags:
81
+ table.append(("tags", ", ".join(tags)))
82
+
83
+ # Show parameters if they exist
84
+ parameters = cls.get("parameters", {})
85
+ if parameters:
86
+ param_str = format_parameters(parameters, config_api)
87
+ table.append(("parameters", param_str))
88
+
89
+ print(tabulate.tabulate(
90
+ table,
91
+ tablefmt="pretty",
92
+ stralign="left",
93
+ ))
94
+ print()
95
+
96
+ def main():
97
+
98
+ parser = argparse.ArgumentParser(
99
+ prog='tg-show-flow-classes',
100
+ description=__doc__,
101
+ )
102
+
103
+ parser.add_argument(
104
+ '-u', '--api-url',
105
+ default=default_url,
106
+ help=f'API URL (default: {default_url})',
107
+ )
108
+
109
+ args = parser.parse_args()
110
+
111
+ try:
112
+
113
+ show_flow_classes(
114
+ url=args.api_url,
115
+ )
116
+
117
+ except Exception as e:
118
+
119
+ print("Exception:", e, flush=True)
120
+
121
+ if __name__ == "__main__":
122
+ main()
@@ -0,0 +1,215 @@
1
+ """
2
+ Shows configured flows.
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import tabulate
8
+ from trustgraph.api import Api, ConfigKey
9
+ import json
10
+
11
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
+
13
+ def get_interface(config_api, i):
14
+
15
+ key = ConfigKey("interface-descriptions", i)
16
+
17
+ value = config_api.get([key])[0].value
18
+
19
+ return json.loads(value)
20
+
21
+ def describe_interfaces(intdefs, flow):
22
+
23
+ intfs = flow.get("interfaces", {})
24
+
25
+ lst = []
26
+
27
+ for k, v in intdefs.items():
28
+
29
+ if intdefs[k].get("visible", False):
30
+
31
+ label = intdefs[k].get("description", k)
32
+ kind = intdefs[k].get("kind", None)
33
+
34
+ if kind == "request-response":
35
+ req = intfs[k]["request"]
36
+ resp = intfs[k]["request"]
37
+
38
+ lst.append(f"{k} request: {req}")
39
+ lst.append(f"{k} response: {resp}")
40
+
41
+ if kind == "send":
42
+ q = intfs[k]
43
+
44
+ lst.append(f"{k}: {q}")
45
+
46
+ return "\n".join(lst)
47
+
48
+ def get_enum_description(param_value, param_type_def):
49
+ """
50
+ Get the human-readable description for an enum value
51
+
52
+ Args:
53
+ param_value: The actual parameter value (e.g., "gpt-4")
54
+ param_type_def: The parameter type definition containing enum objects
55
+
56
+ Returns:
57
+ Human-readable description or the original value if not found
58
+ """
59
+ enum_list = param_type_def.get("enum", [])
60
+
61
+ # Handle both old format (strings) and new format (objects with id/description)
62
+ for enum_item in enum_list:
63
+ if isinstance(enum_item, dict):
64
+ if enum_item.get("id") == param_value:
65
+ return enum_item.get("description", param_value)
66
+ elif enum_item == param_value:
67
+ return param_value
68
+
69
+ # If not found in enum, return original value
70
+ return param_value
71
+
72
+ def format_parameters(flow_params, class_params_metadata, config_api):
73
+ """
74
+ Format flow parameters with their human-readable descriptions
75
+
76
+ Args:
77
+ flow_params: The actual parameter values used in the flow
78
+ class_params_metadata: The parameter metadata from the flow class definition
79
+ config_api: API client to retrieve parameter type definitions
80
+
81
+ Returns:
82
+ Formatted string of parameters with descriptions
83
+ """
84
+ if not flow_params:
85
+ return "None"
86
+
87
+ param_list = []
88
+
89
+ # Sort parameters by order if available
90
+ sorted_params = sorted(
91
+ class_params_metadata.items(),
92
+ key=lambda x: x[1].get("order", 999)
93
+ )
94
+
95
+ for param_name, param_meta in sorted_params:
96
+ if param_name in flow_params:
97
+ value = flow_params[param_name]
98
+ description = param_meta.get("description", param_name)
99
+ param_type = param_meta.get("type", "")
100
+ controlled_by = param_meta.get("controlled-by", None)
101
+
102
+ # Try to get enum description if this parameter has a type definition
103
+ display_value = value
104
+ if param_type and config_api:
105
+ try:
106
+ from trustgraph.api import ConfigKey
107
+ key = ConfigKey("parameter-types", param_type)
108
+ type_def_value = config_api.get([key])[0].value
109
+ param_type_def = json.loads(type_def_value)
110
+ display_value = get_enum_description(value, param_type_def)
111
+ except:
112
+ # If we can't get the type definition, just use the original value
113
+ display_value = value
114
+
115
+ # Format the parameter line
116
+ line = f"• {description}: {display_value}"
117
+
118
+ # Add controlled-by indicator if present
119
+ if controlled_by:
120
+ line += f" (controlled by {controlled_by})"
121
+
122
+ param_list.append(line)
123
+
124
+ # Add any parameters that aren't in the class metadata (shouldn't happen normally)
125
+ for param_name, value in flow_params.items():
126
+ if param_name not in class_params_metadata:
127
+ param_list.append(f"• {param_name}: {value} (undefined)")
128
+
129
+ return "\n".join(param_list) if param_list else "None"
130
+
131
+ def show_flows(url):
132
+
133
+ api = Api(url)
134
+ config_api = api.config()
135
+ flow_api = api.flow()
136
+
137
+ interface_names = config_api.list("interface-descriptions")
138
+
139
+ interface_defs = {
140
+ i: get_interface(config_api, i)
141
+ for i in interface_names
142
+ }
143
+
144
+ flow_ids = flow_api.list()
145
+
146
+ if len(flow_ids) == 0:
147
+ print("No flows.")
148
+ return
149
+
150
+ flows = []
151
+
152
+ for id in flow_ids:
153
+
154
+ flow = flow_api.get(id)
155
+
156
+ table = []
157
+ table.append(("id", id))
158
+ table.append(("class", flow.get("class-name", "")))
159
+ table.append(("desc", flow.get("description", "")))
160
+
161
+ # Display parameters with human-readable descriptions
162
+ parameters = flow.get("parameters", {})
163
+ if parameters:
164
+ # Try to get the flow class definition for parameter metadata
165
+ class_name = flow.get("class-name", "")
166
+ if class_name:
167
+ try:
168
+ flow_class = flow_api.get_class(class_name)
169
+ class_params_metadata = flow_class.get("parameters", {})
170
+ param_str = format_parameters(parameters, class_params_metadata, config_api)
171
+ except Exception as e:
172
+ # Fallback to JSON if we can't get the class definition
173
+ param_str = json.dumps(parameters, indent=2)
174
+ else:
175
+ # No class name, fallback to JSON
176
+ param_str = json.dumps(parameters, indent=2)
177
+
178
+ table.append(("parameters", param_str))
179
+
180
+ table.append(("queue", describe_interfaces(interface_defs, flow)))
181
+
182
+ print(tabulate.tabulate(
183
+ table,
184
+ tablefmt="pretty",
185
+ stralign="left",
186
+ ))
187
+ print()
188
+
189
+ def main():
190
+
191
+ parser = argparse.ArgumentParser(
192
+ prog='tg-show-flows',
193
+ description=__doc__,
194
+ )
195
+
196
+ parser.add_argument(
197
+ '-u', '--api-url',
198
+ default=default_url,
199
+ help=f'API URL (default: {default_url})',
200
+ )
201
+
202
+ args = parser.parse_args()
203
+
204
+ try:
205
+
206
+ show_flows(
207
+ url=args.api_url,
208
+ )
209
+
210
+ except Exception as e:
211
+
212
+ print("Exception:", e, flush=True)
213
+
214
+ if __name__ == "__main__":
215
+ main()
@@ -1,5 +1,10 @@
1
1
  """
2
- Starts a processing flow using a defined flow class
2
+ Starts a processing flow using a defined flow class.
3
+
4
+ Parameters can be provided in three ways:
5
+ 1. As key=value pairs: --param model=gpt-4 --param temp=0.7
6
+ 2. As JSON string: -p '{"model": "gpt-4", "temp": 0.7}'
7
+ 3. As JSON file: --parameters-file params.json
3
8
  """
4
9
 
5
10
  import argparse
@@ -62,6 +67,12 @@ def main():
62
67
  help='Path to JSON file containing flow parameters',
63
68
  )
64
69
 
70
+ parser.add_argument(
71
+ '--param',
72
+ action='append',
73
+ help='Flow parameter as key=value pair (can be used multiple times, e.g., --param model=gpt-4 --param temp=0.7)',
74
+ )
75
+
65
76
  args = parser.parse_args()
66
77
 
67
78
  try:
@@ -73,6 +84,34 @@ def main():
73
84
  parameters = json.load(f)
74
85
  elif args.parameters:
75
86
  parameters = json.loads(args.parameters)
87
+ elif args.param:
88
+ # Parse key=value pairs
89
+ parameters = {}
90
+ for param in args.param:
91
+ if '=' not in param:
92
+ raise ValueError(f"Invalid parameter format: {param}. Expected key=value")
93
+
94
+ key, value = param.split('=', 1)
95
+ key = key.strip()
96
+ value = value.strip()
97
+
98
+ # Try to parse value as JSON first (for numbers, booleans, etc.)
99
+ try:
100
+ # Handle common cases where we want to preserve the string
101
+ if value.lower() in ['true', 'false']:
102
+ parameters[key] = value.lower() == 'true'
103
+ elif value.replace('.', '').replace('-', '').isdigit():
104
+ # Check if it's a number
105
+ if '.' in value:
106
+ parameters[key] = float(value)
107
+ else:
108
+ parameters[key] = int(value)
109
+ else:
110
+ # Keep as string
111
+ parameters[key] = value
112
+ except ValueError:
113
+ # If JSON parsing fails, treat as string
114
+ parameters[key] = value
76
115
 
77
116
  start_flow(
78
117
  url = args.api_url,
@@ -0,0 +1 @@
1
+ __version__ = "1.4.14"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-cli
3
- Version: 1.4.13
3
+ Version: 1.4.14
4
4
  Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
5
  Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
6
  Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
@@ -50,6 +50,7 @@ tg-show-kg-cores = trustgraph.cli.show_kg_cores:main
50
50
  tg-show-library-documents = trustgraph.cli.show_library_documents:main
51
51
  tg-show-library-processing = trustgraph.cli.show_library_processing:main
52
52
  tg-show-mcp-tools = trustgraph.cli.show_mcp_tools:main
53
+ tg-show-parameter-types = trustgraph.cli.show_parameter_types:main
53
54
  tg-show-processor-state = trustgraph.cli.show_processor_state:main
54
55
  tg-show-prompts = trustgraph.cli.show_prompts:main
55
56
  tg-show-token-costs = trustgraph.cli.show_token_costs:main
@@ -1,67 +0,0 @@
1
- """
2
- Shows all defined flow classes.
3
- """
4
-
5
- import argparse
6
- import os
7
- import tabulate
8
- from trustgraph.api import Api
9
- import json
10
-
11
- default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
-
13
- def show_flow_classes(url):
14
-
15
- api = Api(url).flow()
16
-
17
- class_names = api.list_classes()
18
-
19
- if len(class_names) == 0:
20
- print("No flows.")
21
- return
22
-
23
- classes = []
24
-
25
- for class_name in class_names:
26
- cls = api.get_class(class_name)
27
- classes.append((
28
- class_name,
29
- cls.get("description", ""),
30
- ", ".join(cls.get("tags", [])),
31
- ))
32
-
33
- print(tabulate.tabulate(
34
- classes,
35
- tablefmt="pretty",
36
- maxcolwidths=[None, 40, 20],
37
- stralign="left",
38
- headers = ["flow class", "description", "tags"],
39
- ))
40
-
41
- def main():
42
-
43
- parser = argparse.ArgumentParser(
44
- prog='tg-show-flow-classes',
45
- description=__doc__,
46
- )
47
-
48
- parser.add_argument(
49
- '-u', '--api-url',
50
- default=default_url,
51
- help=f'API URL (default: {default_url})',
52
- )
53
-
54
- args = parser.parse_args()
55
-
56
- try:
57
-
58
- show_flow_classes(
59
- url=args.api_url,
60
- )
61
-
62
- except Exception as e:
63
-
64
- print("Exception:", e, flush=True)
65
-
66
- if __name__ == "__main__":
67
- main()
@@ -1,119 +0,0 @@
1
- """
2
- Shows configured flows.
3
- """
4
-
5
- import argparse
6
- import os
7
- import tabulate
8
- from trustgraph.api import Api, ConfigKey
9
- import json
10
-
11
- default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
-
13
- def get_interface(config_api, i):
14
-
15
- key = ConfigKey("interface-descriptions", i)
16
-
17
- value = config_api.get([key])[0].value
18
-
19
- return json.loads(value)
20
-
21
- def describe_interfaces(intdefs, flow):
22
-
23
- intfs = flow.get("interfaces", {})
24
-
25
- lst = []
26
-
27
- for k, v in intdefs.items():
28
-
29
- if intdefs[k].get("visible", False):
30
-
31
- label = intdefs[k].get("description", k)
32
- kind = intdefs[k].get("kind", None)
33
-
34
- if kind == "request-response":
35
- req = intfs[k]["request"]
36
- resp = intfs[k]["request"]
37
-
38
- lst.append(f"{k} request: {req}")
39
- lst.append(f"{k} response: {resp}")
40
-
41
- if kind == "send":
42
- q = intfs[k]
43
-
44
- lst.append(f"{k}: {q}")
45
-
46
- return "\n".join(lst)
47
-
48
- def show_flows(url):
49
-
50
- api = Api(url)
51
- config_api = api.config()
52
- flow_api = api.flow()
53
-
54
- interface_names = config_api.list("interface-descriptions")
55
-
56
- interface_defs = {
57
- i: get_interface(config_api, i)
58
- for i in interface_names
59
- }
60
-
61
- flow_ids = flow_api.list()
62
-
63
- if len(flow_ids) == 0:
64
- print("No flows.")
65
- return
66
-
67
- flows = []
68
-
69
- for id in flow_ids:
70
-
71
- flow = flow_api.get(id)
72
-
73
- table = []
74
- table.append(("id", id))
75
- table.append(("class", flow.get("class-name", "")))
76
- table.append(("desc", flow.get("description", "")))
77
-
78
- # Display parameters if they exist
79
- parameters = flow.get("parameters", {})
80
- if parameters:
81
- param_str = json.dumps(parameters, indent=2)
82
- table.append(("parameters", param_str))
83
-
84
- table.append(("queue", describe_interfaces(interface_defs, flow)))
85
-
86
- print(tabulate.tabulate(
87
- table,
88
- tablefmt="pretty",
89
- stralign="left",
90
- ))
91
- print()
92
-
93
- def main():
94
-
95
- parser = argparse.ArgumentParser(
96
- prog='tg-show-flows',
97
- description=__doc__,
98
- )
99
-
100
- parser.add_argument(
101
- '-u', '--api-url',
102
- default=default_url,
103
- help=f'API URL (default: {default_url})',
104
- )
105
-
106
- args = parser.parse_args()
107
-
108
- try:
109
-
110
- show_flows(
111
- url=args.api_url,
112
- )
113
-
114
- except Exception as e:
115
-
116
- print("Exception:", e, flush=True)
117
-
118
- if __name__ == "__main__":
119
- main()
@@ -1 +0,0 @@
1
- __version__ = "1.4.13"