RAG-powered customer support system demonstrating ObjectStack AI protocols
This example demonstrates how to build an intelligent customer support system using ObjectStack's AI protocols:
- RAG Pipeline: Knowledge base powered by vector search
- AI Agent: Intelligent support agent with function calling
- Model Registry: Centralized LLM configuration with fallback support
- Natural Language Queries: Business users can query tickets using natural language
- Vector search across documentation
- Semantic chunking of markdown content
- MMR retrieval for diverse results
- Cohere reranking for accuracy
- Answer customer questions using RAG
- Create and update support tickets
- Search existing tickets for similar issues
- Escalate to human agents when needed
- Collect customer satisfaction feedback
- "Show me all high priority tickets"
- "What tickets are assigned to me?"
- "How many open tickets from last week?"
┌─────────────────────────────────────────────────────────┐
│ Customer Interface │
│ (Chat, Email, Web Portal) │
└──────────────────────┬──────────────────────────────────┘
│
┌──────────────────────▼──────────────────────────────────┐
│ AI Support Agent │
│ (GPT-4 Turbo with function calling) │
└──────────────────────┬──────────────────────────────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌───────▼──────┐ ┌────▼─────┐ ┌─────▼──────┐
│ RAG Pipeline │ │ Actions │ │ ObjectQL │
│ (Pinecone) │ │ (CRUD) │ │ (Query) │
└──────────────┘ └───────────┘ └────────────┘
src/ai-config.ts- AI agent, model registry, and RAG pipelinesrc/domains/ticket.object.ts- Support ticket data modelobjectstack.config.ts- Application configuration
# Install dependencies
pnpm install
# Start development server
pnpm devexport const SupportAgent: Agent = {
name: 'customer_support_ai',
label: 'AI Support Agent',
role: 'Senior Customer Support Specialist',
tools: [
{ type: 'action', name: 'create_support_ticket' },
{ type: 'vector_search', name: 'kb_search' },
{ type: 'query', name: 'search_tickets' },
],
knowledge: {
topics: ['product_documentation', 'faq', 'troubleshooting'],
indexes: ['support_kb_v2'],
},
};export const KnowledgeBaseRAG: RAGPipelineConfig = {
embedding: {
provider: 'openai',
model: 'text-embedding-3-large',
dimensions: 3072,
},
vectorStore: {
provider: 'pinecone',
indexName: 'support-kb-prod',
},
retrieval: {
type: 'mmr',
topK: 5,
lambda: 0.7,
},
};Customer: "My API calls are failing with a 401 error"
AI Agent:
- Searches knowledge base for authentication errors
- Finds relevant documentation
- Provides step-by-step troubleshooting
- If unresolved, creates a ticket and escalates
Support Manager: "Show me all critical tickets from the last 24 hours"
System:
- Parses natural language to ObjectQL
- Executes query:
ticket.filter(priority='critical', created_date>yesterday) - Returns formatted results with summaries
- Response Time: < 2s for RAG queries
- Accuracy: 90%+ customer satisfaction
- Automation: 70% of tickets handled without human intervention
- Knowledge Coverage: 95% of queries have relevant KB articles
- AI Data Analyst - NLQ for business intelligence
- AI Code Generator - Generate ObjectStack apps from descriptions
- AI Sales Assistant - Intelligent sales automation