OpenAI Integration
AI-powered intelligence for engagement generation, order management, and worker creation.
Modules Provided
Engagement Builder Module
Capabilities:
- Generate engagements from natural language
- Parse order requests
- Extract structured data
- Validate completeness
Use Cases:
- Email-to-order conversion
- Voice-to-order processing
- Chat-based ordering
- Auto-quoting
OMS Intelligence Module
Capabilities:
- Order intent classification
- Priority scoring
- Issue detection
- Recommendation generation
Use Cases:
- Order routing
- Priority assignment
- Anomaly detection
- Smart suggestions
Worker Builder Module
Capabilities:
- Generate worker code
- Template selection
- Code validation
- Worker documentation
Use Cases:
- Rapid worker prototyping
- Worker scaffolding
- Code generation
- Development automation
Configuration
OPENAI_API_KEY=<from-secrets>
OPENAI_MODEL=gpt-4
OPENAI_TEMPERATURE=0.1
OPENAI_MAX_TOKENS=2000
Bridge Access
// Generate engagement from text
const engagement = await bridge.integrations.openAi.engagementBuilder
.generateFromText({
text: "I need 100 units of SKU-123 delivered to Chicago",
context: { customerId, tenantId }
});
// OMS intelligence
const analysis = await bridge.integrations.openAi.oms.analyzeOrder({
engagement,
history: customerOrders
});
// Generate worker
const workerCode = await bridge.integrations.openAi.workerBuilder
.generateWorker({
description: "Process inventory updates",
template: "data-processor"
});
Use Cases
Natural Language Ordering: Convert customer messages into structured orders.
Intelligent Routing: Classify and route orders based on content analysis.
Development Acceleration: Generate worker boilerplate from descriptions.
Data Extraction: Parse unstructured data into engagement fields.
Advantages
Intelligence: Understand context and intent, not just keywords.
Flexibility: Handle variations and unexpected inputs gracefully.
Speed: Process requests in seconds, not minutes.
Accuracy: High-quality structured output from unstructured input.
Operational Notes
Cost Management
- Cache common requests
- Use appropriate model for task
- Set token limits
- Monitor API usage
Reliability
- Implement retries
- Handle rate limits
- Fallback to manual processing
- Validate AI output
Security
- No sensitive data in prompts
- Sanitize inputs
- Validate outputs
- Audit AI decisions
When to Use
Unstructured Input: When you need to parse natural language into structured data.
Intelligence Layer: When rule-based systems aren't flexible enough.
Development Tools: When you want to accelerate development with code generation.
When NOT to Use
Deterministic Logic: Use regular code for predictable, deterministic operations.
High-Volume: AI calls have cost - use for value-add operations only.
Real-Time Critical: AI responses have latency - not for sub-second requirements.
OpenAI: Intelligence for commerce automation.