back to projects

Ask about Shahbaz

An AI agent on this site that answers visitors' questions about my work, straight from the portfolio.

PythonPydanticAIFastAPINestJSTypeScriptPostgreSQLpgvectorRedisGroqGeminiNext.jsSSE

Highlights

  • ▸ Agent explores the portfolio as a read-only filesystem with ls, cat, grep, search and history
  • ▸ Hybrid search: full-text (GIN on tsvector) and pgvector (HNSW) fused with RRF in one SQL statement
  • ▸ Fallback chain (Groq gpt-oss-120b → gpt-oss-20b → Gemini) that skips rate-limited or slow models at once
  • ▸ No internals on the wire, prompt-injection hardening, links limited to the site
  • ▸ Atomic Redis daily quota, a CMS kill switch, and owner test turns kept out of the stats
  • ▸ Golden eval set with adversarial cases

The chat widget on this site. Visitors ask about my work and get short, streamed answers with links to the right part of the site.

A filesystem, not a context dump: the portfolio is exposed to the model as a read-only virtual filesystem, where every project, role and highlight is a file. A PydanticAI agent explores it with five Unix-style tools: ls, cat (several files at once), grep, search, and history for earlier turns, so it reads only what a question needs.

Hybrid search: search combines Postgres full-text search (a GIN index on tsvector) and pgvector cosine similarity (an HNSW index), fused with reciprocal rank fusion in one SQL statement. Long entries are split into one file per paragraph, so a match points at the right section.

Reliability: a fallback chain (gpt-oss-120b → gpt-oss-20b → Gemini) skips a rate-limited, slow or out-of-tokens model at once. A per-question tool budget hides the tools once spent, so the agent must answer, and a 30-second cap ends runaway runs.

Safety: portfolio content and visitor messages are treated as data, never instructions. No internals (models, tools, file paths) reach the browser, and links are limited to the site's own pages. A site-wide daily quota runs on atomic Redis counters, a CMS switch turns the bot off instantly, and signed-in owner tests skip the limit and stay out of the stats.

Evals: a golden set of normal and adversarial questions (prompt injection, path traversal, invented facts) checks every answer for leaks and made-up details.