Skip to main content

Getting Started

The quickest method of interacting with TrustGraph while running is the TrustGraph CLI. To install the CLI:

pip3 install trustgraph-cli==<desired-version>
note

It's best to match the TrustGraph CLI version to the TrustGraph version being deployed.

Below is a list of TrustGraph CLI commands:

  • tg-graph-show
  • tg-graph-to-turtle
  • tg-init-pulsar
  • tg-invoke-agent
  • tg-invoke-llm
  • tg-invoke-prompt
  • tg-load-pdf
  • tg-load-text
  • tg-load-turtle
  • tg-processor-state
  • tg-query-document-rag
  • tg-query-graph-rag

Pulsar Management​

tg-init-pulsar​

tg-init-pulsar --help
usage: tg-init-pulsar [-h] [-p PULSAR_ADMIN_URL]

Initialises Pulsar with Trustgraph tenant / namespaces & policy

options:
-h, --help show this help message and exit
-p PULSAR_ADMIN_URL, --pulsar-admin-url PULSAR_ADMIN_URL
Pulsar admin URL (default: http://pulsar:8080)

TrustGraph Services State​

tg-processor-state​

tg-processor-state --help
usage: tg-processor-state [-h] [-p PROMETHEUS_URL]

Dump out TrustGraph processor states.

options:
-h, --help show this help message and exit
-p PROMETHEUS_URL, --prometheus-url PROMETHEUS_URL
Prometheus URL (default: http://localhost:9090)

Document Loaders​

tg-load-pdf​

tg-load-pdf --help
usage: loader [-h] [-p PULSAR_HOST] [-o OUTPUT_QUEUE] [-u USER] [-c COLLECTION] [--name NAME] [--description DESCRIPTION]
[--copyright-notice COPYRIGHT_NOTICE] [--copyright-holder COPYRIGHT_HOLDER] [--copyright-year COPYRIGHT_YEAR] [--license LICENSE]
[--publication-organization PUBLICATION_ORGANIZATION] [--publication-description PUBLICATION_DESCRIPTION]
[--publication-date PUBLICATION_DATE] [--url URL] [--keyword KEYWORD [KEYWORD ...]] [--identifier IDENTIFIER] [-l {debug,info,warn,error}]
files [files ...]

Loads a PDF document into TrustGraph processing.

positional arguments:
files File to load

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-o OUTPUT_QUEUE, --output-queue OUTPUT_QUEUE
Output queue (default: persistent://tg/flow/document-load)
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)
--name NAME Document name
--description DESCRIPTION
Document description
--copyright-notice COPYRIGHT_NOTICE
Copyright notice
--copyright-holder COPYRIGHT_HOLDER
Copyright holder
--copyright-year COPYRIGHT_YEAR
Copyright year
--license LICENSE Copyright license
--publication-organization PUBLICATION_ORGANIZATION
Publication organization
--publication-description PUBLICATION_DESCRIPTION
Publication description
--publication-date PUBLICATION_DATE
Publication date
--url URL Document URL
--keyword KEYWORD [KEYWORD ...]
Keyword
--identifier IDENTIFIER, --id IDENTIFIER
Document ID
-l {debug,info,warn,error}, --log-level {debug,info,warn,error}
Output queue (default: info)

tg-load-text​

tg-load-text --help
usage: loader [-h] [-p PULSAR_HOST] [-o OUTPUT_QUEUE] [-u USER] [-c COLLECTION] [--name NAME] [--description DESCRIPTION]
[--copyright-notice COPYRIGHT_NOTICE] [--copyright-holder COPYRIGHT_HOLDER] [--copyright-year COPYRIGHT_YEAR] [--license LICENSE]
[--publication-organization PUBLICATION_ORGANIZATION] [--publication-description PUBLICATION_DESCRIPTION]
[--publication-date PUBLICATION_DATE] [--url URL] [--keyword KEYWORD [KEYWORD ...]] [--identifier IDENTIFIER] [-l {debug,info,warn,error}]
files [files ...]

Loads a text document into TrustGraph processing.

positional arguments:
files File to load

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-o OUTPUT_QUEUE, --output-queue OUTPUT_QUEUE
Output queue (default: persistent://tg/flow/text-document-load)
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)
--name NAME Document name
--description DESCRIPTION
Document description
--copyright-notice COPYRIGHT_NOTICE
Copyright notice
--copyright-holder COPYRIGHT_HOLDER
Copyright holder
--copyright-year COPYRIGHT_YEAR
Copyright year
--license LICENSE Copyright license
--publication-organization PUBLICATION_ORGANIZATION
Publication organization
--publication-description PUBLICATION_DESCRIPTION
Publication description
--publication-date PUBLICATION_DATE
Publication date
--url URL Document URL
--keyword KEYWORD [KEYWORD ...]
Keyword
--identifier IDENTIFIER, --id IDENTIFIER
Document ID
-l {debug,info,warn,error}, --log-level {debug,info,warn,error}
Output queue (default: info)

Knowledge Graph Store​

tg-graph-show​

tg-graph-show --help
usage: graph-show [-h] [-p PULSAR_HOST] [-u USER] [-c COLLECTION]

Connects to the graph query service and dumps all graph edges.

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)

tg-graph-to-turtle​

tg-graph-to-turtle --help
usage: graph-show [-h] [-p PULSAR_HOST]

Connects to the graph query service and dumps all graph edges.

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)

