# LLM integration and RAG, built to be right.

Source: https://mirrorcode.com/services/llm-integration/

Last updated: 27 November 2026

> LLM features inside your product that answer from your own data, cite their sources, and stay accurate and affordable as usage grows.

- **What you get:** A production LLM feature with retrieval, evaluations, cost controls and monitoring.
- **Timeline:** Audit in 1 week. First feature live in 2–4 weeks.
- **How to start:** A 30-minute call, then a one-week audit of your data and use case.

## Accuracy is a design choice

An LLM feature is only as good as the information it’s given. Most poor answers come from retrieval, not from the model: the right paragraph never reached it, or an outdated one did.

So we build retrieval first and measure it on its own, then the answers, then cost and speed. Every step is checked against real questions from your users, which turns “it seems fine” into numbers you can track after launch.

## A good fit

- Lots of documents, tickets or records that people search every day
- A product where users ask the same questions in many different ways
- Data that changes often, so answers must stay current
- A need for answers with sources people can check

## Not a fit

- Facts that fit on one page (a well-written FAQ is enough)
- Tasks that need exact calculations rather than language
- Projects with no way to tell whether an answer is right
- Data that may not go to any model, and no budget to host one

## Use cases

### Search and Q&A over documents

Answers from your manuals, policies, contracts or knowledge base, with links to the exact source.

### Summaries

Short, consistent summaries of long documents, calls, tickets or reports, in the format your team needs.

### Extraction into structured data

Turn PDFs, emails and forms into clean fields in your database, with human review for low-confidence cases.

### Classification and routing

Tag, prioritise and route incoming items, with accuracy measured against your own labels.

### In-product assistants

An assistant inside your app that knows the user’s context and your docs, and hands over to support when it should.

### Cost and speed tuning

Make an existing LLM feature cheaper and faster with caching, model routing and prompt changes, checked by evaluations.

## Choosing the right design

### RAG (retrieval-augmented generation)

- Fits when: Large or frequently changing data, and answers that need sources.
- Watch out: Retrieval quality is everything. Chunking, metadata and search need tuning.

### Long context

- Fits when: A small set of documents per question that fits in the model’s context window.
- Watch out: Gets slower and more expensive as documents grow. Caching helps.

### Fine-tuning

- Fits when: A consistent output style or format at high volume, where prompts alone fall short.
- Watch out: Needs good training data and doesn’t add knowledge. Rarely the first step.

### Structured extraction

- Fits when: Turning messy inputs into fields with a fixed schema.
- Watch out: Needs validation and a review path for low-confidence results.

## How a feature pilot runs

- **Week 0: Data and questions.** We collect real questions and the documents that should answer them, and agree what a good answer looks like.
- **Week 1: Retrieval first.** We build the search over your data and measure whether the right sources come back, before any answer is generated.
- **Week 2: Answers and evaluations.** Answers with citations, scored against the test set for accuracy, completeness and tone.
- **Week 3: Cost and speed.** Caching, model routing and limits, so each answer has a known cost and response time.
- **Week 4: In front of users.** The feature goes live for a group of users behind a feature flag, with feedback buttons and monitoring.

## Included

- Data ingestion and indexing for your sources
- Retrieval, prompts and answers with citations
- An evaluation set and automated quality checks
- Cost controls: caching, model routing and limits
- Monitoring for quality, cost and latency

## Not included

- Cleaning up years of outdated documents (we’ll flag what needs it)
- Model provider fees (billed to you directly)
- Building your whole product UI (available as a separate build)

## Typical stack

Claude API, OpenAI API, Open-weight models, PostgreSQL, pgvector, TypeScript, Python, FastAPI, Next.js

## Ways to start

1. **AI audit** (1 week): Use cases ranked by value and risk, an architecture sketch, a running-cost estimate and a written proposal with a fixed quote for the pilot.
2. **Pilot sprint** (2–4 weeks): One agent or feature built end to end and measured against success criteria agreed before work starts. It ends with a go or no-go decision.
3. **Build & support** (Ongoing): Roll it out, extend it and keep it running, or hand it to your team with docs and tests.

## FAQ

### What is RAG, in plain terms?

Retrieval-augmented generation means the model first searches your own data for the relevant passages, then writes the answer from them and cites them. Answers stay current and checkable without retraining a model.

### How do you stop the model from making things up?

By grounding every answer in retrieved sources, requiring citations, testing against real questions with known answers, and letting the feature say “I don’t know” when the sources don’t cover the question.

### Can our data stay private?

Yes. Business API plans don’t train on your data, access can be limited per user, and if data can’t leave your infrastructure we can use an open-weight model you host.

### Claude or OpenAI?

Whichever scores better on your examples for the cost. We test both, and often use a cheaper model for simple steps and a stronger one where quality matters. The design lets you switch later.

### What will it cost per month?

It depends on volume. The audit gives a cost estimate per question, and caching and routing usually bring it down a lot. Hard limits stop surprises.

### Do we need fine-tuning?

Rarely at the start. Good retrieval and prompts solve most problems. Fine-tuning makes sense later, for consistent formats at high volume.

## Related services

- [AI agents & automation](https://mirrorcode.com/services/ai-agent-development/)
- [AI-assisted product builds](https://mirrorcode.com/services/ai-mvp-development/)
- [Web & mobile apps](https://mirrorcode.com/services/web-mobile-development/)

## Contact

- Email: mirrorcode.office@gmail.com
- Book a 30-minute call: https://calendly.com/mirrorcode/intro-call
- Working worldwide · CET time zone
