← Back to Projects

Azieb Tech Portfolio & AI Chatbot

Ask this site about my work and get an answer in seconds, drawn only from these pages and measured with a retrieval eval.

Source private. The retrieval eval and tracing design are written up on this page — ask me for a walkthrough.

Project Overview

I designed and built this portfolio website to present my automation, business systems, data, and applied AI work. I also built the AI chatbot embedded in the site so a visitor can get an answer about my background or a project without reading every page.

How the Chatbot Works

The chatbot uses retrieval-augmented generation (RAG), so every answer is grounded in the site's own content:

  1. Markdown content is split into heading-based chunks with overlap for longer sections.
  2. Voyage AI converts each content chunk into an embedding during the build process.
  3. A visitor's question is converted into a query embedding at request time.
  4. Cosine similarity ranks the stored content chunks by relevance.
  5. The most relevant chunks are provided to the Anthropic model as context.
  6. The model generates a concise response that is streamed back to the browser.

Engineering decisions behind it:

  • Kept API keys on the server by calling external AI services from the Next.js API route.
  • Used the same Markdown files for the site's pages and the chatbot's knowledge base, instead of introducing a database for a small portfolio.
  • Added content grounding instructions so the assistant uses portfolio information instead of inventing details.
  • Added response streaming to improve the perceived speed of the chat experience.
  • Rate-limited the public endpoint to 10 requests per 10 minutes per visitor, and capped conversations at 20 messages of up to 2,000 characters each, with input validation and origin checks on every request.
  • Rebuilt each incoming message from its known fields, so nothing else a client sends reaches the model or the trace.

Observability & Privacy

Each answer produces one trace in Langfuse, with a step for embedding the question, searching the index, and generating the answer. The trace records:

  • which chunks were retrieved (source page, heading, and similarity score, not the text itself)
  • timings for each step, including time to first token
  • token usage, and whether the answer was cut off at the token limit
  • the environment (production or preview) and the commit that served it, so traces line up with eval runs for the same release

Failures are recorded at the step that failed, so a trace shows whether the embedding call, the search, or the answer stream broke. Severity is deliberate: a visitor closing the chat mid-answer is a warning rather than an error, so the error rate stays meaningful.

Tracing a public chatbot means handling whatever visitors type, so the design starts from collecting less:

  • Opt-in. Nothing is traced unless it's switched on by configuration and both keys are set, so local development never sends data by accident.
  • Isolated. Langfuse gets its own tracer, so the framework's built-in request data (URLs, headers, client IPs) never reaches it.
  • Redacted. Emails, phone numbers, SSNs, and long card- or account-like numbers are replaced before anything is exported.
  • Minimal. No IP address, user agent, user ID, or system prompt is stored.
  • Fresh per request. Each trace starts from an empty context, so a visitor can't attach to or inject into a trace through request headers.
  • Never in the way. An observability outage is swallowed rather than surfaced as a chat error, and the final flush runs after the answer has finished streaming, so tracing never delays the visitor.

Measuring Retrieval

A wrong answer usually starts with the wrong content being retrieved, so retrieval gets its own eval. A fixed set of 27 questions, 11 phrased directly and 16 paraphrased, each lists the pages that should answer it. Every run scores:

  • hit@1, hit@3, and hit@k: how often an expected page is in the top 1, top 3, or top k results, where k is the same number of chunks the chat route sends to the model
  • MRR: the mean of 1 / (rank of the first expected page), so an answer at rank 1 scores 1.0 and at rank 4 scores 0.25

Each run is appended to a history file with its commit hash and compared against the previous run, so a change to content, chunking, or retrieval settings shows up as a number before it ships. The eval refuses to save results scored against an index that is out of date with the site's content.

Scope & Tech Stack

  • Retrieval currently uses an in-memory index and a linear similarity scan, which is appropriate for the small amount of portfolio content but would need a vector database for a larger knowledge base.
  • Rate limiting is kept in memory, so it applies per server instance rather than across all of them. Higher traffic would need a shared store.
  • The chatbot depends on external Anthropic and Voyage AI services and their available API limits.

Tech stack: Next.js (App Router), React, TypeScript, Tailwind CSS, Anthropic API, Voyage AI embeddings, Langfuse over OpenTelemetry, Vercel