How to Create Your RAG
RAG (retrieval-augmented generation) grounds an LLM's answers in your own files instead of relying only on what the model already knows. This guide shows the fastest way to build a RAG pipeline: create a vector store, add files to it, and let the model retrieve relevant chunks on its own during response generation.
For a deeper look at vector store mechanics, manual search, and refining results yourself, see Using Vector Stores.
Prerequisites
During DeepFellow Server Installation, configure the components a vector store system needs:
- A vector database provider, either Qdrant or Milvus.
- An embedding model, which converts text into vectors.
Step 1: Create a Knowledge Base
Create a vector store, upload a file, and add the file to the vector store. See Using Vector Stores for the full walkthrough with request and response examples in cURL, Python, and TypeScript.
- Create a vector store with
POST /v1/vector_stores. - Upload a file with
POST /v1/files. - Add the uploaded file to the vector store with
POST /v1/vector_stores/{vector_store_id}/files.
curl -X 'POST' \
"https://deepfellow-server-host/v1/vector_stores/68ee6e626fef807dd40b2f80/files" \
-H "Authorization: Bearer DEEPFELLOW-PROJECT-API-KEY" \
-H 'Content-Type: application/json' \
-d '{ "file_id": "68ee6e636fef807dd40b2f82" }'Note the vector store's id. The next step uses it to point the model at this knowledge base.
Step 2: Ask a Question with Automatic Retrieval
Pass the file_search tool directly in POST /v1/responses, with vector_store_ids set to your vector store's id. The model decides when to search, runs the search itself, and grounds its answer in the retrieved chunks, so you don't write any retrieval or prompt-injection code yourself.
curl -X 'POST' \
"https://deepfellow-server-host/v1/responses" \
-H "Authorization: Bearer DEEPFELLOW-PROJECT-API-KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen3:8b",
"input": "What is Edulee?",
"tools": [
{
"type": "file_search",
"vector_store_ids": ["68ee6e626fef807dd40b2f80"]
}
]
}'import requests
response = requests.post(
"https://deepfellow-server-host/v1/responses",
json={
"model": "qwen3:8b",
"input": "What is Edulee?",
"tools": [
{
"type": "file_search",
"vector_store_ids": ["68ee6e626fef807dd40b2f80"],
}
],
},
headers={
"Content-Type": "application/json",
"Authorization": "Bearer DEEPFELLOW-PROJECT-API-KEY",
},
)
print(response.json())const response = await fetch('https://deepfellow-server-host/v1/responses', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer DEEPFELLOW-PROJECT-API-KEY'
},
body: JSON.stringify({
model: 'qwen3:8b',
input: 'What is Edulee?',
tools: [
{
type: 'file_search',
vector_store_ids: ['68ee6e626fef807dd40b2f80']
}
]
})
});
const data = await response.json();
console.log(data);Response, trimmed to the relevant output items:
{
"output": [
{
"type": "file_search_call",
"id": "fs_68ee6e646fef807dd40b2f83",
"status": "completed",
"queries": ["What is Edulee?"],
"results": [
{
"file_id": "68ee6e636fef807dd40b2f82",
"filename": "edulee.md",
"score": 0.5061247944831848,
"attributes": {},
"content": [
{
"text": "Edulee is an innovative online learning platform launched in 2019 that serves over 2 million users worldwide with more than 15,000 courses...",
"type": "text",
"offset": 0,
"metadata": {}
}
]
}
]
},
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Edulee is an online learning platform launched in 2019. It serves more than 2 million users worldwide and offers over 15,000 courses in technology, business, creative arts, and personal development."
}
]
}
]
}The file_search_call output item shows the query the model ran and the chunks it retrieved. The message item that follows is the model's answer, grounded in that content.
Narrow the search by adding filters, max_num_results, or ranking_options to the file_search tool definition. These are the same parameters POST /v1/vector_stores/{vector_store_id}/search accepts. See Using Vector Stores: Refine Search for the filter syntax.
Managing Vector Store Files
Two endpoints help you maintain the files in a vector store after DeepFellow indexes them.
Update file attributes
Tag a file with POST /v1/vector_stores/{vector_store_id}/files/{file_id}, which lets you target it later with a filters value in search or in the file_search tool.
curl -X 'POST' \
"https://deepfellow-server-host/v1/vector_stores/68ee6e626fef807dd40b2f80/files/68ee6e636fef807dd40b2f82" \
-H "Authorization: Bearer DEEPFELLOW-PROJECT-API-KEY" \
-H 'Content-Type: application/json' \
-d '{
"attributes": {
"document_type": "company_profile"
}
}'See the API reference for the full request and response schema.
Inspect parsed content
Retrieve the parsed chunks of a file with GET /v1/vector_stores/{vector_store_id}/files/{file_id}/content to verify what DeepFellow indexed, before you rely on it for retrieval.
curl -X 'GET' \
"https://deepfellow-server-host/v1/vector_stores/68ee6e626fef807dd40b2f80/files/68ee6e636fef807dd40b2f82/content" \
-H "Authorization: Bearer DEEPFELLOW-PROJECT-API-KEY"See the API reference for the full request and response schema.
Next Steps
- Using Vector Stores covers the full vector store API and a manual retrieval pattern, useful when you need full control over how retrieved context reaches the model.
- Using Tools covers the other built-in and MCP-based tools DeepFellow Server supports, including registering
file_searchinside a toolbox.
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.