Minikube Deployment
Once you've selected a YAML
configuration, start Minikube
with:
minikube start --cpus=4 --memory=8192
Once Minikube
is running, launch TrustGraph
with:
kubectl apply -f <configuration-file.yaml>
Minikube
requires a driver. The most common is the Docker Engine
. Full Minikube driver documentation is here.
Launch the LoadBalancer​
Once all containers have been created, you must launch the LoadBalancer
to enable cluster communications with:
minikube tunnel
Once the LoadBalancer
is up, you will need to open a new terminal
window to the deploy/minikube-k8s
directory to continue interacting with TrustGraph
. The terminal
window running the LoadBalancer
must be left open. All commands will now take place in the second terminal
window going forward.
Verify TrustGraph Services​
On first running a K8s file, it may take a while (depending on your network connection) to pull all the necessary components. Once all of the components have been pulled, check that the TrustGraph services are running:
tg-processor-state
To watch the status of the services in 2 second increments:
watch tg-processor-state
On MacOS
, the watch
feature can be installed with Homebrew
:
brew install watch
Before proceeding, allow the system to stabilize. Wait until the STATUS
for all containers switches to Running
.
Load a Text Corpus​
Create a sources directory and get a test PDF file. To demonstrate the power of TrustGraph
, the provided script loads a PDF of the public Roger's Commision Report from the NASA Challenger disaster. This PDF includes complex formatting, unique terms, complex concepts, unique concepts, and information not commonly found in public knowledge sources.
mkdir sources
curl -o sources/Challenger-Report-Vol1.pdf https://sma.nasa.gov/SignificantIncidents/assets/rogers_commission_report.pdf
Load the file for knowledge extraction:
tg-load-pdf sources/Challenger-Report-Vol1.pdf
To load a text file, use the following script:
tg-load-text sources/<txt-file.txt>
Batch Loading​
Sets of PDF
or txt
files can be loaded at once with the loader script. Load all the files into a directory.
To load a batch of PDFs from a directory named sources
:
tg-load-pdf sources/*.pdf
To load a batch of text files from a directory named sources
:
tg-load-text sources/*.txt
Graph Parsing​
To check that the knowledge graph is successfully parsing data:
tg-graph-show
The output should be a set of semantic triples in N-Triples format.
http://trustgraph.ai/e/enterprise http://trustgraph.ai/e/was-carried to altitude and released for a gliding approach and landing at the Mojave Desert test center.
http://trustgraph.ai/e/enterprise http://www.w3.org/2000/01/rdf-schema#label Enterprise.
http://trustgraph.ai/e/enterprise http://www.w3.org/2004/02/skos/core#definition A prototype space shuttle orbiter used for atmospheric flight testing.
Number of Graph Edges​
N-Triples format is not particularly human readable. It's more useful to know how many graph edges have successfully been extracted from the text corpus:
tg-graph-show | wc -l
The Challenger report has a long introduction with quite a bit of adminstrative text commonly found in official reports. The first few hundred graph edges mostly capture this document formatting knowledge. To fully test the ability to extract complex knowledge, wait until at least 1000
graph edges have been extracted. The full extraction for this PDF will extract many thousand graph edges.
GraphRAG Test Query​
tg-query-graph-rag -q "Give me 20 facts about the space shuttle Challenger"
This script forms a LM prompt asking for 20 facts regarding the Challenger disaster. Depending on how many graph edges have been extracted, the response will be similar to:
Here are 20 facts from the provided knowledge graph about the Space Shuttle disaster:
1. **Space Shuttle Challenger was a Space Shuttle spacecraft.**
2. **The third Spacelab mission was carried by Orbiter Challenger.**
3. **Francis R. Scobee was the Commander of the Challenger crew.**
4. **Earth-to-orbit systems are designed to transport payloads and humans from Earth's surface into orbit.**
5. **The Space Shuttle program involved the Space Shuttle.**
6. **Orbiter Challenger flew on mission 41-B.**
7. **Orbiter Challenger was used on STS-7 and STS-8 missions.**
8. **Columbia completed the orbital test.**
9. **The Space Shuttle flew 24 successful missions.**
10. **One possibility for the Space Shuttle was a winged but unmanned recoverable liquid-fuel vehicle based on the Saturn 5 rocket.**
11. **A Commission was established to investigate the space shuttle Challenger accident.**
12. **Judit h Arlene Resnik was Mission Specialist Two.**
13. **Mission 51-L was originally scheduled for December 1985 but was delayed until January 1986.**
14. **The Corporation's Space Transportation Systems Division was responsible for the design and development of the Space Shuttle Orbiter.**
15. **Michael John Smith was the Pilot of the Challenger crew.**
16. **The Space Shuttle is composed of two recoverable Solid Rocket Boosters.**
17. **The Space Shuttle provides for the broadest possible spectrum of civil/military missions.**
18. **Mission 51-L consisted of placing one satellite in orbit, deploying and retrieving Spartan, and conducting six experiments.**
19. **The Space Shuttle became the focus of NASA's near-term future.**
20. **The Commission focused its attention on safety aspects of future flights.**
Custom GraphRAG Requests​
At any point, a GraphRAG
request can be generated and run with the following script:
tg-query-graph-rag -q "RAG request here"
Shutting Down TrustGraph​
When shutting down TrustGraph
, it's best to shut down all Docker containers and volumes. Run the docker compose down
command that corresponds to your model and graph store deployment:
kubectl delete -f <configuration-file.yaml>
To shut down Minikube
:
minikube stop