πŸ“š Complete Tutorial: Configuring a Medical Chatbot with AI Engine

*This is the third part of the complete configuration guide. If you missed the first two parts, you can find them [here]** and [here]**.*

In the first two parts we covered:
βœ… **Technical Foundation** – Token system, cost optimization, Dashboard modules
βœ… **Chatbot Configuration** – AI Model, Embeddings, Thresholds, Knowledge Base
βœ… **User Interface** – Appearance, Popup, UI Builder, Advanced
βœ… **Advanced Integrations** – Cross-Site, Shortcodes, Actions

## πŸ“Š NOW WE WILL ACTIVATE THE COMPLETE CONTROL PANEL:

In this part, we will explore both monitoring and the initial global settings:

πŸ”Ή **Discussions** – Analyzing user conversations
πŸ”Ή **Insights** – Monitoring costs and performance metrics
πŸ”Ή **Settings – AI** – Configuring environments and AI providers


πŸ“ŠMONITORING AND ANALYSIS – “Discussions”

πŸ“ AI Engine β†’ Discussions


πŸ”Ή MAIN FUNCTIONALITY

Function: Viewing all conversations
Utility: Monitoring chatbot performance
Access: Complete interaction history

πŸ“ˆ MONITORING CONVERSATIONS

πŸ” WHAT WE SEE IN THE PANEL:

- All user discussions
- Date and time of each conversation
- Involved users
- Topics discussed

πŸ’¬ PRACTICAL EXAMPLE FROM THE SYSTEM

πŸ“‹ EXISTING CONVERSATIONS:

User #3: "bladder infection"
User #3: "urinary tract infection"

πŸ”§ HOW TO USE DISCUSSIONS FOR OPTIMIZATION

βœ… PERFORMANCE CHECK

Verification Protocol:
Β  1. Confirm that responses comply with settings
Β  2. Verify response consistency
Β  3. Monitor interaction quality

🚨 PROBLEM IDENTIFICATION

What to look for in conversations:
Β  - Responses non-compliant with settings
Β  - Errors in conversations
Β  - Technical issues

πŸ“‹ BENEFITS FOR ADMINISTRATION

⚑ CONVERSATION MANAGEMENT

βœ… Complete visibility into usage
βœ… Rapid problem detection
βœ… Continuous service improvement

πŸ”§ MAINTENANCE AND SUPPORT

βœ… Tracking user issues
βœ… Efficient technical support
βœ… Optimization of user experience


🎯 CONFIGURING LIMITS -“INSIGHTS”

πŸ“ AI Engine β†’ Insights


πŸ”Ή SETTING FINANCIAL LIMITS

πŸ”§ CONFIGURING LIMITS FOR USERS:

1. Check "Enable Limits"
2. Under "Users", set:
Β  Β - Credits: 10 (maximum amount per user)
Β  Β Type: Dollars (or Questions/Tokens)
3. Under "Guests", set a lower limit (e.g.: 5$)
4. Under "System", set the global limit (e.g.: 100$)

πŸ’‘ SIGNIFICANCE OF EACH OPTION:

Dollars: Limits by amount spent ($)
Questions: Limits by number of questions
Tokens: Limits by number of tokens

πŸ‘₯ DIFFERENTIATING LIMITS BY USER TYPE

🎯 RECOMMENDED CONFIGURATION STRATEGY:

REGISTERED USERS (USERS):

Credits: 10$ (more for loyal users)
Reason: They may have complex needs and long consultations

VISITORS (GUESTS):

Credits: 2-3$ (conservative limit)
Reason: Prevents abuse from anonymous users

SYSTEM (SYSTEM):

Credits: 100$ (global safety limit)
Reason: Blocks the entire system upon exceeding

⚠️ MONITORING AND ADJUSTING LIMITS

πŸ“Š INTERPRETING USAGE DATA:

If users quickly reach the limit:
- Increase the limit from 10$ to 15$
- Or change from $ to Questions

If no one reaches the limit:
- Decrease the limit for savings
- Or keep it for user convenience

πŸ”„ TIMES FOR ADJUSTMENT:

After 1 week: Observe real patterns
After 1 month: Adjust based on complete data
Upon usage increase: Review limits

