trustgraph-cli 2.11.6__tar.gz → 3.0.0rc1__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.
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/PKG-INFO +2 -2
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/pyproject.toml +8 -1
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_action.py +229 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_concept_extraction.py +113 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_document_decode.py +98 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_knowledge_retrieval.py +230 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_planner.py +138 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_policy.py +186 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli/invoke_verification.py +142 -0
- trustgraph_cli-3.0.0rc1/trustgraph/cli_version.py +1 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph_cli.egg-info/PKG-INFO +2 -2
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph_cli.egg-info/SOURCES.txt +7 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph_cli.egg-info/entry_points.txt +7 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph_cli.egg-info/requires.txt +1 -1
- trustgraph_cli-2.11.6/trustgraph/cli_version.py +0 -1
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/README.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/setup.cfg +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/__init__.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/_iam.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/add_library_document.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/bootstrap_iam.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/change_password.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/create_api_key.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/create_user.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/create_workspace.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_collection.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_config_item.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_kg_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_ontology.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_tool.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/delete_user.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/describe_image.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/disable_user.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/dump_msgpack.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/dump_queues.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/enable_user.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/export_workspace.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/export_workspace_config.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_config_item.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_de_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_document_content.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_kg_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/get_ontology.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/graph_to_turtle.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/import_workspace.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/import_workspace_config.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/init_pulsar_manager.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_agent.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_cloze.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_decision_scoring.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_document_embeddings.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_document_rag.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_embeddings.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_field_extraction.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_graph_embeddings.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_graph_rag.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_llm.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_nl_sparql.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_nlp_query.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_ontology_subset.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_prompt.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_reranker.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_row_embeddings.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_rows_query.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_sparql_nl_query.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_sparql_query.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/invoke_structured_query.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_api_keys.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_cloze_models.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_collections.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_config_items.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_explain_traces.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_models.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_my_workspaces.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_ontologies.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_users.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/list_workspaces.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_doc_embeds.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_kg_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_knowledge.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_sample_documents.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_structured_data.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/load_turtle.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/login.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/mint_token.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/monitor_prompts.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/nquads.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/put_config_item.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/put_de_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/put_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/put_kg_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/put_ontology.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/query_graph.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/remove_library_document.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/reset_password.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/revoke_api_key.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/__init__.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/belgian-beer.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/bronze-age-collapse.pdf +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/corporate-scandals.pdf +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/history-of-pets.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/metadata.json +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/mil-fortifications-america-19th-c.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/recipes.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/sample_documents/trade-routes-europe.md +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/save_doc_embeds.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/set_collection.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/set_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/set_prompt.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/set_token_costs.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/set_tool.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_config.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_explain_trace.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_extraction_provenance.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_flow_blueprints.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_flow_state.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_flows.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_graph.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_kg_cores.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_library_documents.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_library_processing.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_mcp_tools.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_parameter_types.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_processor_state.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_prompts.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_token_costs.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_token_rate.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/show_tools.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/start_flow.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/start_library_processing.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/stop_flow.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/stop_library_processing.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/unload_kg_core.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/update_user.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/verify_system_status.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph/cli/whoami.py +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
- {trustgraph_cli-2.11.6 → trustgraph_cli-3.0.0rc1}/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:
|
|
3
|
+
Version: 3.0.0rc1
|
|
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
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: Operating System :: OS Independent
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: trustgraph-base<
|
|
11
|
+
Requires-Dist: trustgraph-base<3.1,>=3.0
|
|
12
12
|
Requires-Dist: requests
|
|
13
13
|
Requires-Dist: pulsar-client
|
|
14
14
|
Requires-Dist: aiohttp
|
|
@@ -10,7 +10,7 @@ description = "TrustGraph provides a means to run a pipeline of flexible AI proc
|
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
12
|
dependencies = [
|
|
13
|
-
"trustgraph-base>=
|
|
13
|
+
"trustgraph-base>=3.0,<3.1",
|
|
14
14
|
"requests",
|
|
15
15
|
"pulsar-client",
|
|
16
16
|
"aiohttp",
|
|
@@ -62,12 +62,19 @@ tg-list-my-workspaces = "trustgraph.cli.list_my_workspaces:main"
|
|
|
62
62
|
tg-create-workspace = "trustgraph.cli.create_workspace:main"
|
|
63
63
|
tg-list-models = "trustgraph.cli.list_models:main"
|
|
64
64
|
tg-invoke-agent = "trustgraph.cli.invoke_agent:main"
|
|
65
|
+
tg-invoke-planner = "trustgraph.cli.invoke_planner:main"
|
|
66
|
+
tg-invoke-verification = "trustgraph.cli.invoke_verification:main"
|
|
67
|
+
tg-invoke-policy = "trustgraph.cli.invoke_policy:main"
|
|
68
|
+
tg-invoke-action = "trustgraph.cli.invoke_action:main"
|
|
65
69
|
tg-invoke-document-rag = "trustgraph.cli.invoke_document_rag:main"
|
|
66
70
|
tg-invoke-graph-rag = "trustgraph.cli.invoke_graph_rag:main"
|
|
67
71
|
tg-invoke-llm = "trustgraph.cli.invoke_llm:main"
|
|
68
72
|
tg-list-cloze-models = "trustgraph.cli.list_cloze_models:main"
|
|
73
|
+
tg-invoke-concept-extraction = "trustgraph.cli.invoke_concept_extraction:main"
|
|
74
|
+
tg-invoke-knowledge-retrieval = "trustgraph.cli.invoke_knowledge_retrieval:main"
|
|
69
75
|
tg-invoke-cloze = "trustgraph.cli.invoke_cloze:main"
|
|
70
76
|
tg-invoke-decision-scoring = "trustgraph.cli.invoke_decision_scoring:main"
|
|
77
|
+
tg-invoke-document-decode = "trustgraph.cli.invoke_document_decode:main"
|
|
71
78
|
tg-invoke-field-extract = "trustgraph.cli.invoke_field_extraction:main"
|
|
72
79
|
tg-invoke-embeddings = "trustgraph.cli.invoke_embeddings:main"
|
|
73
80
|
tg-invoke-graph-embeddings = "trustgraph.cli.invoke_graph_embeddings:main"
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Invoke the action worker with a capability and parameters.
|
|
3
|
+
Displays the resulting artifact.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
from trustgraph.api import Api
|
|
11
|
+
|
|
12
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
13
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
14
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main():
|
|
18
|
+
|
|
19
|
+
parser = argparse.ArgumentParser(
|
|
20
|
+
prog='tg-invoke-action',
|
|
21
|
+
description=__doc__,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
'-u', '--url',
|
|
26
|
+
default=default_url,
|
|
27
|
+
help=f'API URL (default: {default_url})',
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
'-t', '--token',
|
|
32
|
+
default=default_token,
|
|
33
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
'-w', '--workspace',
|
|
38
|
+
default=default_workspace,
|
|
39
|
+
help=f'Workspace (default: {default_workspace})',
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
'-f', '--flow-id',
|
|
44
|
+
default="default",
|
|
45
|
+
help='Flow ID (default: default)',
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
parser.add_argument(
|
|
49
|
+
'-r', '--run-id',
|
|
50
|
+
default="run-cli",
|
|
51
|
+
help='Run ID (default: run-cli)',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
'-s', '--step-id',
|
|
56
|
+
default="step-cli",
|
|
57
|
+
help='Step ID (default: step-cli)',
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
'-j', '--json',
|
|
62
|
+
action='store_true',
|
|
63
|
+
help='Output as JSON',
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
'-p', '--param',
|
|
68
|
+
action='append',
|
|
69
|
+
default=[],
|
|
70
|
+
metavar='KEY=VALUE',
|
|
71
|
+
help='Step parameter (repeatable)',
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
parser.add_argument(
|
|
75
|
+
'-i', '--input-artifact',
|
|
76
|
+
action='append',
|
|
77
|
+
default=[],
|
|
78
|
+
metavar='TYPE:FILE',
|
|
79
|
+
help='Input artifact as TYPE:FILE e.g. TabularArtifact:data.json (repeatable)',
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
parser.add_argument(
|
|
83
|
+
'capability',
|
|
84
|
+
help='Capability to invoke (e.g. erp-finance-query)',
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
args = parser.parse_args()
|
|
88
|
+
|
|
89
|
+
params = {}
|
|
90
|
+
for p in args.param:
|
|
91
|
+
if '=' not in p:
|
|
92
|
+
print(f"Error: parameter must be KEY=VALUE: {p}", file=sys.stderr)
|
|
93
|
+
sys.exit(1)
|
|
94
|
+
key, value = p.split('=', 1)
|
|
95
|
+
params[key] = value
|
|
96
|
+
|
|
97
|
+
input_artifacts = []
|
|
98
|
+
for spec in args.input_artifact:
|
|
99
|
+
if ':' not in spec:
|
|
100
|
+
print(
|
|
101
|
+
f"Error: input artifact must be TYPE:FILE: {spec}",
|
|
102
|
+
file=sys.stderr,
|
|
103
|
+
)
|
|
104
|
+
sys.exit(1)
|
|
105
|
+
artifact_type, path = spec.split(':', 1)
|
|
106
|
+
with open(path) as f:
|
|
107
|
+
input_artifacts.append({
|
|
108
|
+
"artifact-type": artifact_type,
|
|
109
|
+
"artifact": json.load(f),
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
try:
|
|
113
|
+
|
|
114
|
+
api = Api(
|
|
115
|
+
url=args.url, token=args.token, workspace=args.workspace,
|
|
116
|
+
)
|
|
117
|
+
socket = api.socket()
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
result = socket._send_request_sync(
|
|
121
|
+
"action", args.flow_id,
|
|
122
|
+
{
|
|
123
|
+
"run-id": args.run_id,
|
|
124
|
+
"step-id": args.step_id,
|
|
125
|
+
"capability": args.capability,
|
|
126
|
+
"params": params,
|
|
127
|
+
"input-artifacts": input_artifacts,
|
|
128
|
+
},
|
|
129
|
+
)
|
|
130
|
+
finally:
|
|
131
|
+
socket.close()
|
|
132
|
+
|
|
133
|
+
if result.get("error"):
|
|
134
|
+
err = result["error"]
|
|
135
|
+
print(
|
|
136
|
+
f"Error: [{err.get('type', '?')}] {err.get('message', '?')}",
|
|
137
|
+
file=sys.stderr,
|
|
138
|
+
)
|
|
139
|
+
sys.exit(1)
|
|
140
|
+
|
|
141
|
+
if args.json:
|
|
142
|
+
print(json.dumps(result, indent=2))
|
|
143
|
+
else:
|
|
144
|
+
artifact_type = result.get("artifact-type", "?")
|
|
145
|
+
artifact = result.get("artifact", {})
|
|
146
|
+
|
|
147
|
+
print(f"Artifact type: {artifact_type}")
|
|
148
|
+
print()
|
|
149
|
+
|
|
150
|
+
if artifact_type == "TabularArtifact":
|
|
151
|
+
_print_tabular(artifact)
|
|
152
|
+
elif artifact_type == "TextBlobArtifact":
|
|
153
|
+
_print_text_blob(artifact)
|
|
154
|
+
elif artifact_type == "SubgraphArtifact":
|
|
155
|
+
_print_subgraph(artifact)
|
|
156
|
+
elif artifact_type == "ReportArtifact":
|
|
157
|
+
_print_report(artifact)
|
|
158
|
+
else:
|
|
159
|
+
print(json.dumps(artifact, indent=2))
|
|
160
|
+
|
|
161
|
+
except Exception as e:
|
|
162
|
+
print("Exception:", e, flush=True)
|
|
163
|
+
sys.exit(1)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _print_tabular(artifact):
|
|
167
|
+
columns = artifact.get("columns", [])
|
|
168
|
+
rows = artifact.get("rows", [])
|
|
169
|
+
col_names = [c.get("name", "?") for c in columns]
|
|
170
|
+
|
|
171
|
+
if not col_names:
|
|
172
|
+
print("(empty table)")
|
|
173
|
+
return
|
|
174
|
+
|
|
175
|
+
try:
|
|
176
|
+
import tabulate
|
|
177
|
+
table = [
|
|
178
|
+
[row.get(c, "") for c in col_names]
|
|
179
|
+
for row in rows
|
|
180
|
+
]
|
|
181
|
+
print(tabulate.tabulate(
|
|
182
|
+
table,
|
|
183
|
+
headers=col_names,
|
|
184
|
+
tablefmt="pretty",
|
|
185
|
+
stralign="left",
|
|
186
|
+
))
|
|
187
|
+
except ImportError:
|
|
188
|
+
print(" | ".join(col_names))
|
|
189
|
+
print(" | ".join("---" for _ in col_names))
|
|
190
|
+
for row in rows:
|
|
191
|
+
print(" | ".join(str(row.get(c, "")) for c in col_names))
|
|
192
|
+
|
|
193
|
+
print(f"\n{len(rows)} rows")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _print_text_blob(artifact):
|
|
197
|
+
text = artifact.get("text", "")
|
|
198
|
+
print(text)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def _print_subgraph(artifact):
|
|
202
|
+
triples = artifact.get("triples", [])
|
|
203
|
+
summary = artifact.get("summary", "")
|
|
204
|
+
|
|
205
|
+
if summary:
|
|
206
|
+
print("Summary:")
|
|
207
|
+
print(summary)
|
|
208
|
+
print()
|
|
209
|
+
|
|
210
|
+
print(f"Triples ({len(triples)}):")
|
|
211
|
+
for t in triples[:20]:
|
|
212
|
+
s = t.get("s", "?")
|
|
213
|
+
p = t.get("p", "?")
|
|
214
|
+
o = t.get("o", "?")
|
|
215
|
+
print(f" {s} {p} {o}")
|
|
216
|
+
if len(triples) > 20:
|
|
217
|
+
print(f" ... and {len(triples) - 20} more")
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def _print_report(artifact):
|
|
221
|
+
fmt = artifact.get("format", "?")
|
|
222
|
+
narrative = artifact.get("narrative", "")
|
|
223
|
+
print(f"Format: {fmt}")
|
|
224
|
+
print()
|
|
225
|
+
print(narrative)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
if __name__ == "__main__":
|
|
229
|
+
main()
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Invoke the concept extraction service with a natural-language query.
|
|
3
|
+
Displays the extracted concepts.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
from trustgraph.api import Api
|
|
11
|
+
|
|
12
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
13
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
14
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main():
|
|
18
|
+
|
|
19
|
+
parser = argparse.ArgumentParser(
|
|
20
|
+
prog='tg-invoke-concept-extraction',
|
|
21
|
+
description=__doc__,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
'-u', '--url',
|
|
26
|
+
default=default_url,
|
|
27
|
+
help=f'API URL (default: {default_url})',
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
'-t', '--token',
|
|
32
|
+
default=default_token,
|
|
33
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
'-w', '--workspace',
|
|
38
|
+
default=default_workspace,
|
|
39
|
+
help=f'Workspace (default: {default_workspace})',
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
'-f', '--flow-id',
|
|
44
|
+
default="default",
|
|
45
|
+
help='Flow ID (default: default)',
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
parser.add_argument(
|
|
49
|
+
'-j', '--json',
|
|
50
|
+
action='store_true',
|
|
51
|
+
help='Output as JSON',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
'query',
|
|
56
|
+
nargs='?',
|
|
57
|
+
help='Query text (or read from stdin)',
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
args = parser.parse_args()
|
|
61
|
+
|
|
62
|
+
if args.query:
|
|
63
|
+
query = args.query
|
|
64
|
+
else:
|
|
65
|
+
if sys.stdin.isatty():
|
|
66
|
+
print("Enter query (Ctrl-D to finish):", file=sys.stderr)
|
|
67
|
+
query = sys.stdin.read().strip()
|
|
68
|
+
|
|
69
|
+
if not query:
|
|
70
|
+
print("Error: no query provided", file=sys.stderr)
|
|
71
|
+
sys.exit(1)
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
|
|
75
|
+
api = Api(
|
|
76
|
+
url=args.url, token=args.token, workspace=args.workspace,
|
|
77
|
+
)
|
|
78
|
+
socket = api.socket()
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
result = socket._send_request_sync(
|
|
82
|
+
"concept-extraction", args.flow_id,
|
|
83
|
+
{
|
|
84
|
+
"query": query,
|
|
85
|
+
},
|
|
86
|
+
)
|
|
87
|
+
finally:
|
|
88
|
+
socket.close()
|
|
89
|
+
|
|
90
|
+
if result.get("error"):
|
|
91
|
+
err = result["error"]
|
|
92
|
+
print(
|
|
93
|
+
f"Error: [{err.get('type', '?')}] {err.get('message', '?')}",
|
|
94
|
+
file=sys.stderr,
|
|
95
|
+
)
|
|
96
|
+
sys.exit(1)
|
|
97
|
+
|
|
98
|
+
if args.json:
|
|
99
|
+
print(json.dumps(result, indent=2))
|
|
100
|
+
else:
|
|
101
|
+
concepts = result.get("concepts", [])
|
|
102
|
+
print(f"Concepts ({len(concepts)}):")
|
|
103
|
+
print()
|
|
104
|
+
for i, concept in enumerate(concepts, 1):
|
|
105
|
+
print(f" {i}. {concept}")
|
|
106
|
+
|
|
107
|
+
except Exception as e:
|
|
108
|
+
print("Exception:", e, flush=True)
|
|
109
|
+
sys.exit(1)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if __name__ == "__main__":
|
|
113
|
+
main()
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Invokes the document decoder service. Sends a document ID to docling
|
|
3
|
+
for conversion and returns the decoded sections as librarian references.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import os
|
|
8
|
+
from trustgraph.api import Api
|
|
9
|
+
|
|
10
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
11
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
12
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
13
|
+
|
|
14
|
+
def run(url, flow_id, document_id, mode, token=None, workspace="default"):
|
|
15
|
+
|
|
16
|
+
api = Api(url=url, token=token, workspace=workspace)
|
|
17
|
+
socket = api.socket()
|
|
18
|
+
flow = socket.flow(flow_id)
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
sections = flow.document_decode(
|
|
22
|
+
document_id=document_id,
|
|
23
|
+
mode=mode,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
print(f"Decoded {len(sections)} section(s):")
|
|
27
|
+
for s in sections:
|
|
28
|
+
page_info = f" (page {s['page']})" if s['page'] else ""
|
|
29
|
+
print(
|
|
30
|
+
f" {s['section_type']}{page_info}: "
|
|
31
|
+
f"{s['document_id']}"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
finally:
|
|
35
|
+
socket.close()
|
|
36
|
+
|
|
37
|
+
def main():
|
|
38
|
+
|
|
39
|
+
parser = argparse.ArgumentParser(
|
|
40
|
+
prog='tg-invoke-document-decode',
|
|
41
|
+
description=__doc__,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
parser.add_argument(
|
|
45
|
+
'-u', '--url',
|
|
46
|
+
default=default_url,
|
|
47
|
+
help=f'API URL (default: {default_url})',
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
'-t', '--token',
|
|
52
|
+
default=default_token,
|
|
53
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
'-w', '--workspace',
|
|
58
|
+
default=default_workspace,
|
|
59
|
+
help=f'Workspace (default: {default_workspace})',
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
'-f', '--flow-id',
|
|
64
|
+
default="default",
|
|
65
|
+
help=f'Flow ID (default: default)'
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
parser.add_argument(
|
|
69
|
+
'-m', '--mode',
|
|
70
|
+
default='page',
|
|
71
|
+
choices=['page', 'hybrid'],
|
|
72
|
+
help='Decoding mode (default: page)',
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
parser.add_argument(
|
|
76
|
+
'document_id',
|
|
77
|
+
help='Librarian document ID to decode',
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
args = parser.parse_args()
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
|
|
84
|
+
run(
|
|
85
|
+
url=args.url,
|
|
86
|
+
flow_id=args.flow_id,
|
|
87
|
+
document_id=args.document_id,
|
|
88
|
+
mode=args.mode,
|
|
89
|
+
token=args.token,
|
|
90
|
+
workspace=args.workspace,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
except Exception as e:
|
|
94
|
+
|
|
95
|
+
print("Exception:", e, flush=True)
|
|
96
|
+
|
|
97
|
+
if __name__ == "__main__":
|
|
98
|
+
main()
|