gpuosBeta

Use cases · 2 min read · updated Oct 6, 2026

RAG on your own GPU: embeddings and chat with gpuos

Build RAG with BGE-M3 embeddings and Qwen3 on your GPU. Connect through the hosted gpuOS gateway with LangChain.

On this page

Where your RAG data goes

RAG sends document chunks to an embedding model and retrieved context to a chat model. With gpuos, those requests and responses pass through the hosted gateway, while Ollama runs both models on connected nodes. Keep this transport path in mind when deciding which documents your application can process.

Pick the two models

Start with BGE-M3 and Qwen3 8B, which are available on Community, and deploy both before running the example. Larger chat models use more memory and may require Pro. Memory estimates are a starting point; test indexing batches and chat contexts on your node.

The pipeline in 20 lines

Install
pip install langchain-openai langchain-core
rag.py
import os
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

BASE, KEY = "https://gpuos.si/v1", os.environ["GPUOS_API_KEY"]

embeddings = OpenAIEmbeddings(model="bge-m3", base_url=BASE, api_key=KEY, check_embedding_ctx_length=False)
llm = ChatOpenAI(model="qwen3-8b", base_url=BASE, api_key=KEY, temperature=0)

docs = [
    "Refunds are accepted within 30 days with the original receipt.",
    "Support is open Monday to Friday, 9:00 to 18:00 CET.",
]
store = InMemoryVectorStore.from_texts(docs, embeddings)

question = "Can I get a refund after three weeks?"
context = "\n\n".join(d.page_content for d in store.similarity_search(question, k=2))
answer = llm.invoke(f"Answer only from this context.\n\n{context}\n\nQuestion: {question}")
print(answer.content)

Swap InMemoryVectorStore for pgvector, Qdrant or any store LangChain supports; the gpuos parts stay the same.

Make it production-ready

  • Use separate API keys for the indexing job and the chat app, with a token quota on the indexing key.
  • Chunk documents to 500 to 1,000 tokens with some overlap; BGE-M3 accepts up to 8K but smaller chunks retrieve more precisely.
  • Watch Usage in the dashboard to see embedding and chat volumes separately.

Questions

Can I use LlamaIndex instead of LangChain?
Yes. Point OpenAILike at the gpuos endpoint for the LLM and use an OpenAI-compatible embedding class for bge-m3.
Do my documents pass through gpuos?
Yes. Text sent for embeddings and retrieved context sent for chat pass through the hosted gpuos gateway. Inference runs on connected nodes, and usage is recorded per key, model and node.

Related

Run it on your own GPU

Connect your GPU, deploy a catalog model and test the hosted API on a representative request. The quickstart explains the setup and data flow.