mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 12:41:02 +02:00
Structured data loader CLI
This commit is contained in:
parent
4ad462ff95
commit
2dee259dc7
1 changed files with 10 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ def load_structured_data(
|
|||
sample_size: int = 100,
|
||||
sample_chars: int = 500,
|
||||
schema_name: str = None,
|
||||
flow: str = 'default',
|
||||
dry_run: bool = False,
|
||||
verbose: bool = False
|
||||
):
|
||||
|
|
@ -547,7 +548,7 @@ def load_structured_data(
|
|||
logger.info(f"Successfully loaded {len(schemas)} schema definitions")
|
||||
|
||||
# Generate descriptor using diagnose-structured-data prompt
|
||||
flow_api = api.flow().id("default")
|
||||
flow_api = api.flow().id(flow)
|
||||
|
||||
logger.info("Calling TrustGraph diagnose-structured-data prompt for descriptor generation...")
|
||||
response = flow_api.prompt(
|
||||
|
|
@ -817,7 +818,7 @@ def load_structured_data(
|
|||
|
||||
# Convert HTTP URL to WebSocket URL if needed
|
||||
ws_url = api_url.replace("http://", "ws://").replace("https://", "wss://")
|
||||
objects_url = ws_url + "api/v1/flow/default/import/objects"
|
||||
objects_url = ws_url + f"api/v1/flow/{flow}/import/objects"
|
||||
|
||||
logger.info(f"Connecting to objects import endpoint: {objects_url}")
|
||||
|
||||
|
|
@ -904,6 +905,12 @@ For more information on the descriptor format, see:
|
|||
help=f'TrustGraph API URL (default: {default_url})'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--flow',
|
||||
default='default',
|
||||
help='TrustGraph flow name to use for import (default: default)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-i', '--input',
|
||||
required=True,
|
||||
|
|
@ -1020,6 +1027,7 @@ For more information on the descriptor format, see:
|
|||
sample_size=args.sample_size,
|
||||
sample_chars=args.sample_chars,
|
||||
schema_name=args.schema_name,
|
||||
flow=args.flow,
|
||||
dry_run=args.dry_run,
|
||||
verbose=args.verbose
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue