Pricing verified as of 2026-08-19. DeepSeek changed to peak/off-peak pricing on 2026-08-17.
title: "Building a RAG Pipeline with Chinese AI Models"
published: true
tags: rag, chinese-ai, langchain, embedding
canonical_url: https://aiwave.live/blog/rag-pipeline-chinese-ai-models
description: "Build a RAG pipeline using Chinese AI models like DeepSeek and GLM. Covers embedding selection, chunking strategies, and a complete Python implementation without LangChain."
A rate comparison only holds for a stated token mix and date. Recalculate it against your workload before changing traffic.
Available through AIWave with OpenAI-compatible APIs.
Documents → Chunking → Embedding → Vector Store → Query Embedding → Similarity Search → LLM → Answer
For Chinese text, embedding model choice matters:
| Model | Dimensions | Chinese | Cost | Source |
|---|---|---|---|---|
| text-embedding-3-small | 1536 | OK | $0.02/1M tokens | OpenAI |
| bge-m3 | 1024 | Excellent | $0 API spend (local compute) | BAAI |
| bge-large-zh-v1.5 | 1024 | Excellent | $0 API spend (local compute) | BAAI |
For Chinese-heavy content, BGE models (from BAAI) outperform OpenAI's embeddings. bge-m3 supports multilingual text and is small enough to run locally.
Chinese text chunking differs from English:
def chunk_text(text, chunk_size=800, overlap=200):
chunks = []
start = 0
while start < len(text):
end = start + chunk_size
chunks.append(text[start:end])
start = end - overlap
return chunks
Use FAISS (local, with no hosted API charge) or a hosted solution:
import faiss
import numpy as np
from openai import OpenAI
client = OpenAI(api_key="***", base_url="https://aiwave.live/v1")
embeddings = []
for chunk in chunks:
resp = client.embeddings.create(
model="text-embedding-3-small",
input=chunk
)
embeddings.append(resp.data[0].embedding)
index = faiss.IndexFlatIP(len(embeddings[0]))
index.add(np.array(embeddings).astype('float32'))
def query_rag(question, index, chunks, top_k=3):
resp = client.embeddings.create(
model="text-embedding-3-small",
input=question
)
query_vec = np.array([resp.data[0].embedding]).astype('float32')
distances, indices = index.search(query_vec, top_k)
context = "\n\n".join([chunks[i] for i in indices[0]])
response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "system", "content": "Answer based on the provided context."},
{"role": "user", "content": f"Context:\n{context}\n\nQuestion: {question}"}
]
)
return response.choices[0].message.content
Using DeepSeek V4 Flash ($0.638/$1.914) for generation and text-embedding-3-small for retrieval:
Compare to GPT-4o: ~$60/month for the same workload.
Top-ups start at $5. Estimate the test budget from the live rate card.