Building a Context-Aware AI Assistant with RAG for Developer Support

vectorize · Tech · 2024 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Developer-support RAG assistant

Vectorize needed to answer product-support questions inside its application so users did not have to leave the UI for documentation or wait for human chat support.

Constraints:

Architecture

Vectorize embedded an AI assistant React component into the product UI and backed it with its own RAG pipeline. The pipeline ingests documentation plus approved Discord and Intercom support answers into a vector database, retrieves with the same embedding model, reranks by relevance, adds page topic context to the user question, and sends filtered context to Llama 3.1 70B on Groq with anti-hallucination instructions and feedback analytics.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  knowledge-sources[Knowledge sources] --> vectorize-rag-pipeline[Vectorize RAG pipeline]
  vectorize-rag-pipeline --> vector-database[Vector database]
  product-ui-ai-assistant[Product UI AI assistant] --> topic-context[Topic context]
  product-ui-ai-assistant --> retrieval-endpoint[Retrieval endpoint]
  topic-context --> retrieval-endpoint
  vector-database --> retrieval-endpoint
  retrieval-endpoint --> reranking-model[Reranking model]
  reranking-model --> llm-response-generator[LLM response generator]
  topic-context --> llm-response-generator
  llm-response-generator --> product-ui-ai-assistant
  product-ui-ai-assistant --> feedback-analytics[Feedback analytics]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Product UI AI assistant React component embedded on product pages where users need contextual help. Topic context, Retrieval endpoint, LLM response generator, Feedback analytics
Knowledge sources Documentation, Discord answers, and Intercom answers approved for support use. Vectorize RAG pipeline
Vectorize RAG pipeline Ingests unstructured support content, embeds it, and keeps the vector index current. Knowledge sources, Vector database
Vector database Stores embeddings for documentation and support content. Vectorize RAG pipeline, Retrieval endpoint
Retrieval endpoint Embeds the user question, retrieves similar chunks, and optionally reranks them. Product UI AI assistant, Vector database, Reranking model
Topic context Page-level topic hint appended to the user's question to improve retrieval. Product UI AI assistant, Retrieval endpoint, LLM response generator
Reranking model Scores retrieved chunks for relevance and filters out low-relevance context. Retrieval endpoint, LLM response generator
LLM response generator Llama 3.1 70B on Groq answers with retrieved context and anti-hallucination instructions. Product UI AI assistant, Topic context, Reranking model
Feedback analytics Receives thumbs-up/down feedback for monitoring assistant quality. Product UI AI assistant

Data flow

Docs, Discord, and Intercom content flow through a Vectorize RAG pipeline into a vector index. The product UI passes the user's question plus the page topic to the retrieval endpoint. Retrieved chunks can be reranked and filtered before the prompt is sent to the LLM, and thumbs feedback is sent to analytics.

3 supporting quotes
“a RAG pipeline that takes the unstructured content from our docs site, transforms it into embedding vectors, and pushes it into a vector database.”article, stated
“The retrieval endpoint takes care of this for you using the same embedding model the pipeline uses when populating the vector database.”article, stated
“Clicking on these buttons sends messages to our analytics system so we can track how users are responding to our AI assistant.”article, stated

Why this architecture

The assistant was embedded in the UI to remove context switching, used RAG instead of repeated fine-tuning because docs change constantly, and used reranking plus anti-hallucination prompting to keep smaller, faster models reliable.

3 supporting quotes
“It would be better to have an AI assistant built right into the user interface. The user gets the information they need when they need it without a major context switch.”article, stated
“We could fine tune a foundational model, but we are constantly updating our docs so repeated fine tuning is not practical.”article, stated
“with our relevance filtering we have a more deterministic system with better performance (low latency, lower cost).”article, stated

Models used: Llama 3.1 70B · embedding model · reranking model

Scale

Alternatives considered (roads not taken)

Standalone chat-with-docs bot

Rejected because: It would still require users to leave the product UI, preserving the same context-switching problem as documentation.

“we could build a standalone chat-with-your-docs chatbot, but that still requires you to leave the user interface to go to the chat interface”article, stated

Repeated fine-tuning

Rejected because: The documentation changes constantly, so a RAG pipeline is more practical than repeated model fine-tunes.

“We could fine tune a foundational model, but we are constantly updating our docs so repeated fine tuning is not practical.”article, stated

