Public Q&A Widget

Embed a public chat widget that answers visitor questions using your knowledge corpus with hybrid retrieval.

What you can do#

The public Q&A widget provides a chat interface for website visitors to ask questions about your product. It uses LumenFlow's knowledge corpus and hybrid retrieval to generate accurate, grounded answers without requiring authentication.

CapabilityDescriptionStatus
Streaming chatReal-time SSE streaming responsesShipped
Hybrid retrievalCombines corpus knowledge with semantic searchShipped
Rate limitingPer-IP rate limiting (database-backed or in-memory)Shipped
Abuse controlsMessage length limits, conversation cap, payload sizeShipped
AnalyticsAggregate metrics to Axiom (no transcript storage)Shipped
Kill switchDisable instantly via environment variableShipped

How it works#

The public chat endpoint streams AI responses grounded in your knowledge corpus. When a visitor asks a question:

  1. The message is validated for length, payload size, and abuse
  2. Rate limits are checked (per-IP)
  3. Relevant knowledge is retrieved using hybrid search (keyword + semantic)
  4. The AI generates a streaming response grounded in the retrieved context
  5. Aggregate analytics are emitted (topics, turn count, message length bucket)

info The public chat does not store conversation transcripts. Only aggregate analytics (topic distribution, turn counts, rate limit events) are logged.

Configuration#

The public chat widget is controlled by environment variables:

VariableDescriptionDefault
SIDEKICK_PUBLIC_CHAT_ENABLEDKill switch ("false" to disable)"true"
SIDEKICK_PUBLIC_API_KEYCompany-owned API key for the AI modelRequired

Limits#

  • Conversation turns -- maximum 10 turns per conversation
  • Message length -- enforced server-side per message
  • Payload size -- request body size capped for abuse prevention
  • Rate limiting -- per-IP, database-backed in production, in-memory fallback for development

Knowledge corpus#

The widget draws answers from the public knowledge corpus built into LumenFlow. This includes product documentation, feature descriptions, and frequently asked questions. The corpus is cached at the module level for fast response times.

Embedding the widget#

The public chat endpoint is available at:

POST /api/public/sidekick/chat

Send a JSON body with a messages array following the standard chat message format. The response is an SSE stream compatible with the Vercel AI SDK useChat hook.

warning The public chat uses a company-owned API key, not workspace keys. Ensure SIDEKICK_PUBLIC_API_KEY is set in your deployment environment before enabling the widget.