Building a Chatbot for Hacker News and Stack Overflow with LlamaIndex and ClickHouse
HackBot is a chatbot that answers questions about developer opinions by combining text-to-SQL over the 2021 Stack Overflow survey with vector search over 28m embedded Hacker News comments, both stored in ClickHouse and orchestrated with LlamaIndex, OpenAI and Streamlit. The design routes structured, unstructured and mixed questions through separate query pipelines, with mixed questions using a SQL result to drive a metadata-filtered vector search. Schema choices such as self-descriptive column names and Enum types help the LLM generate correct SQL without extra context. Ordering keys on date, length and score keep filtered vector queries fast.
Related posts
- Building a RAG pipeline for Google Analytics with ClickHouse and Amazon Bedrock
ClickHouse mediumAdept
A natural language interface over raw Google Analytics data stored in ClickHouse is built as a multi-step RAG pipeline that generates SQL from user questions using Amazon Bedrock models. Drawing on text-to-SQL research such as DAIL-SQL from the Spider benchmark, the design retrieves similar example questions and their SQL via vector embeddings, because concepts like "returning users" cannot be inferred from the schema alone. Embeddings come from a Python executable-pool UDF calling Titan embeddings, with retries and backoff for Bedrock quotas, and are invoked at query or insert time. ClickHouse serves as both the vector store and the analytics database, and specific settings are given to parallelize embedding generation on small tables.
- Building AI Search on Heroku
Heroku Engineering mediumAdeptA reference RAG architecture on Heroku pairs pgvector cosine-similarity search (top 20 chunks) with a cross-encoder reranker (Cohere Rerank 3.5, top 5), so answers come from documents that actually address the query rather than ones that are merely semantically close. Indexing crawls sites using a junk-content heuristic, splits text into 1000-character chunks with 200-character overlap at paragraph or sentence boundaries, and batch-inserts embeddings with Postgres unnest. Generation uses Claude 3.5 Sonnet, and Server-Sent Events stream pipeline progress and sources to the client. Reranking can be switched off when latency matters more than precision.
- Building Data-Aware AI Applications with Heroku AI and LlamaIndex
Heroku Engineering mediumAdeptA RAG stack on Heroku pairs LlamaIndex for ingestion, indexing and retrieval with Heroku Managed Inference (Claude 4 Sonnet via an OpenAI-compatible API), Cohere Embed Multilingual for embeddings, and Heroku Postgres with pgvector as the vector store. The walkthrough provisions the add-ons via the Heroku CLI. It then shows Python code that points LlamaIndex's OpenAILikeEmbedding at Heroku's embedding endpoint, stores 1024-dimension vectors in PGVectorStore, and queries documents through a query engine. Example use cases include financial report analysis, insurance claim agents and support chatbots.
- Beyond the Menu Tree: How Yelp Built a Smarter Customer Success Chatbot with AI
Yelp Engineering mediumAdeptYelp replaced a menu-tree and fixed-phrase customer support chatbot with an LLM system. It routes each query to one of five workflows (QA, Billing, Refund, Cancel, Review), and high-risk intents get templated responses. The QA path retrieves whole Support Center articles, about 370 of them, without chunking. Retrieval runs against a vectorstore built only from article metadata: each title, summary and top header is embedded separately with text-embedding-ada-002, because embedding whole articles diluted the semantic signal and small chunks produced false matches. The roughly 8 MB index is loaded in memory with FAISS, rebuilt daily from S3, and retrieves the top 5 articles with a similarity threshold, reaching about 94% recall@5. Generated answers pass trust-and-safety, link-provenance and length checks to catch hallucinated URLs, and the system doubled the resolution rate in an A/B test.
- AI Functions in ClickHouse: Upgrade your SQL to the AI age
ClickHouse mediumAdept
ClickHouse's beta AI Functions call LLM and embedding providers directly from SQL. They include aiClassify, aiExtract, aiGenerate, aiTranslate, aiFilter, aiRedact, aiEmbed and aiSimilarity, added across releases 26.4 to 26.8, and they make one HTTP request per row (batched for embeddings) and return native ClickHouse values. Setup on OSS uses named collections for credentials and works with any OpenAI-compatible endpoint, including local models via Ollama. Examples on the Hacker News dataset show classification, LLM predicates in WHERE, summarization, translation and an in-database RAG pipeline built on materialized-view embeddings and vector indexes. Per-query quotas on API calls and input/output tokens cap spend: call limits are exact, token limits can overshoot by one in-flight request per thread, a soft-stop mode returns partial results, and actual usage is visible in system.query_log ProfileEvents.