Query the vector database directly

Rejected because: Direct vector DB queries would require the application to create embeddings itself; the retrieval endpoint centralizes that work.

“Although a RAG pipeline writes to your vector database and you can query that directly if you want, you would still have to handle creating a vector embedding”article, stated

Patterns

rag-retrieval (retrieval)

The assistant uses a RAG pipeline over product documentation and support sources to provide context for the LLM.

“Since our AI assistant needs to be an expert on our documentation, this is an obvious use for retrieval augmented generation (RAG).”article, stated

query-rewriting (retrieval)

Instead of a full LLM rewrite in the first release, Vectorize appended the UI topic to the question to contextualize retrieval.

“for the first release of the AI Assistant I was getting good results by just appending the topic to the question when calling the retrieval endpoint”article, stated

retrieval-ranking (retrieval)

Retrieved results are scored by a reranking model and filtered before they reach the LLM.

“Our Vectorize retrieval endpoint (and RAG sandbox) has built-in support for reranking and relevance scoring if you set rerank to true”article, stated

guardrails-io-filtering (safety)

The prompt instructs the LLM to answer only from retrieved content and decline when relevant texts are unavailable.

“if there is no relevant information in the texts or there are no available texts, respond with "I'm sorry, I couldn't find an answer to your question."”article, stated

observability-tracing (operations)

The assistant records user feedback and recommends tracking retrieval relevance over time.

“Clicking on these buttons sends messages to our analytics system so we can track how users are responding to our AI assistant.”article, stated

Tradeoffs

Assistant placement

Chose embedded product assistant over standalone chat-with-docs bot.

Rationale: Embedding the assistant keeps the user in the workflow and uses page context for better retrieval.

“The user gets the information they need when they need it without a major context switch.”article, stated

Knowledge update strategy

Chose RAG over changing documentation and support answers over fine-tuning a foundation model repeatedly.

Rationale: RAG keeps changing docs and support answers fresh without repeated fine-tunes.

“We could fine tune a foundational model, but we are constantly updating our docs so repeated fine tuning is not practical.”article, stated

Model and retrieval reliability

Chose smaller fast model plus relevance filtering over larger model expected to tolerate bad context.

Rationale: Filtering improves determinism, latency, and cost while keeping generation quality acceptable.

“A larger model might have been able to deal better with low relevance data, but with our relevance filtering we have a more deterministic system”article, stated

Gotchas (what bit them)

Relevant documentation outside the product UI creates support friction.

Root cause: Users must leave the product and context switch to documentation or chat.

Resolution: Embed the assistant directly into relevant UI pages.

“reading our docs–like with most applications–requires you to leave the user interface and go to a different site”article, stated

Similarity search can retrieve unrelated chunks with close similarity scores.

Root cause: Vector similarity scores may be tightly clustered even when semantic relevance differs sharply.

Resolution: Use reranking relevance scores and filter below a threshold.

“If you look at the similarity scores returned by the vector database, there is really little difference between them, ranging from 0.71 to 0.74.”article, stated

Poor retrieved context makes the generator answer the wrong topic.

Root cause: Low-quality context confuses the LLM even when it has a large context window.

Resolution: Filter low-relevance chunks before generation.

“Although current LLMs all have large context windows so you can send them a lot of data, sending them poor quality data will do exactly what you would expect: confuse them.”article, stated

Evaluation

Vectorize used its RAG Sandbox to inspect retrieved chunks and LLM answers, experimented with relevance thresholds, added thumbs-up/down analytics, and planned retrieval relevance monitoring.

Metrics: similarity score · relevance score · 0.5 relevance threshold · thumbs-up/down feedback · retrieval relevance over time

“Vectorize has a handy feature called the RAG Sandbox so you can simulate the questions your users are asking and see exactly what is retrieved”article, stated
“For our AI assistant, we used standard thumbs-up and thumbs-down icons for the users to click on after an answer.”article, stated

Outcomes

The deployed assistant uses Llama 3.1 70B on Groq, a 0.5 relevance threshold, and support data from documentation, Discord, and Intercom.

“When I added this to the retrieval, it really improved the quality of the responses. The AI assistant was no longer giving unrelated answers.”article, stated
“This instruction prevents the LLM from hallucinating an answer to the question.”article, stated