Skip to content

Quick Start

rUv edited this page Jul 31, 2025 · 1 revision

Quick Start Guide

Get up and running with FACT in 5 minutes! This guide covers the fastest path to using FACT across different platforms.

🚀 Choose Your Platform

Python Quick Start

1. Install FACT

# Install with pip
pip install fact-system

# Or clone and install
git clone https://github.com/ruvnet/FACT.git
cd FACT
pip install -r requirements.txt

2. Set API Keys

# Create .env file
cp .env.template .env

# Edit .env and add your keys
ANTHROPIC_API_KEY=your-anthropic-key
ARCADE_API_KEY=your-arcade-key

3. Initialize and Run

# Initialize the system
python main.py init

# Start interactive mode
python main.py

# Try your first query
💬 > What companies are in the technology sector?

4. Python Code Example

from src.core.driver import get_driver
import asyncio

async def main():
    # Initialize FACT
    driver = await get_driver()
    
    # Process a query
    response = await driver.process_query("What is TechCorp's revenue?")
    print(response)

asyncio.run(main())

Rust Quick Start

1. Install FACT

# Install from crates.io
cargo install fact-tools

# Verify installation
fact --version

2. Create Configuration

# Initialize config
fact init

# This creates fact.json
{
  "cache": {
    "max_size": 10000,
    "ttl_seconds": 3600
  },
  "templates": {
    "default": "analysis-basic"
  }
}

3. Process Your First Data

# Create sample data
echo '{"values": [1, 2, 3, 4, 5], "operation": "analyze"}' > data.json

# Process with FACT
fact process data.json --template analysis-basic

# Output shows statistical analysis
{
  "sum": 15,
  "average": 3.0,
  "min": 1,
  "max": 5,
  "count": 5
}

4. Rust Code Example

use fact_tools::{Fact, Template};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create FACT instance
    let fact = Fact::new();
    
    // Process data with template
    let data = json!({
        "values": vec![10, 20, 30, 40, 50],
        "operation": "analyze"
    });
    
    let result = fact.process(data, "analysis-basic").await?;
    println!("Result: {:?}", result);
    
    Ok(())
}

JavaScript Quick Start

1. Install FACT WASM

# Coming soon - NPM package
npm install fact-wasm

# Or use CDN
<script src="https://unpkg.com/fact-wasm/fact.js"></script>

2. Browser Setup

<!DOCTYPE html>
<html>
<head>
    <title>FACT Quick Start</title>
</head>
<body>
    <h1>FACT Demo</h1>
    <button id="process">Process Data</button>
    <div id="result"></div>

    <script type="module">
        import init, { FastCache, QueryProcessor } from './fact_wasm.js';

        async function main() {
            // Initialize WASM
            await init();
            
            // Create cache
            const cache = new FastCache(1000);
            
            // Create processor
            const processor = new QueryProcessor();
            
            // Process on button click
            document.getElementById('process').addEventListener('click', () => {
                const data = { values: [1, 2, 3, 4, 5] };
                const result = processor.analyze(JSON.stringify(data));
                document.getElementById('result').textContent = result;
            });
        }

        main();
    </script>
</body>
</html>

3. Node.js Setup

// fact-demo.js
const { FastCache, QueryProcessor } = require('fact-wasm');

async function main() {
    // Create cache instance
    const cache = new FastCache(1000);
    
    // Cache some data
    cache.set('key1', 'value1', 300); // TTL: 300 seconds
    
    // Retrieve data
    const value = cache.get('key1');
    console.log('Cached value:', value);
    
    // Process query
    const processor = new QueryProcessor();
    const result = processor.process(
        JSON.stringify({ query: "analyze data" })
    );
    console.log('Result:', result);
}

main();

🎯 Common Use Cases

Financial Data Analysis (Python)

# Analyze quarterly revenue
response = await driver.process_query(
    "Compare Q1 2025 revenue across all technology companies"
)

# Get specific metrics
response = await driver.process_query(
    "What is the average profit margin in the healthcare sector?"
)

High-Performance Processing (Rust)

# Batch process financial records
fact process financial-data.json \
    --template data-aggregation \
    --output summary.json

# Benchmark performance
fact benchmark --operations 10000

Web Integration (JavaScript)

// Real-time data processing
const processor = new QueryProcessor();
const cache = new FastCache(5000);

// Process streaming data
websocket.on('data', (data) => {
    const cached = cache.get(data.id);
    if (!cached) {
        const result = processor.process(data);
        cache.set(data.id, result, 600);
        updateUI(result);
    }
});

📊 Sample Outputs

Python Query Response

📊 Response:
Found 3 technology companies:
1. TechCorp - Revenue: $5.2B (Q1 2025)
2. DataSoft - Revenue: $2.8B (Q1 2025)
3. CloudNet - Revenue: $3.1B (Q1 2025)

Average Q1 Revenue: $3.7B
Growth vs Q4 2024: +12.5%

Rust Processing Result

{
  "status": "success",
  "processing_time_ms": 25,
  "cache_hit": true,
  "result": {
    "aggregation": {
      "total": 150000,
      "average": 3000,
      "count": 50
    },
    "patterns": ["increasing_trend", "seasonal_variation"],
    "confidence": 0.95
  }
}

JavaScript Cache Stats

{
  hits: 8523,
  misses: 1477,
  hitRate: 0.852,
  evictions: 234,
  memoryUsage: "2.3 MB",
  avgResponseTime: "0.5 ms"
}

🛠️ Next Steps

Explore More Features

  1. Installation Guide - Detailed setup instructions
  2. CLI Reference - Command-line options
  3. API Reference - Complete API documentation
  4. Examples - More code examples

Join the Community

Performance Tips

  1. Enable Caching - Dramatically improves response times
  2. Use Templates - Pre-optimized for common operations
  3. Batch Operations - Process multiple items together
  4. Monitor Metrics - Track cache hit rates and response times

🎉 Congratulations!

You're now ready to use FACT for high-performance data processing. Choose your platform and start building amazing applications!


Need help? Check the troubleshooting guide or open an issue.

Clone this wiki locally