Skip to content

johnsonAyo/paydock_assistance

Repository files navigation

Paydock AI Documentation Assistant

An intelligent chatbot that transforms Paydock's static documentation into an interactive, conversational experience using AI-powered semantic search.

Why This Matters

1. AI-Powered Semantic Search vs. Traditional Keyword Search

Traditional Search (Current Limitation):

User: "How do I set up webhooks?"
System: [No results] - "webhook" not found in index

AI-Powered Search (This System):

User: "How do I set up webhooks?"
AI: ✓ Understands "webhooks" = "notifications" in Paydock context
    ✓ Finds relevant docs even without exact keyword match
    ✓ Links both conceptual docs AND API endpoints
    ✓ Provides step-by-step guidance

Key Benefits:

  • Semantic Understanding: Recognizes synonyms, related concepts, and context
  • Zero-Shot Learning: Answers questions about features not explicitly documented
  • Natural Language: Users ask questions naturally, not with exact keywords
  • Always Relevant: AI intelligently interprets intent, even with vague queries

2. Unified Documentation Experience

The Problem: Paydock has two separate, disconnected documentation sources:

  • General Docs (docs.paydock.com): Concepts, guides, tutorials
  • API Reference (documenter.getpostman.com): Endpoints, parameters, examples

Developers must manually navigate between both to understand "what" and "how."

The Solution: The AI automatically bridges both sources in every response.

Example:

User: "Explain Paydock's vault"

AI Response:
The [Vault](docs-link) is Paydock's PCI-compliant storage for payment details...

Technical implementation details can be found in the [Vault API](api-link).

📖 Read more here:
• https://docs.paydock.com/?javascript#vault
• https://documenter.getpostman.com/view/6912944/Uyr5my5q#vault-endpoints

Result: One query, complete answer with both conceptual understanding and implementation details.


Architecture Overview

User Query
    ↓
Context Assembly
    • Live docs scraping (docs.paydock.com)
    • API structure (rag/api.json)
    • Postman deep links (rag/postman_map.json)
    ↓
AI Provider (Gemini → Anthropic → Ollama)
    • Semantic understanding
    • Dual-sourcing (Docs + API)
    • Deep link construction
    ↓
Formatted Response
    • Markdown rendering
    • Code blocks
    • Clickable links

Future Extensibility

1. Additional Context Sources

The system is designed to easily inject new documentation sources:

const fullContext = `
DOCUMENTATION MAP: ${structure}
API ENDPOINTS: ${apiStructure}
POSTMAN LINKS: ${postmanLinks}
FULL DOCS: ${docs}

// Easy to add:
SUPPORT TICKETS: ${supportTickets}      // Common issues
CHANGELOG: ${changelog}                  // Recent updates
VIDEO TUTORIALS: ${videoTranscripts}    // Learning resources
COMMUNITY Q&A: ${stackOverflow}         // Developer discussions
`;

Potential Sources:

  • Support ticket database (common issues/solutions)
  • Changelog/release notes (recent updates)
  • Video tutorial transcripts
  • Stack Overflow questions
  • GitHub issues/discussions
  • Customer success stories

2. User Analytics & Pain Point Tracking

Database Schema:

CREATE TABLE analytics (
    query TEXT,
    topics TEXT[],              -- ['webhooks', 'vault', 'charges']
    satisfaction_score INT,     -- 1-5 (from thumbs up/down)
    response_time_ms INT,
    created_at TIMESTAMP
);

CREATE TABLE search_failures (
    query TEXT,
    reason VARCHAR(100),        -- 'no_relevant_docs', 'ai_error'
    created_at TIMESTAMP
);

Insights to Extract:

  1. Most searched topics: What are developers looking for?
  2. Documentation gaps: Queries with low satisfaction scores
  3. Common pain points: Repeated questions about same topic
  4. Usage patterns: Peak hours, popular features

Example Dashboard:

Top Pain Points (Last 30 Days):
1. "How to handle failed webhooks" (2.1/5.0 satisfaction) - 47 queries
2. "3DS implementation with React" (2.3/5.0) - 34 queries
3. "Vault token expiration" (2.5/5.0) - 28 queries

→ Action: Prioritize improving these docs sections

3. Metrics & Observability

Key Metrics:

// Response time by AI provider
histogram('ai.response_time', responseTime, { provider: 'gemini' });

// Token usage (cost tracking)
counter('ai.tokens_used', tokensUsed, { provider: 'gemini' });

// Cache hit rate
counter('cache.hit', 1, { type: 'docs' });

// Error rates
counter('ai.errors', 1, { provider: 'gemini', error_type: '403' });

Real-Time Dashboard:

Paydock AI Assistant - Live Metrics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Requests/min: 12.3 ▲ 15%
Avg Response Time: 5.2s ▼ 8%
Error Rate: 2.1%

AI Provider Health:
Gemini:    87% ✓ (3.2s avg)
Anthropic: 12% ✓ (4.1s avg)
Ollama:     1% ✓ (8.7s avg)

Cache Performance:
Hit Rate: 78% ████████████████

Setup & Configuration

Prerequisites

Node.js >= 18.0.0
npm >= 9.0.0

Environment Variables

Create .env.local:

# Required for Gemini (Primary AI)
GOOGLE_API_KEY=your_google_api_key_here

# Optional (Fallback AI)
ANTHROPIC_API_KEY=your_anthropic_api_key_here

Installation

npm install
npm run dev

Key Innovations Summary

Feature Traditional Search AI Assistant
Keyword matching Exact match only Semantic understanding
Synonyms Not recognized Automatically handled
Multi-source Single source Unified (Docs + API)
Deep linking Manual navigation Auto-generated
Natural language No Yes
Extensibility Limited Easily add new sources
Analytics None Track pain points

Conclusion

This AI assistant transforms Paydock's documentation from a static reference into an intelligent, conversational guide. By unifying multiple documentation sources and using semantic understanding, it provides developers with instant, accurate answers while revealing valuable insights about documentation gaps and user pain points.

Next Steps:

  1. Add user feedback (thumbs up/down)
  2. Implement analytics database
  3. Inject additional context sources (support tickets, changelog)
  4. Build metrics dashboard

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors