### Start MCP Server
Source: https://docs.trustgraph.ai/guides/mcp-integration
This command initiates the MCP server. Ensure Python 3 is installed. The server will provide output indicating its status and the port it's running on (default 9870).
```shell
python3 server.py
```
--------------------------------
### Start Flow with CLI Parameters
Source: https://docs.trustgraph.ai/reference/configuration/flow-blueprints
Example of initiating a flow via the command line interface, demonstrating how user-provided parameters override default configuration values.
```bash
tg-start-flow -n my-flow -i flow1 -d "Test" --param llm-model=claude-3-opus
```
--------------------------------
### Clone and Set Up TrustGraph Repository
Source: https://docs.trustgraph.ai/contributing/development-setup
Clones the TrustGraph repository, checks out a specific release branch, and sets up a Python virtual environment for development. Ensure to replace `release/v1.8` with the desired version.
```bash
git clone https://github.com/trustgraph-ai/trustgraph.git
cd trustgraph
# Check out the latest release branch (not main)
git checkout release/v1.8
# Create a Python virtual environment
python3 -m venv env
source env/bin/activate
```
--------------------------------
### Install TrustGraph CLI Tools
Source: https://docs.trustgraph.ai/deployment/compose.html
Instructions to create a Python virtual environment and install the specific version of the TrustGraph CLI tool required for the deployment.
```bash
python3 -m venv env
. env/bin/activate
pip install trustgraph-cli==1.8.9
```
--------------------------------
### Verify Node.js Installation
Source: https://docs.trustgraph.ai/deployment/azure
Commands to verify that Node.js and npm are correctly installed on the system.
```bash
node --version
npm --version
```
--------------------------------
### Install Project Dependencies
Source: https://docs.trustgraph.ai/deployment/azure
Installs the required Node.js dependencies for the Pulumi project.
```bash
npm install
```
--------------------------------
### Troubleshoot Instance Container Start Failures
Source: https://docs.trustgraph.ai/deployment/aws-ec2
Steps to diagnose and resolve issues where an instance launches but its containers fail to start. This involves SSHing into the instance, checking container status, and reviewing logs.
```bash
ssh -i ssh-private.key ubuntu@$(pulumi stack output instanceIp)
sudo podman ps -a
sudo journalctl -u podman-compose -n 100
```
--------------------------------
### Launch TrustGraph with Docker Compose
Source: https://docs.trustgraph.ai/contributing/development-setup
Starts the TrustGraph system using Docker Compose. Assumes a `docker-compose.yaml` file has been generated via the Configuration UI. This command runs the services in detached mode.
```bash
docker-compose up -d
```
--------------------------------
### Clone Repository and Install Dependencies
Source: https://docs.trustgraph.ai/deployment/aws-ec2
Downloads the Pulumi infrastructure code from the repository and installs the necessary Node.js dependencies.
```shell
git clone https://github.com/trustgraph-ai/pulumi-trustgraph-ec2.git
cd pulumi-trustgraph-ec2/pulumi
npm install
```
--------------------------------
### Install and Initialize Google Cloud CLI
Source: https://docs.trustgraph.ai/deployment/gcp
Installation commands for the gcloud CLI across different operating systems and the initialization process.
```bash
# Linux
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
# MacOS
brew install --cask google-cloud-sdk
gcloud init
# Verify
gcloud version
```
--------------------------------
### RDF Turtle Syntax Example
Source: https://docs.trustgraph.ai/reference/cli/tg-load-knowledge
This snippet illustrates the standard RDF Turtle syntax used for defining triples. It includes prefix declarations and examples of defining classes and individuals with properties.
```turtle
@prefix ex: .
@prefix rdf: .
ex:Person rdf:type rdfs:Class .
ex:john rdf:type ex:Person ;
ex:name "John Doe" ;
ex:age "30"^^xsd:integer .
```
--------------------------------
### Install Pulumi Infrastructure as Code Tool
Source: https://docs.trustgraph.ai/deployment/gcp
Installation commands for Pulumi on Linux and MacOS, used for managing cloud infrastructure.
```bash
# Linux
curl -fsSL https://get.pulumi.com | sh
# MacOS
brew install pulumi/tap/pulumi
# Verify
pulumi version
```
--------------------------------
### Basic SDL Field Mapping Example
Source: https://docs.trustgraph.ai/reference/sdl
A minimal SDL configuration snippet demonstrating a basic field mapping with a single transformation. This is useful for starting simple and incrementally adding complexity.
```json
{
"mappings": [
{
"target_field": "name",
"source": "customer_name",
"transforms": [{"type": "trim"}]
}
]
}
```
--------------------------------
### Start EC2 Instance
Source: https://docs.trustgraph.ai/deployment/aws-ec2
Starts a stopped EC2 instance. It retrieves the instance ID using Pulumi stack outputs, starts the instance, waits for it to be in a running state, and optionally retrieves the new public IP address.
```bash
# Get instance ID from Pulumi
INSTANCE_ID=$(pulumi stack output instanceId)
# Start instance
aws ec2 start-instances --instance-ids $INSTANCE_ID
# Wait for running state
aws ec2 wait instance-running --instance-ids $INSTANCE_ID
# Get new IP (if not using Elastic IP)
aws ec2 describe-instances --instance-ids $INSTANCE_ID \
--query 'Reservations[0].Instances[0].PublicIpAddress'
```
--------------------------------
### Verify Environment Dependencies
Source: https://docs.trustgraph.ai/deployment/gcp
Commands to verify the installation and version of Python, kubectl, and Node.js.
```bash
python3 --version
kubectl version --client
node --version
npm --version
```
--------------------------------
### Launch Local TrustGraph Build with Docker Compose
Source: https://docs.trustgraph.ai/contributing/development-setup
Stops and removes any running TrustGraph instance, then relaunches it using the locally built containers. This performs a full wipe and restart of the system.
```bash
docker-compose down -v -t 0
docker-compose up -d
```
--------------------------------
### POST /flows
Source: https://docs.trustgraph.ai/guides/building/document-management-cli
Starts a new flow instance based on a specified blueprint.
```APIDOC
## POST /flows
### Description
Initializes and starts a new flow instance using a predefined blueprint.
### Method
POST
### Endpoint
/flows
### Request Body
- **name** (string) - Required - The name of the flow blueprint to use.
- **id** (string) - Required - Unique identifier for the new flow instance.
- **description** (string) - Optional - A brief description of the flow instance.
### Request Example
{
"name": "graph-rag",
"id": "my-graph-flow-01",
"description": "Processing graph data for project X"
}
```
--------------------------------
### Install trustgraph-react-state with npm, yarn, or pnpm
Source: https://docs.trustgraph.ai/guides/building/typescript-libraries
Instructions for installing the trustgraph-react-state library and its peer dependency @tanstack/react-query using different package managers.
```bash
npm install trustgraph-react-state @tanstack/react-query
```
```bash
yarn add trustgraph-react-state @tanstack/react-query
```
```bash
pnpm add trustgraph-react-state @tanstack/react-query
```
--------------------------------
### Manually install local namespace packages
Source: https://docs.trustgraph.ai/contributing/development-workflow.html
Instructions for installing local TrustGraph packages when standard editable installs are not supported due to namespace configuration.
```bash
pip install ./trustgraph-base
pip install ./trustgraph-flow
```
--------------------------------
### Install TrustGraph Python SDK
Source: https://docs.trustgraph.ai/guides/building/python-api
Instructions for installing the trustgraph-base package using various Python package managers. Supports standard installation and specific version pinning.
```pip
pip install trustgraph-base
pip install trustgraph-base==1.8.10
```
```uv
uv pip install trustgraph-base
uv pip install trustgraph-base==1.8.10
```
```poetry
poetry add trustgraph-base
poetry add trustgraph-base@1.8.10
```
--------------------------------
### Install trustgraph-react-provider and trustgraph-client
Source: https://docs.trustgraph.ai/guides/building/typescript-libraries
Installs the trustgraph-react-provider along with the core trustgraph-client. This provider is a React Context wrapper for seamless integration of the TrustGraph client into React applications.
```bash
npm install trustgraph-react-provider trustgraph-client
```
```bash
yarn add trustgraph-react-provider trustgraph-client
```
```bash
pnpm add trustgraph-react-provider trustgraph-client
```
--------------------------------
### Complete Text Analysis Processor Example
Source: https://docs.trustgraph.ai/reference/extending/flow-specifications
A complete FlowProcessor example that integrates multiple client specifications (PromptClient, EmbeddingsClient) and configuration settings to perform text analysis. It defines input consumers and output producers.
```python
from trustgraph.base import FlowProcessor, ConsumerSpec, ProducerSpec
from trustgraph.base import PromptClientSpec, EmbeddingsClientSpec, SettingSpec
from trustgraph.schema import TextChunk, ProcessedData
class TextAnalysisProcessor(FlowProcessor):
def __init__(self, **params):
super().__init__(**params)
# Input consumer
self.register_specification(
ConsumerSpec(
name="input",
schema=TextChunk,
handler=self.on_text_chunk,
concurrency=2
)
)
# Output producer
self.register_specification(
ProducerSpec(
name="output",
schema=ProcessedData
)
)
# LLM prompt client
self.register_specification(
PromptClientSpec(
request_name="prompt-request",
response_name="prompt-response"
)
)
# Embeddings client
self.register_specification(
EmbeddingsClientSpec(
request_name="embeddings-request",
response_name="embeddings-response"
)
)
# Configuration setting
self.register_specification(
SettingSpec(name="analysis_mode")
)
async def on_text_chunk(self, msg, consumer, flow):
"""Process text chunks with analysis"""
chunk = msg.value()
text = chunk.text
# Get configuration
mode = flow.config["analysis_mode"].value
try:
# Extract entities using prompt service
entities = await flow("prompt-request").extract_definitions(
text=text,
timeout=300
)
# Generate embeddings
vectors = await flow("embeddings-request").embed(
text=[text],
timeout=30
)
# Create processed result
result = ProcessedData(
text=text,
entities=entities,
embeddings=vectors[0],
metadata=chunk.metadata,
mode=mode
)
# Send to output
await flow("output").send(result)
except Exception as e:
print(f"Processing error: {e}")
# Could send to error queue or log
def run():
TextAnalysisProcessor.launch("text-analysis", __doc__)
if __name__ == "__main__":
run()
```
--------------------------------
### Install Python Testing Dependencies
Source: https://docs.trustgraph.ai/contributing/development-setup
Installs the necessary Python packages for running unit, integration, and contract tests within the TrustGraph project. This includes pytest and its related plugins.
```bash
pip install pytest pytest-cov pytest-asyncio
```
--------------------------------
### Build and Install TrustGraph Python Packages
Source: https://docs.trustgraph.ai/contributing/development-setup
Updates package versions to match the current release branch and builds the Python packages. It then installs these local packages into the active virtual environment. Replace `1.8.0` with the exact version number.
```bash
make update-package-versions VERSION=1.8.0
pip install ./trustgraph-base
pip install ./trustgraph-cli
pip install ./trustgraph-flow
```
--------------------------------
### Create Entry Point for AsyncProcessor Service (Python)
Source: https://docs.trustgraph.ai/reference/extending/async-processor
Provides the standard entry point for launching an AsyncProcessor service. The `run` function utilizes the `launch` method of the service class, passing an ID and documentation string.
```python
def run():
YourService.launch("your-service-id", __doc__)
if __name__ == "__main__":
run()
```
--------------------------------
### Modify a Processor Log Message
Source: https://docs.trustgraph.ai/contributing/development-setup
An example of making a code change within a TrustGraph processor. This snippet shows how to add a custom log message to a processor's startup sequence.
```python
# In trustgraph-flow/trustgraph/flow/some_processor.py
log.info("Hello from my local build!")
```
--------------------------------
### Install MCP Library Dependencies
Source: https://docs.trustgraph.ai/guides/mcp-integration
Installs the required MCP Python library via pip to enable server development.
```shell
pip install mcp
```
--------------------------------
### Download and Load Document using CLI
Source: https://docs.trustgraph.ai/guides/context-cores-cli
Downloads an example document using wget and then loads it into the TrustGraph instance using the `tg-add-library-document` command. This prepares a document for knowledge core extraction.
```bash
wget -O README.cats https://raw.githubusercontent.com/trustgraph-ai/example-data/refs/heads/main/cats/README.cats
tg-add-library-document \
--name "README.cats" \
--description "Brief description of cats" \
--tags cats,animals \
--id https://trustgraph.ai/doc/readme-cats \
--kind text/plain \
README.cats
```
--------------------------------
### Initialize and Configure Pulumi Stack
Source: https://docs.trustgraph.ai/deployment/azure
Initializes a new Pulumi stack and sets the required Azure region and environment variables.
```bash
pulumi stack init dev
pulumi config set azure-native:location eastus
pulumi config set environment dev
```
--------------------------------
### Config Service: Get Specific Flow Definition (POST)
Source: https://docs.trustgraph.ai/reference/apis/rest.html
This example illustrates how to retrieve a specific flow definition using a POST request to the /api/v1/config endpoint. It specifies the 'get' operation, 'flow' type, and the key of the flow to retrieve.
```json
{
"operation": "get",
"type": "flow",
"keys": [
{
"flow-id": "your-flow-id"
}
]
}
```
--------------------------------
### Check Logs for Modified Component
Source: https://docs.trustgraph.ai/contributing/development-setup
Filters the logs of a specific TrustGraph component to verify that a code change, such as a modified log message, has been applied correctly.
```bash
docker-compose logs processor-name | grep "Hello from my local build"
```
--------------------------------
### Restart a Specific TrustGraph Component
Source: https://docs.trustgraph.ai/contributing/development-setup
Restarts only the modified component's container instead of the entire system. This is useful for quickly applying changes to a single service.
```bash
docker-compose down processor-name
docker-compose up -d processor-name
```
--------------------------------
### Initialize and Configure Pulumi Deployment
Source: https://docs.trustgraph.ai/deployment/gcp
Commands to clone the repository, install dependencies, and configure the Pulumi environment and stack settings for GCP.
```bash
git clone https://github.com/trustgraph-ai/pulumi-trustgraph-gke.git
cd pulumi-trustgraph-gke/pulumi
npm install
pulumi config set gcp:project YOUR_PROJECT_ID
pulumi login --local
export PULUMI_CONFIG_PASSPHRASE=
pulumi stack init dev
```
--------------------------------
### Define Complex MCP Tools
Source: https://docs.trustgraph.ai/guides/mcp-integration
Example of creating a custom MCP tool using Python decorators to perform calculations, which can then be integrated into the TrustGraph agent workflow.
```python
@mcp.tool()
def calculate_savings_timeline(target_amount: float, monthly_savings: float) -> dict:
"""Calculate how long it will take to save for a target amount"""
months_needed = int(target_amount / monthly_savings)
years = months_needed // 12
remaining_months = months_needed % 12
return {
"total_months": months_needed,
"years": years,
"additional_months": remaining_months,
"target_amount": target_amount,
"monthly_savings": monthly_savings
}
```
--------------------------------
### Automate MCP Tool Setup Script
Source: https://docs.trustgraph.ai/guides/mcp-integration
A shell script to automate the configuration of multiple MCP tool endpoints and verify their status within the TrustGraph system.
```bash
#!/bin/bash
# setup-mcp-tools.sh
echo "Setting up MCP tools for TrustGraph..."
# Configure MCP tools
echo "Configuring MCP tool endpoints..."
tg-set-mcp-tool --id get_current_time \
--tool-url "http://host.docker.internal:9870/mcp"
tg-set-mcp-tool --id get_tesla_list_prices \
--tool-url "http://host.docker.internal:9870/mcp"
tg-set-mcp-tool --id get_bank_balance \
--tool-url "http://host.docker.internal:9870/mcp"
# Verify MCP tools are configured
echo "Verifying MCP tool configuration..."
tg-show-mcp-tools
```
--------------------------------
### Rebuild Specific TrustGraph Containers
Source: https://docs.trustgraph.ai/contributing/development-setup
Rebuilds only the necessary TrustGraph container images after making changes, optimizing the build process. If unsure which containers were affected, rebuilding all is an option.
```bash
# Rebuild specific containers (e.g., flow)
make some-containers VERSION=1.8.0 CONTAINERS="flow"
# Or rebuild all containers if unsure
make container VERSION=1.8.0
```
--------------------------------
### Build TrustGraph Docker Containers
Source: https://docs.trustgraph.ai/contributing/development-setup
Builds the local Docker container images for TrustGraph. This command uses the specified version number, which should match the version expected by your `docker-compose.yaml` file.
```bash
make container VERSION=1.8.0
```
--------------------------------
### Clear Extraction Prompts Example
Source: https://docs.trustgraph.ai/guides/agent-extraction
Demonstrates the importance of clear and specific prompts for extraction. It contrasts a good, structured prompt with a vague one to illustrate effective prompt engineering.
```python
# Good: Specific and structured
prompt = """
Extract:
1. Company names and their executives
2. Financial metrics with time periods
3. Product names and features
Format as knowledge graph triples.
"""
# Avoid: Vague instructions
prompt = "Extract important information"
```
--------------------------------
### Config Service: Get Complete Configuration (POST)
Source: https://docs.trustgraph.ai/reference/apis/rest.html
This example demonstrates how to make a POST request to the /api/v1/config endpoint to retrieve the complete system configuration. The request body specifies the 'config' operation.
```json
{
"operation": "config"
}
```
--------------------------------
### Start Minikube Cluster
Source: https://docs.trustgraph.ai/deployment/minikube
Initializes a Minikube cluster with the specific CPU and memory requirements necessary to support TrustGraph AI components using the KVM2 driver.
```bash
minikube start --cpus=9 --memory=14848 --driver=kvm2
```
--------------------------------
### Configure Pulumi Environment and Stack
Source: https://docs.trustgraph.ai/deployment/aws-ec2
Sets up the AWS region, local state authentication, and initializes a new Pulumi stack for deployment.
```shell
pulumi config set aws:region us-east-1
pulumi login --local
export PULUMI_CONFIG_PASSPHRASE=
pulumi stack init dev
```
--------------------------------
### Parameter Value Substitution Example (JSON)
Source: https://docs.trustgraph.ai/reference/configuration/flow-blueprints
Illustrates the result of substituting a parameter value into a flow configuration. When a flow is started with a specific parameter, such as '--param model=gpt-4', the placeholder {param:model} is replaced with 'gpt-4' in the configuration.
```json
{
"config": {
"model": "gpt-4"
}
}
```
--------------------------------
### Initialize TrustGraph API Client
Source: https://docs.trustgraph.ai/guides/building/python-api
Demonstrates how to instantiate the TrustGraph API client using direct configuration, authentication tokens, or environment variables.
```python
from trustgraph.api import Api
import os
# Basic connection
api = Api(url='http://localhost:8088/')
# With authentication
api_auth = Api(url='http://localhost:8088/', token='your-token-here')
# Using environment variables
url = os.getenv('TRUSTGRAPH_URL', 'http://localhost:8088/')
token = os.getenv('TRUSTGRAPH_TOKEN', None)
api_env = Api(url=url, token=token)
```
--------------------------------
### JSON Service Request for Config Service
Source: https://docs.trustgraph.ai/reference/apis/websocket.html
Example JSON payloads for making requests to the TrustGraph config service. These requests can be used to list, get, put, or delete configuration items. The 'request' object's structure depends on the 'operation' and 'type' specified.
```json
{
"id": "req-1",
"service": "config",
"request": {
"operation": "list",
"type": "flow"
}
}
```
```json
{
"id": "req-2",
"service": "config",
"request": {
"operation": "get",
"keys": [
{
"type": "flow",
"key": "my-flow"
}
]
}
}
```
--------------------------------
### Unpack and Manage Deployment Configuration
Source: https://docs.trustgraph.ai/deployment/compose.html
Commands to list contents of a deployment ZIP file, create a working directory, and extract the configuration files for TrustGraph deployment.
```bash
unzip -l deploy.zip
mkdir -p ~/trustgraph
cd ~/trustgraph
unzip ~/Downloads/deploy.zip
```
--------------------------------
### JSON Service Request for Flow Service
Source: https://docs.trustgraph.ai/reference/apis/websocket.html
Example JSON payloads for interacting with the TrustGraph flow service. These requests support operations like starting, stopping, listing, and managing flow instances and blueprints. Specific parameters like 'flow-id' and 'blueprint-name' are required for certain operations.
```json
{
"id": "req-1",
"service": "flow",
"request": {
"operation": "list"
}
}
```
```json
{
"id": "req-2",
"service": "flow",
"request": {
"operation": "start",
"flow": "my-flow",
"blueprint": "default-blueprint"
}
}
```
--------------------------------
### Get JSON Output from tg-invoke-structured-query
Source: https://docs.trustgraph.ai/reference/cli/tg-invoke-structured-query
This example shows how to retrieve query results in JSON format using the `tg-invoke-structured-query` command. The `--format json` option is used to specify the desired output format, which is useful for API integration and further data processing.
```bash
tg-invoke-structured-query -q "List customers from London" --format json
```
--------------------------------
### Using Parameters in Flow Definitions (JSON)
Source: https://docs.trustgraph.ai/reference/configuration/flow-blueprints
Demonstrates how to define parameters within a flow blueprint using JSON. Parameters like 'model' can be referenced using the {param:name} syntax, allowing for dynamic configuration when starting a flow. The example shows a text-completion blueprint configured with a parameter.
```json
{
"parameters": {
"model": {
"type": "llm-model",
"order": 1
}
},
"blueprint": {
"text-completion:{blueprint}": {
"request": "non-persistent://tg/request/text-completion:{blueprint}",
"response": "non-persistent://tg/response/text-completion:{blueprint}",
"config": {
"model": "{param:model}"
}
}
}
}
```
--------------------------------
### Retrieve Outputs and Secure SSH Key
Source: https://docs.trustgraph.ai/deployment/aws-ec2
Fetches deployment outputs such as the instance IP and sets the required file permissions for the generated SSH private key.
```shell
pulumi stack output
chmod 600 ssh-private.key
```
--------------------------------
### Load Sample Documents into TrustGraph
Source: https://docs.trustgraph.ai/deployment/gcp
Initiates the process of downloading and caching sample documents from the internet into the TrustGraph library. This command is used for initial testing and populating the system with data.
```bash
tg-load-sample-documents
```
--------------------------------
### Configure Pulumi State and Environment
Source: https://docs.trustgraph.ai/deployment/azure
Sets up the local Pulumi state and configures the environment variable for secret encryption.
```bash
pulumi login --local
export PULUMI_CONFIG_PASSPHRASE=
```
--------------------------------
### Verify Schema Creation
Source: https://docs.trustgraph.ai/guides/structured-processing/schemas
Commands to list all existing schemas or retrieve details for a specific schema key. These are used to confirm that the configuration was successfully persisted.
```bash
# List all schemas
tg-list-config-items --type schema
# View specific schema details
tg-get-config-item --type schema --key cities
```
--------------------------------
### Clone and Initialize TrustGraph Repository
Source: https://docs.trustgraph.ai/deployment/azure
Clones the TrustGraph Azure Pulumi repository and navigates to the deployment directory.
```bash
git clone https://github.com/trustgraph-ai/pulumi-trustgraph-azure.git
cd pulumi-trustgraph-azure/pulumi
```
--------------------------------
### Run OpenVINO Model Server Container (Podman)
Source: https://docs.trustgraph.ai/deployment/intel-gpu.html
Launch the OpenVINO model server using Podman, mounting local models and exposing the necessary ports. This command ensures the server is accessible and configured for GPU usage.
```podman
podman run --user $(id -u):$(id -g) -d \
--device /dev/dri \
--group-add=$(stat -c "%g" /dev/dri/render* | head -n 1) \
--rm -p 7000:7000 \
-v $(pwd)/models:/models:rw \
-e HF_TOKEN=$HF_TOKEN \
docker.io/openvino/model_server:latest-gpu \
--source_model llmware/mistral-nemo-instruct-2407-ov \
--model_repository_path models \
--task text_generation \
--rest_port 7000 \
--target_device GPU \
--cache_size 2
```
--------------------------------
### Install TrustGraph SDK
Source: https://docs.trustgraph.ai/reference/apis/python
Installs the required TrustGraph package via pip.
```bash
pip install trustgraph
```
--------------------------------
### Verify Schema Configuration
Source: https://docs.trustgraph.ai/guides/structured-processing/load-file
Commands to list existing schemas or retrieve details for a specific schema to ensure successful creation.
```bash
# List all schemas
tg-list-config-items --type schema
# View specific schema details
tg-get-config-item --type schema --key pies
```
--------------------------------
### Install AWS CLI
Source: https://docs.trustgraph.ai/deployment/aws-rke
Commands to download and install the AWS Command Line Interface on Linux and macOS systems.
```bash
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
```
```bash
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
```
--------------------------------
### Basic React Setup with TrustGraphProvider and useGraphRag Hook
Source: https://docs.trustgraph.ai/guides/building/typescript-libraries
Demonstrates how to set up the TrustGraphProvider with QueryClientProvider and use the useGraphRag hook within a React component for fetching data.
```javascript
import { TrustGraphProvider } from 'trustgraph-react-state';
import { useGraphRag } from 'trustgraph-react-state/hooks';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
// Create QueryClient
const queryClient = new QueryClient();
// Wrap your app with providers
function App() {
return (
);
}
// Use hooks in components
function QueryComponent() {
const { data, isLoading, error } = useGraphRag({
query: 'What is the scientific name for cats?',
user: 'trustgraph',
collection: 'default'
});
if (isLoading) return Loading...
;
if (error) return Error: {error.message}
;
return {data}
;
}
```
--------------------------------
### Load Knowledge Core via CLI
Source: https://docs.trustgraph.ai/reference/cli/tg-load-kg-core
Examples demonstrating how to load knowledge cores into TrustGraph flows using different configurations. These commands require a valid knowledge core identifier and support optional parameters for API endpoints, user authentication, and flow targeting.
```bash
tg-load-kg-core --id "research-knowledge-v1"
```
```bash
tg-load-kg-core \
--id "medical-knowledge" \
--flow-id "medical-analysis" \
--user researcher
```
```bash
tg-load-kg-core \
--id "legal-documents" \
--flow-id "legal-flow" \
--collection "law-firm-data"
```
```bash
tg-load-kg-core \
--id "production-knowledge" \
--flow-id "prod-flow" \
-u http://production:8088/
```