AI2025

Lily AI Copilot

Lily AI — the floating assistant on this site — streams grounded answers from a zero-dependency embedded knowledge base, with an optional OpenAI upgrade path.

Role

AI Integration Architect

Client

This portfolio

Duration

2025

Stack

Next.js · OpenAI SDK · RAG

The challenge

An AI assistant on a portfolio must feel instant, always work (even without an API key), stay grounded in curated facts, and degrade gracefully — all without bloating the bundle.

The approach

  1. 01

    Vectorized a curated knowledge base with term frequencies and cosine-similarity ranking — zero dependencies.

  2. 02

    Built a streaming chat endpoint that uses OpenAI when a key is present and falls back to local retrieval otherwise.

  3. 03

    Designed the UI around incremental text deltas — streaming caret, typing dots and suggestion chips.

  4. 04

    Kept the same UX on both backends so the experience never depends on configuration.

The solution

Lily AI answers visitor questions about experience, stack and leadership instantly and offline, with optional grounded OpenAI streaming when a key is configured — the same component, two backends, zero visual difference.

Results

0

Config required

2

Backends (local + OpenAI)

~20ms

Per-token latency

1

UI for both

Highlights

  • ▹Embedded TF/cosine vector retrieval
  • ▹Streaming UI with graceful fallbacks
  • ▹Optional OpenAI grounding
  • ▹Works fully offline

Technologies

Next.jsOpenAI SDKTypeScriptRAGStreamingTailwindCSS