tg-load-turtle​

tg-load-turtle --help
usage: loader [-h] [-p PULSAR_HOST] [-o OUTPUT_QUEUE] [-u USER] [-c COLLECTION] [-l {debug,info,warn,error}] files [files ...]

Loads Graph embeddings into TrustGraph processing.

positional arguments:
files Turtle files to load

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-o OUTPUT_QUEUE, --output-queue OUTPUT_QUEUE
Output queue (default: persistent://tg/flow/triples-store)
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)
-l {debug,info,warn,error}, --log-level {debug,info,warn,error}
Output queue (default: info)

Prompt Services​

tg-invoke-llm​

tg-invoke-llm --help
usage: tg-invoke-llm [-h] [-p PULSAR_HOST] system prompt

Invokes the text completion service by specifying an LLM system prompt and user prompt. Both arguments are required.

positional arguments:
system LLM system prompt e.g. You are a helpful assistant
prompt LLM prompt e.g. What is 2 + 2?

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)

tg-invoke-prompt​

tg-invoke-prompt --help
usage: tg-invoke-prompt [-h] [-p PULSAR_HOST] id [term ...]

Invokes the LLM prompt service by specifying a prompt identifier and template terms. The prompt identifier identifies which prompt template to
use. Standard template identifiers are: question, extract-relationship. The prompt terms specify keyword terms in the template to be replaced, and
provide the values to replace them with.

positional arguments:
id Prompt identifier e.g. question
term Prompt template terms of the form key=value, can be specified multiple times

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)

RAG Queries​

tg-query-document-rag​

tg-query-document-rag --help
usage: tg-query-document-rag [-h] [-p PULSAR_HOST] -q QUERY [-u USER] [-c COLLECTION]

Uses the Document RAG service to answer a query

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-q QUERY, --query QUERY
Query to execute
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)

tg-query-graph-rag​

tg-query-graph-rag --help
usage: tg-graph-query-rag [-h] [-p PULSAR_HOST] -q QUERY [-u USER] [-c COLLECTION]

Uses the GraphRAG service to answer a query

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-q QUERY, --query QUERY
Query to execute
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)

Agent Flow​

tg-invoke-agent​

tg-invoke-agent --help
usage: tg-invoke-agent [-h] [-p PULSAR_HOST] -q QUERY [-u USER] [-c COLLECTION] [-l PLAN] [-s STATE] [-v]

Invoke the agent flow with a query

options:
-h, --help show this help message and exit
-p PULSAR_HOST, --pulsar-host PULSAR_HOST
Pulsar host (default: pulsar://localhost:6650)
-q QUERY, --query QUERY
Query to execute
-u USER, --user USER User ID (default: trustgraph)
-c COLLECTION, --collection COLLECTION
Collection ID (default: default)
-l PLAN, --plan PLAN Agent plan (default: unspecified)
-s STATE, --state STATE
Agent initial state (default: unspecified)
-v, --verbose Output thinking/observations