Hybrid Mode - Best of Both Worlds

Combines keyword-based responses with AI fallback for unknown queries

How Hybrid Mode Works

  • Predefined keywords trigger fast, static responses
  • Unknown queries automatically route to AI
  • Low-confidence matches use AI for better answers
  • Maintains context across both response types

🤖 Hybrid Chatbot

✨ Try These Queries

📚 Keyword Triggers (Fast)

  • • "hello" or "hi"
  • • "help" or "support"
  • • "product information"
  • • "pricing" or "cost"

🤖 AI Fallback (Smart)

  • • "What's the weather like?"
  • • "Tell me a joke"
  • • "How do I reset my password?"
  • • "Compare your plans"

Tip: Watch for the emoji indicators! 📚 = Keyword match, 🤖 = AI response

Configuration

<div data-swc 
     data-swc-api-mode="hybrid"
     data-swc-api-key="YOUR_API_KEY"
     data-swc-api-model="openai/gpt-3.5-turbo"
     data-swc-hybrid-threshold="0.3"
     data-swc-system-prompt="Custom instructions for AI">
</div>

<script>
  // Or configure programmatically
  const chatbot = new SenangWebsChatbot(
    knowledgeBase,
    { botName: 'Assistant', themeColor: '#7C3AED' },
    {
      mode: 'hybrid',
      apiKey: 'YOUR_API_KEY',
      model: 'openai/gpt-3.5-turbo',
      hybridThreshold: 0.3,  // 0-1, higher = more AI usage
      systemPrompt: 'You are a helpful assistant.',
      streaming: true
    }
  );
</script>

Understanding Hybrid Threshold

The hybrid-threshold controls when the chatbot switches from keywords to AI:

0.8 - 1.0

Very High - Requires multiple keyword matches. Most queries go to AI.

0.5 - 0.7

Moderate - Needs good keyword match. Unclear queries go to AI.

0.3 (Default)

Balanced - Any keyword match uses static response. Perfect for hybrid mode.

0.0 - 0.2

Keyword-First - Even weak matches use keywords. AI rarely used.

âš¡

Fast & Reliable

Instant responses for common queries with zero latency

🧠

Intelligent Fallback

AI handles complex or unexpected questions seamlessly

💰

Cost Effective

Reduce API costs by using keywords for common queries