|
| 1 | +# ObjectStack AI Protocol Examples |
| 2 | + |
| 3 | +This package contains comprehensive examples demonstrating all aspects of the ObjectStack AI Protocol. |
| 4 | + |
| 5 | +## 📚 What's Included |
| 6 | + |
| 7 | +### Core Examples |
| 8 | + |
| 9 | +1. **agent.examples.ts** - AI agent configuration examples |
| 10 | + - Conversational agents |
| 11 | + - Task-specific agents |
| 12 | + - Multi-agent systems |
| 13 | + - Agent tools and capabilities |
| 14 | + |
| 15 | +2. **conversation.examples.ts** - Conversation management examples |
| 16 | + - Chat interfaces |
| 17 | + - Message threading |
| 18 | + - Context management |
| 19 | + - Conversation history |
| 20 | + |
| 21 | +3. **cost.examples.ts** - Cost tracking examples |
| 22 | + - Token usage tracking |
| 23 | + - Cost allocation |
| 24 | + - Budget management |
| 25 | + - Usage analytics |
| 26 | + |
| 27 | +4. **model-registry.examples.ts** - Model registry examples |
| 28 | + - Model configurations |
| 29 | + - Provider settings |
| 30 | + - Model capabilities |
| 31 | + - Fallback strategies |
| 32 | + |
| 33 | +5. **nlq.examples.ts** - Natural Language Query examples |
| 34 | + - Text-to-SQL generation |
| 35 | + - Query understanding |
| 36 | + - Semantic search |
| 37 | + - Intent recognition |
| 38 | + |
| 39 | +6. **orchestration.examples.ts** - AI orchestration examples |
| 40 | + - Multi-step workflows |
| 41 | + - Agent coordination |
| 42 | + - Task routing |
| 43 | + - Error handling |
| 44 | + |
| 45 | +7. **predictive.examples.ts** - Predictive analytics examples |
| 46 | + - Forecasting models |
| 47 | + - Classification |
| 48 | + - Regression |
| 49 | + - Anomaly detection |
| 50 | + |
| 51 | +8. **rag-pipeline.examples.ts** - RAG pipeline examples |
| 52 | + - Document indexing |
| 53 | + - Vector search |
| 54 | + - Context retrieval |
| 55 | + - Answer generation |
| 56 | + |
| 57 | +## 🚀 Usage |
| 58 | + |
| 59 | +```typescript |
| 60 | +import { |
| 61 | + SalesAssistantAgent, |
| 62 | + CustomerConversation, |
| 63 | + CostTracker, |
| 64 | + OpenAIModel, |
| 65 | + NaturalLanguageQuery, |
| 66 | + AgentOrchestration, |
| 67 | + SalesForecast, |
| 68 | + DocumentRAGPipeline, |
| 69 | +} from '@objectstack/example-ai'; |
| 70 | +``` |
| 71 | + |
| 72 | +## 🏗️ Building |
| 73 | + |
| 74 | +```bash |
| 75 | +npm run build |
| 76 | +``` |
| 77 | + |
| 78 | +This compiles all TypeScript examples to JavaScript and generates type declarations. |
| 79 | + |
| 80 | +## 📖 Example Structure |
| 81 | + |
| 82 | +Each example follows this pattern: |
| 83 | +- Descriptive constant name (e.g., `SalesAssistantAgent`) |
| 84 | +- Comprehensive JSDoc comment explaining the use case |
| 85 | +- Complete, valid example using proper schemas |
| 86 | +- Realistic, practical scenarios |
| 87 | + |
| 88 | +## 🎯 Use Cases |
| 89 | + |
| 90 | +These examples are designed for: |
| 91 | +- **Learning**: Understand ObjectStack AI Protocol patterns |
| 92 | +- **Reference**: Copy-paste starting points for your own metadata |
| 93 | +- **Testing**: Validate implementations against standard patterns |
| 94 | +- **Documentation**: Illustrate best practices and conventions |
| 95 | + |
| 96 | +## 📝 Naming Conventions |
| 97 | + |
| 98 | +- **Configuration Keys**: camelCase (e.g., `modelName`, `maxTokens`) |
| 99 | +- **Machine Names**: snake_case (e.g., `sales_agent`, `rag_pipeline`) |
| 100 | +- **Example Constants**: PascalCase (e.g., `SalesAgent`, `RAGPipeline`) |
| 101 | + |
| 102 | +## 🔗 Related |
| 103 | + |
| 104 | +- [ObjectStack Spec](../../../packages/spec) - Core schema definitions |
| 105 | +- [Data Examples](../../data/metadata-examples) - Data Protocol examples |
0 commit comments