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:
- Visit our pricing page to sign up
- Save your API key from the welcome email
- You're protected by our 14-day money-back guarantee
2. File Storage (Cloudflare R2)
R2 stores your documents securely and cost-effectively:
- Go to Cloudflare Dashboard → R2
- Create a bucket for your documents
- Generate API token with Object Read & Write permissions
- Save your credentials (Access Key, Secret, Bucket name, Endpoint)
Start with R2's free tier - it includes everything you need for testing.
3. Vector Database (Pinecone)
Pinecone powers fast, accurate semantic search:
- Sign up for Pinecone
- Create an index with these settings:
- Select "Serverless" for automatic scaling
- Choose "dotproduct" metric for hybrid search
- Set dimensions to 1536
- Save your API key and index host URL
The free tier is perfect for testing. Serverless means it scales automatically as you grow.
4. Embedding Model (OpenAI)
OpenAI converts your text into searchable embeddings:
- Create account at platform.openai.com
- Generate API key under Settings → API Keys
- That's it - we'll use their latest model automatically
We use OpenAI's text-embedding-3-small model for its excellent balance of accuracy and cost.
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"
Always use environment variables or a secrets manager - never commit API keys to your code.
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"
}
}
}
Save your namespace ID - you'll need it for all operations. For production, we recommend creating separate namespaces for development, staging, and production environments.
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"
}
}
]
}
}
Try different questions like "What SLA do you offer?" or "How does SSO work?" The semantic search understands the meaning of your questions, not just keywords.
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:
-
Improve Search Quality
- Enable hybrid search (combines semantic + keyword matching)
- Add metadata filters for your content types
- Test different chunk sizes (we recommend 300-500 tokens)
-
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", ... }'
-
Monitor & Optimize Costs
- Track usage in your dashboard
- Set up usage alerts
- Use batch processing for large document sets
Get Support
Our engineering team is here to help:
- Email us at [email protected]
- Read our troubleshooting guide
- Check our documentation for detailed guides