Guide

Build RAG on EU GPUs

Link your knowledge base to the Router and give your models context from your own documents.

On this page

What RAG does for you

With Retrieval Augmented Generation (RAG) you ground answers in your own documents instead of only the model's training knowledge. HostYourAI provides the open models and the EU GPU infrastructure; you decide what knowledge goes in. Documents, prompts and answers stay inside Europe end to end.

Step 1, Create a knowledge base

Upload documents (PDF, TXT, CSV, MD or DOCX) or crawl a URL or sitemap. Your content is split into chunks of about 1000 characters with 100 characters of overlap, on sentence boundaries. Each chunk gets an embedding (384-dimensional). Small files (< 50MB) are fully pre-embedded for fast retrieval; large files use a hybrid mode with FULLTEXT plus on-demand embedding.

je vraag
doc-4f2a0.94
doc-9c1e0.91
doc-2b770.88

There are three ways to attach a knowledge base to your chat requests:

  • Link to an instance (recommended): POST /api/kb/{kbId}/link/{instanceId}. Every chat request to that instance then gets context automatically, including via an external hyai- key.
  • Link to an agent: set knowledge_base_id on the agent; the public chat uses it automatically.
  • Explicit per request: pass knowledge_base_id in the body of your chat completion.

Step 3, Ask with context

curl https://hostyourai.com/api/v1/chat/completions \
  -H "Authorization: Bearer hyai-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.3-70b",
    "messages": [{"role":"user","content":"What is our return policy?"}],
    "knowledge_base_id": 42
  }'

The Router retrieves the most relevant chunks with cosine similarity (minimum threshold 0.3), injects the top 5 into the prompt, and generates an answer grounded in your documents.

Source citations

Non-streaming answers include an extra sources array with document name, score, chunk index and an excerpt, so you can trace every answer back to its source. On streaming, context is still injected, but sources cannot be returned in the SSE chunks.

Robust and compliant

Retrieval failures are graceful: if retrieval fails, the chat continues without context instead of erroring. And because everything runs on EU GPUs, your entire RAG pipeline, from documents to answer, stays inside Europe.

Reference: the pipeline settings at a glance

These values determine how your documents are processed and retrieved. They are fixed, so quality stays predictable across all your knowledge bases.

SettingValue
Chunk sizeAbout 1000 characters, split on sentence boundaries
Overlap100 characters between consecutive chunks
Embeddings384-dimensional vectors per chunk
SimilarityCosine similarity, minimum threshold 0.3
Context per requestTop 5 most relevant chunks
Processing modeFully pre-embedded under 50MB, hybrid above that

Troubleshooting

My answers do not contain a sources array

Source citations only work on non-streaming answers. Turn stream off for requests where you need the sources; with streaming, context is still injected but the sources do not fit in the SSE chunks.

The model seems to ignore my documents

First check that the knowledge base is actually linked: to the instance, to the agent, or via knowledge_base_id in the request body. Then check that your documents have finished processing; right after an upload, processing is still running in the queue.

I get 401 Unauthorized

Your API key must start with hyai- and be copied in full, and the base URL must be exactly https://hostyourai.com/api/v1. A key from another provider does not work.

The first answer takes long

The chosen model is probably not warm yet. The Model Garden shows whether a model is warm or still warming up; after that, follow-up requests respond quickly.

Questions about this guide

Which file formats can I upload?

PDF, TXT, CSV, MD and DOCX. You can also crawl a URL or a complete sitemap; the pages go through the same processing pipeline.

Does RAG also work on a dedicated instance?

Yes. Link the knowledge base to your dedicated GPU instance and every chat request automatically gets context, including via an external API key.

What does RAG cost?

You pay for the inference itself: pay-as-you-go per token through the Router, or per hour on your own instance. See the pricing page.

Which model should I pick for RAG?

Open models such as Llama, Qwen and Mistral do well on question answering over documents. Compare the options in the Model Garden and test in the Playground.

Do my documents stay inside the EU?

Yes. Storage, embeddings and inference run in European datacenters; documents, prompts and answers never leave the EU.

Everything you need for AI

From model hosting to a customer-facing API, it is built for developers and businesses who want their AI running on infrastructure they actually control, inside the EU.

100%
EU-hosted

Your data and your models stay on European GPUs. GDPR-friendly by design.

200+
Verified models, ready to serve

Llama, Qwen, DeepSeek, Mistral, FLUX and plenty more. Pick one and it is warm in minutes, with no DevOps on your end.

2 SDK
OpenAI & Anthropic compatible

Point your existing client at the Router and keep your tools. No rewrite, no lock-in.

From zero to a warm endpoint in minutes

No infra to manage. Pick a model, get an OpenAI-compatible URL, ship.

1

Pick a model

Choose from the Model Garden or paste any HuggingFace ID. Set the VRAM and pick an EU GPU.

2

Get your endpoint

We deploy vLLM, run readiness probes, and hand you a warm OpenAI- and Anthropic-compatible URL plus an API key.

3

Route and ship

Point your client at the Router. It auto-routes to a warm instance, idles GPUs when nobody is online, and logs every request.

Built for teams that can't send data away

If a US cloud is off the table, HostYourAI gives you the same developer experience on European infrastructure.

Public sector & government

Citizen data that legally has to stay in the EU, with full auditability.

Regulated enterprise

Finance, healthcare and legal teams under GDPR, DORA and the AI Act.

EU SaaS & scale-ups

Ship AI features your customers trust, without a US sub-processor.

Agencies & integrators

Deliver private AI for clients on infrastructure you can stand behind.

Private by Default

HostYourAI keeps your models, prompts and data on European GPUs. It is built for teams that care about compliance, reliability and real control.

EU-hostedGDPR-friendlyOpenAI-compatiblevLLM-poweredNo lock-in
EU
Full data sovereignty

GPUs and data residency inside Europe. Your prompts never leave the EU.

Open
Models you can audit

Run open-weight models with no black boxes or hidden telemetry.

€0
Scale to zero

GPUs idle when nobody is online, so you only pay for what you run.

Yours
No vendor lock-in

Your infra, your keys, your models. Leave whenever you want.

Model garden

Works with 390+ open models

Text and image models on dedicated EU GPUs. Every model tested on our own hardware.

Related pages

Explore more about EU-hosted AI on HostYourAI.

Host. Route. Ship.

No credit card required. Pay as you go, cancel anytime.

Start Hosting Free Today