πŸ›‘οΈ SYSTEM PROTECTION THROUGH LIMITS

🚨 CONFIGURING SAFETY MEASURES:

Timeframe: "Month" (resets monthly)
Absolute: "Yes" (stops at the limit, doesn't just warn)

🎯 CONFIGURATION RESULT:

- Each user receives 10$ monthly
- Upon exceeding, they can no longer use the chatbot
- At the beginning of the month, the counter resets

βœ… TESTING AND VERIFYING LIMITS

πŸ§ͺ TESTING PROCESS:

1. Set a small test limit (1$)
2. Use the chatbot until the limit is exceeded
3. Verify that the system blocks correctly
4. Adjust to the final value

This configuration offers complete control over costs and prevents budget overruns. βœ…


βš™οΈ “SETTINGS” – GLOBAL CONFIGURATIONS

1. “AI” TAB – CONFIGURING AI PROVIDERS

πŸ“ AI Engine β†’ Settings β†’ “AI” Tab


πŸ”Ή “ENVIRONMENTS FOR AI” SECTION – CONFIGURING CONNECTIONS

🌐 MAIN CONFIGURATION PANEL:

Purpose: Configuring connections with AI providers
Status: List of configured environments + action buttons

πŸ”§ INTERFACE ELEMENTS:

πŸ“‹ ENVIRONMENTS LIST:
OpenAI: βœ… Configuration button (main provider)
OpenRouter: βœ… Configuration button (cost-efficient alternative)
βž• Button for adding custom providers

πŸ—οΈ CONFIGURATION ARCHITECTURE:

Each environment represents:
- A connection to an AI provider
- An authenticated API key
- A set of specific capabilities
- A unique Environment ID

βš™οΈ CONFIGURING THE OPENAI ENVIRONMENT:

πŸ“ COMPLETION FORM:

Name: "OpenAI" - environment identifier
Type: "OpenAI" - selected from the dropdown list
API Key: [API key] - field for authentication
Organization ID: optional - for business accounts

πŸŽͺ LIST OF AVAILABLE TYPES:

Dropdown Type includes:
β”œβ”€ OpenAI (GPT-4, GPT-3.5 Turbo)
β”œβ”€ Anthropic (Claude models)
β”œβ”€ Azure (OpenAI on Azure)
β”œβ”€ Google (Gemini, PaLM)
β”œβ”€ OpenRouter (multi-provider aggregator)
β”œβ”€ Replicate (open-source models)
β”œβ”€ Perplexity (search + AI)
└─ Mistral (European models)

πŸ”‘ API KEY MANAGEMENT:

Source: platform.openai.com/api-keys
Security:Β 
Β  - Key is masked in the interface
Β  - Encrypted storage in the database
Β  - Automatic validation upon saving

πŸ†” ENVIRONMENT ID GENERATION:

Environment ID: "2vxxmijh" - automatically generated
Function: Unique identifier for the environment
Usage: References in chatbots and settings

πŸ›‘οΈ SECURITY AND VALIDATION MECHANISMS:

βœ… CONNECTION TEST:

"Quick Test" Button:Β 
Β  - Checks API connectivity
Β  - Validates the API key
Β  - Confirms permissions
Β  - Returns connection status

🚨 DATA PROTECTION:

API Keys:Β 
Β  - Not displayed in frontend
Β  - Transmitted securely to backend
Β  - Stored encrypted in database
Β  - Accessible only for legitimate processing

🎯 MEDICAL CONFIGURATION STRATEGY:

πŸ’Š SELECTING PROVIDER:

OpenAI GPT-4 Turbo:
Β  - Superior medical accuracy
Β  - Complies with strict prompts
Β  - Optimized cost for volume
Β  - Compatibility with embeddings

πŸ”— COMPLETE SYSTEM INTEGRATION:

OpenAI Environment β†’ Medical Chatbot β†’ Knowledge Base
Β  Β  Β  Β   ↓  Β  Β  Β  Β  Β  Β  Β  Β   ↓  Β  Β  Β  Β  Β  Β  Β   ↓
API ConnectionΒ  Β  Β  Β  Uses environmentΒ  Β  Database
Key ValidationΒ  Β  Β  Β  GPT-4 Turbo ModelΒ  Β  Ada-002 Embeddings

πŸ”Ή “DEFAULT ENVIRONMENTS FOR AI” SECTION – SPECIALIZED CONFIGURATION

🌐 SPECIALIZED ENVIRONMENTS PANEL:

Purpose: Configuring specialized environments for specific tasks
Structure: 7 tabs for different types of AI processing

πŸ”§ AVAILABLE TABS:

🎯 DEFAULT – GENERAL PROCESSING:

Environment: OpenAI
Model: GPT-4 Turbo (βœ… Selected)
Purpose: General conversational interactions
Usage: Chatbots, content generation

⚑ FAST – QUICK RESPONSES:

Environment: OpenAI
Model: GPT-4o Mini (βœ… Selected)
Purpose: Fast tasks, optimizing search queries
Features: Increased speed, reduced cost

πŸ‘οΈ VISION – IMAGE PROCESSING:

Environment: OpenAI
Model: GPT-4o Mini (βœ… Selected)
Purpose: Image analysis and understanding (image-to-text)
Capabilities: Text recognition, descriptions, content analysis

🎨 IMAGES – IMAGE GENERATION:

Environment: OpenAI
Model: DALL-E 3 (HD) (βœ… Selected)
Purpose: Generating images from text descriptions
Quality: HD - high definition
Alternatives: DALL-E 3, DALL-E 2

πŸ” EMBEDDINGS – TEXT VECTORIZATION:

Environment: OpenAI
Model: Embedding Ada-002 (βœ… Selected)
Dimensions: 1536 (Native)
Purpose: Creating embeddings for semantic search
Usage: Knowledge bases, text similarity

🎡 AUDIO – AUDIO PROCESSING:

Environment: OpenAI
Model: Whisper (βœ… Selected)
Purpose: Audio transcription (audio-to-text)
Alternatives: GPT-4o Transcribe, GPT-4o Mini Transcribe

πŸ“Š JSON – STRUCTURED DATA:

Environment: OpenAI
Model: GPT-4o Mini (βœ… Selected)
Purpose: Generating structured data, JSON formatting
Usage: API responses, data processing

πŸ—οΈ MEDICAL CONFIGURATION STRATEGY:

πŸ’Š SELECTING OPTIMAL MODELS:

Default: GPT-4 Turbo β†’ Maximum medical accuracy
Embeddings: Ada-002 β†’ Compatible with the medical knowledge base
Fast: GPT-4o Mini β†’ Quick responses for symptoms

πŸ”— INTEGRATION ARCHITECTURE:

Medical Chatbot β†’ Default Environment (GPT-4 Turbo)
Knowledge Base β†’ Embeddings Environment (Ada-002)
Search Queries β†’ Fast Environment (GPT-4o Mini)

πŸ”“EMBEDDINGS ADA-002” – THE VECTORIZATION SYSTEM

🎯 WHAT IS EMBEDDING ADA-002:

πŸ€– TECHNICAL DEFINITION:

Embedding Ada-002: OpenAI model for transforming text into vectors
Function: Converts words and phrases into numerical representations
Analogous: "Translator" from human language to mathematical language

πŸ—οΈ HOW IT WORKS:

Text: "paracetamol for fever"
Β  Β  Β  Β   ↓
Embedding Ada-002
Β  Β  Β  Β   ↓
Vector: [0.123, -0.456, 0.789, ..., 0.234] (1536 numbers)

πŸ“ DIMENSION 1536 – SIGNIFICANCE:

πŸ”’ WHAT 1536 REPRESENTS:

Dimension: 1536 numbers in each vector
Significance: 1536 characteristics of the text
Each number: Represents a semantic feature

🎯 WHY 1536 IS IMPORTANT:

Precision: The more dimensions, the more precise
Complexity: Captures fine nuances of meaning
Optimized: Perfect balance between performance and cost

πŸ’Š APPLICATION IN THE MEDICAL SYSTEM:

πŸ” PRACTICAL MEDICAL EXAMPLE:

Question: "what medicines for acute cough?"
Β  Β  Β  Β   ↓
Embedding Ada-002
Β  Β  Β  Β   ↓
Vector: [cough characteristics, acute, respiratory symptoms...]
Β  Β  Β  Β   ↓
Search for similarity in the database
Β  Β  Β  Β   ↓
Results: Cough medicines (if available)

πŸ₯ BENEFITS FOR MEDICINE:

βœ… Understands medical synonyms: "fever" = "temperature" = "pyrexia"
βœ… Detects similar contexts: "acute cough" β‰ˆ "persistent cough"
βœ… Finds correlations: "joint pain" β†’ anti-inflammatories
βœ… Eliminates reliance on exact keywords

πŸ”§ INTEGRATION INTO SYSTEM ARCHITECTURE:

πŸ—‚οΈ COMPLETE FLOW:

Medicine PDF β†’ Text extraction β†’ Embedding Ada-002
Β  Β  Β  Β   ↓
1536D Vectors β†’ Storage in Qdrant Cloud
Β  Β  Β  Β   ↓
User question β†’ Embedding Ada-002 β†’ Search Vector
Β  Β  Β  Β   ↓
Vector comparison β†’ Similar medicines β†’ Response

⚑ SYSTEM EFFICIENCY:

Speed: Ultra-fast vector search
Accuracy: Finds connections that keyword matching misses
Scalability: Works with thousands of medicines

Embedding Ada-002 is the intelligence engine that understands the meaning behind medical words! 🧠


πŸ”Ή “GENERAL” SECTION – ADVANCED SYSTEM SETTINGS

πŸ”„ STREAMING – REAL-TIME RESPONSES:

Status: βœ… Enable (activated)
Function: Progressive display of AI responses
Benefits:
Β  - Enhanced user experience
Β  - Immediate visual feedback
Β  - Sense of natural conversation

⚠️ BETA LIMITATIONS WARNING:

Warning: The ability to manage statistics, limits, and filters
is still in beta phase
Recommendation: Close monitoring of performance

πŸ› EVENT LOGS – ADVANCED DEBUGGING:

Status: ❌ Enable (disabled)
Function: Display streaming events and function calls
Conditions:
Β  - Requires Streaming to be activated
Β  - Visible only in the chatbot interface
Usage: Technical debugging for developers

πŸš€ RESPONSES API – IMPROVED PERFORMANCE:

Status: βœ… Enable (activated - recommended)
Function: Use the new OpenAI Responses API
Benefits:
Β  - Superior performance
Β  - Enhanced functionalities
Β  - Optimized experience

πŸ”§ FALLBACK MANAGEMENT:

Recommendation: Activation for maximum benefits
Fallback: Can be disabled if issues arise
Compatibility: Works with all OpenAI environments

πŸ—οΈ GENERAL SETTINGS ARCHITECTURE:

⚑ IMPACT ON THE SYSTEM:

Active Streaming:
Β  - Responses displayed character by character
Β  - Reduced latency for the first token
Β  - More natural interaction

Active Responses API:
Β  - Modern communication structure
Β  - Improved error handling
Β  - Compatibility with future features

πŸ’Š OPTIMIZATION FOR MEDICAL SYSTEM:

Streaming: Beneficial for long medical consultations
Event Logs: Disabled - not needed in production
Responses API: Enabled - stability for patients

βœ… RECOMMENDED CONFIGURATION:

βœ… Streaming: Enable (premium user experience)
❌ Event Logs: Disable (security and performance)
βœ… Responses API: Enable (stability and features)

**πŸ“š CONTINUING IN PART 4**

We have finalized the monitoring system and the initial global AI settings.
In the next article, we will complete the configuration of all global settings:

πŸ”Ή **Settings – Chatbot** – Global settings for all chatbots
πŸ”Ή **Settings – Knowledge** – Central knowledge base configurations
πŸ”Ή **Settings – Orchestration** – Integrations and automations
πŸ”Ή **Settings – Files & Media** – File management
πŸ”Ή **Settings – Remote Access** – API and external connections
πŸ”Ή **Settings – Others** – Security and maintenance

**[πŸ‘‰ Read Part 4: Complete Global Configurations here]**