Business Requirements

Problem Statement

Enterprises need to integrate AI-powered conversations into their applications to enhance productivity, provide intelligent assistance, and improve user engagement. The BiChat module provides a scalable, multi-tenant solution for managing AI-powered dialogues with full conversation history and context preservation.

Use Cases

1. Employee AI Assistant

Actor: Employee within organization

Flow:

  1. User initiates a new dialogue with an AI assistant
  2. User sends a question or request (initial message)
  3. System sends message to LLM with context
  4. System receives and displays AI response
  5. User continues conversation (follow-up questions)
  6. System maintains full conversation history
  7. User can reference previous messages in same conversation

Acceptance Criteria:

  • Conversations scoped to individual users
  • Full message history preserved
  • Context maintained across turns
  • Response streaming for better UX
  • Conversation labeling for organization

2. Customer Support Bot

Actor: Customer support team, System

Flow:

  1. Customer initiates dialogue with support bot
  2. Bot receives initial customer inquiry
  3. System classifies intent using LLM
  4. Bot provides initial response or escalation
  5. Customer can continue dialogue with bot
  6. Support team can view conversation history
  7. Support team can add notes and context

Acceptance Criteria:

  • Multi-turn conversation support
  • Response customization per tenant
  • Conversation analytics
  • Hand-off to human support capability
  • Conversation export

3. Content Generation

Actor: Content team

Flow:

  1. Team member starts dialogue with content assistant
  2. Requests content generation (blog post, email, etc.)
  3. LLM provides initial draft
  4. User iterates with follow-up requests
  5. System maintains all iterations in conversation
  6. User exports final content

Acceptance Criteria:

  • Long conversation support (100+ messages)
  • Iteration history preservation
  • Content export capability
  • Custom system prompts per team
  • Version tracking

4. Training & Onboarding

Actor: New employees

Flow:

  1. Employee uses AI assistant for onboarding questions
  2. Questions about company processes, tools, policies
  3. AI provides contextual answers
  4. History available for reference
  5. Manager can review dialogue for training gaps

Acceptance Criteria:

  • Knowledge base integration
  • Conversation analytics for training
  • Multi-conversation support
  • Search across conversations
  • Feedback mechanism

Business Rules

Dialogue Rules

  1. Ownership:
    • Each dialogue belongs to a single user
    • Dialogues cannot be transferred between users
    • Only dialogue creator can view/edit
  2. Lifecycle:
    • Dialogues start with user’s initial message
    • Dialogues can be archived/deleted
    • Deleted dialogues soft-deleted (recoverable)
  3. Content:
    • Minimum 1 message (user’s initial message)
    • Supports unlimited messages
    • Messages ordered by timestamp
    • Immutable message history

Message Rules

  1. Types:
    • User messages: From authenticated user
    • Assistant messages: From LLM provider
    • System messages: Internal use
  2. Properties:
    • Each message has content and role
    • Timestamps automatically set
    • Complete conversation history maintained
    • No message editing (immutable)
  3. Processing:
    • User messages must be non-empty
    • Sanitization applied to prevent injection
    • Character limits enforced (configurable)
    • Profanity filtering (optional)

LLM Integration Rules

  1. Provider:
    • OpenAI as primary provider
    • Configurable model selection
    • Fallback to alternative providers
  2. Configuration:
    • Per-tenant LLM settings (optional)
    • System prompts customizable
    • Temperature and other parameters
    • Token limits respected
  3. Error Handling:
    • Graceful degradation on API failures
    • User-friendly error messages
    • Automatic retry logic
    • Fallback responses

Tenant Isolation

  1. Data Access:
    • Users only see their own dialogues
    • Dialogues never visible across tenants
    • API enforces tenant isolation
    • Database queries include tenant_id filter
  2. Configuration:
    • Each tenant can customize settings
    • Separate API keys per tenant
    • Independent conversation limits

Key Metrics & KPIs

User Engagement

  • Daily active users using BiChat
  • Average conversations per user
  • Average messages per conversation
  • User retention (repeat usage)

Content Metrics

  • Total conversations created
  • Total messages exchanged
  • Average response time (LLM latency)
  • User satisfaction (feedback rating)

System Health

  • API call success rate
  • Average response latency
  • Error rates (4xx, 5xx)
  • LLM provider availability

Business Metrics

  • Cost per conversation (API usage)
  • User satisfaction scores
  • Support tickets resolved via BiChat
  • Content quality ratings

Success Criteria

  1. Usability:
    • Conversation starts in < 1 second
    • Message send/receive in < 5 seconds
    • Smooth streaming response display
    • Mobile-friendly interface
  2. Reliability:
    • 99% uptime for dialogue service
    • No message loss
    • Automatic recovery from failures
    • Data consistency maintained
  3. Performance:
    • < 100ms database query time
    • Streaming response latency < 2 seconds
    • Support for 100+ message conversations
    • Scales to millions of conversations
  4. Security:
    • Zero cross-tenant data leakage
    • Secure credential management
    • Input validation and sanitization
    • Audit trail for all conversations
  5. Scalability:
    • Supports unlimited conversations per user
    • Handles concurrent conversations
    • Efficient message storage
    • Query optimization for history

Constraints

  1. LLM Integration:
    • Dependent on external API availability
    • API rate limits apply
    • Token usage costs
  2. Data Storage:
    • Long conversations may impact performance
    • Message history requires significant storage
    • Archival strategy needed for old conversations
  3. Functionality:
    • Single turn-around required before response
    • No guaranteed response time (API dependent)
    • Limited to text-based content initially

Integration with Main Platform

BiChat integrates with:

  • Core Module: User authentication and tenant context
  • Database: Same PostgreSQL instance
  • Frontend: HTMX components for chat UI
  • Services: Accessible via HTTP API

Future Enhancements

  • Multi-modal input (images, files)
  • Conversation sharing between users
  • Advanced search across conversations
  • Conversation templates
  • Fine-tuned models per tenant
  • Conversation branching (explore alternatives)
  • Analytics dashboard

Back to top

IOTA SDK - Multi-tenant Business Management Platform