Raw Code

Darnytsia

Retrieval-Augmented Generation Chatbots

Context-aware chatbots that combine ChatGPT with a retrieval layer so answers are grounded in the client's own reference material.

A chatbot interface on a phone screen

The problem

A general-purpose chatbot answers from whatever the model already knows. Darnytsia needed answers that matched its own reference material, so the bots look up the relevant source documents first and answer from those.

What we built

  • Python backend combining NLP with retrieval-augmented generation
  • Retrieval layer for real-time access to source documents
  • Dockerized deployment on Azure App Service

How this kind of system works

A general explanation of the technique behind the tools above. What was specific to this project is in the sections before it.

Prepare the source material

Reference documents are split into passages a few paragraphs long, and each passage is turned into an embedding: a list of numbers that captures what it means. Those embeddings go into a search index.

Search before answering

A new question is turned into an embedding too, and the closest passages are pulled from the index. This step decides most of the answer's quality. If the right passage isn't found, the model can't use it.

Answer from what was found

The question and the passages go to the language model, here through the ChatGPT API, with an instruction to answer from those passages. A good setup also tells the model to say so when the passages don't contain the answer, instead of guessing.

Keep it current

Changing a document means re-indexing that document, not retraining a model, so answers change as soon as the source does.

Related service: AI Automation Consulting & Implementation.

More work like this: AI Chatbot Development in Toronto, Semantic Search Development in Toronto.

On the blog: RAG, a classifier, or plain code? Picking the right tool for an AI automation.

Delivered by Pavlo Holubchykov, Raw Code's Lead ML/AI Developer.

Outcome metrics for this project haven't been independently verified yet — figures will be added here once confirmed rather than estimated.

More work

Want something like this built?

Book free consultation