Quickstart

In this guide, you'll build your first AI-powered search system that can instantly find relevant information from your company's documents. You'll learn how to process content, set up semantic search, and start getting accurate answers - all while keeping your data in your infrastructure.

Prerequisites

Before we start building, you'll need to set up three things. We've chosen these services because they're reliable, cost-effective, and used by thousands of companies in production:

1. RAGaaS Account

Get your API key to start building:

  1. Visit our pricing page to sign up
  2. Save your API key from the welcome email
  3. You're protected by our 14-day money-back guarantee

2. File Storage (Cloudflare R2)

R2 stores your documents securely and cost-effectively:

  1. Go to Cloudflare Dashboard → R2
  2. Create a bucket for your documents
  3. Generate API token with Object Read & Write permissions
  4. Save your credentials (Access Key, Secret, Bucket name, Endpoint)

3. Vector Database (Pinecone)

Pinecone powers fast, accurate semantic search:

  1. Sign up for Pinecone
  2. Create an index with these settings:
    • Select "Serverless" for automatic scaling
    • Choose "dotproduct" metric for hybrid search
    • Set dimensions to 1536
  3. Save your API key and index host URL

4. Embedding Model (OpenAI)

OpenAI converts your text into searchable embeddings:

  1. Create account at platform.openai.com
  2. Generate API key under Settings → API Keys
  3. That's it - we'll use their latest model automatically

Building Your Search System

Let's build a search system that can answer questions about your company's products. We'll start with a simple example and then show you how to expand it.

1. Set Up Authentication

First, save your API key securely:

# Save in .env file or environment variables
export RAGAAS_API_KEY="your_api_key"

2. Create Your Workspace

Create a namespace to store and search your content:

curl -X POST https://api.ragaas.dev/v1/namespaces \
  -H "Authorization: Bearer $RAGAAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "product-docs",
    "description": "Product documentation and FAQs",
    "fileStorageConfig": {
      "provider": "S3_COMPATIBLE",
      "bucket": "your-bucket-name",
      "endpoint": "your-endpoint-url",
      "region": "auto",
      "credentials": {
        "accessKeyId": "your-access-key-id",
        "secretAccessKey": "your-secret-access-key"
      }
    },
    "vectorStorageConfig": {
      "provider": "PINECONE",
      "apiKey": "your-pinecone-api-key",
      "indexHost": "your-index-host"
    },
    "embeddingModelConfig": {
      "provider": "OPENAI",
      "model": "text-embedding-3-small",
      "apiKey": "your-openai-api-key"
    }
  }'

The response will include your namespace ID:

Response

{
  "data": {
    "namespace": {
      "id": "ns_abc123",
      "name": "quickstart",
      "description": "Testing RAGaaS with a sample PDF",
      "status": "ACTIVE",
      "createdAt": "2024-01-01T00:00:00Z"
    }
  }
}

Testing Your Setup

Let's test your setup by creating a simple Q&A system. We'll add some text content and then search through it.

1. Add Your Content

Let's add some product documentation that we can search through:

curl -X POST https://api.ragaas.dev/v1/ingest/text \
  -H "Authorization: Bearer $RAGAAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "namespaceId": "ns_abc123",
    "ingestConfig": {
      "source": "TEXT",
      "config": {
        "text": "Our Enterprise plan includes advanced security features for large organizations. Key features:\n\n1. Single Sign-On (SSO): Integrate with your existing identity provider (Okta, Azure AD, etc.) for seamless access control.\n\n2. Role-Based Access: Granular permissions let you control who can view, edit, or manage different parts of the system.\n\n3. Audit Logging: Track all system activities with detailed logs for compliance and security monitoring.\n\n4. Custom SLAs: Get guaranteed 99.9% uptime with 24/7 priority support.",
        "metadata": {
          "source": "pricing-docs",
          "category": "enterprise",
          "last_updated": "2024-01"
        }
      }
    }
  }'

4. Search Your Content

Now you can search your content with natural language questions:

curl -X POST https://api.ragaas.dev/v1/search \
  -H "Authorization: Bearer $RAGAAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What security features are available for enterprise customers?",
    "namespaceId": "ns_abc123",
    "topK": 1,
    "scoreThreshold": 0.7,
    "filter": {
      "metadata": {
        "category": "enterprise"
      }
    }
  }'

The API returns relevant content that matches your query:

Search Response

{
  "success": true,
  "data": {
    "results": [
      {
        "content": "Our Enterprise plan includes advanced security features for large organizations. Key features:\n\n1. Single Sign-On (SSO): Integrate with your existing identity provider (Okta, Azure AD, etc.) for seamless access control.\n\n2. Role-Based Access: Granular permissions let you control who can view, edit, or manage different parts of the system.\n\n3. Audit Logging: Track all system activities with detailed logs for compliance and security monitoring.",
        "score": 0.89,
        "metadata": {
          "source": "pricing-docs",
          "category": "enterprise",
          "last_updated": "2024-01"
        }
      }
    ]
  }
}

Next Steps

Now that you have a basic RAG system working, here's how to build something production-ready:

Process Real Documents

Start with a small set of your actual documents to see RAG in action:

# Example: Process your company's documentation
curl -X POST https://api.ragaas.dev/v1/ingest/url \
  -H "Authorization: Bearer $RAGAAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "namespaceId": "ns_abc123",
    "ingestConfig": {
      "config": {
        "url": "https://docs.your-company.com",
        "metadata": {
          "source": "company-docs",
          "version": "latest"
        }
      }
    }
  }'

Optimize for Production

Fine-tune your setup for better results:

  1. Improve Search Quality

  2. Set Up Multiple Environments

    # Create separate namespaces for dev/staging/prod
    curl -X POST https://api.ragaas.dev/v1/namespaces \
      -H "Authorization: Bearer $RAGAAS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "production",
        "description": "Production environment",
        ...
      }'
    
  3. Monitor & Optimize Costs

Get Support

Our engineering team is here to help: