Rag Pipeline logo

Rag Pipeline

Organization
brightdata
rag-pipeline

Build a RAG (retrieval-augmented generation) pipeline or a custom search engine on top of Bright Data's Discover API — using intent-ranked web results + parsed page content as the retrieval/ingestion layer for an LLM or vector store. Use when the user wants to "build a RAG pipeline", "add web search to my LLM/agent", "ground my model in live web data", "build a search engine over the web", "ingest web content into a vector DB / knowledge base", or "give my chatbot retrieval". Covers both live retrieval (Discover at query time as a web-grounded retriever) and ingestion (Discover → chunk → embed → vector store → retrieve). Built on the `discover-api` skill. For a one-off written report use `live-research`; for raw markdown of specific known URLs use `scrape`.

Overview

Publisherbrightdata
Repositoryskills
Skill namerag-pipeline
Stars
268
Forks
36
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by brightdata on GitHub. Read the source before you install it.

Installation

Install the Rag Pipeline AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/brightdata/skills/tree/main/skills/rag-pipeline
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/brightdata/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/rag-pipeline .claude/skills/rag-pipeline
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Rag Pipeline in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Rag Pipeline on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Rag Pipeline is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Bright Data — RAG / Search-Engine Pipeline

Use Discover as the retrieval layer for an LLM app or a custom search engine. Discover already returns intent-ranked, relevance-scored results with parsed page content, so it does the "search + fetch + clean" stage of RAG for you. This is a code/architecture skill built on the discover-api skill — read that for API mechanics (trigger/poll, modes, params, limits).

Pick the right neighbor: a written brief → live-research; markdown of specific URLs you already have → scrape; structured platform records → data-feeds.

Two architectures — choose first

Does the corpus change every query, or is it a stable knowledge base?

  ├── Per-query, always-fresh ("ground each answer in live web data")
  │     → LIVE RETRIEVAL: Discover(include_content) at query time → top-k → LLM
  │       Pros: always current, no storage. Cons: per-query latency + cost.
  │
  └── Reused across many queries ("build a knowledge base / search engine")
        → INGESTION: Discover(include_content) → chunk → embed → vector store
          then at query time: embed query → vector search → (rerank) → LLM
          Pros: fast queries, cacheable. Cons: can go stale (re-ingest on a schedule).

Many systems do both: an ingested base for breadth + a live Discover call for freshness, merged before the LLM.

Live retrieval (web-grounded answers)

Pattern: on each user question, run Discover with a sharp intent, take the top-k by relevance_score, and pass their content as context to the LLM. The LLM cites the links.

javascript
import { bdclient } from '@brightdata/sdk';
const client = new bdclient(); // BRIGHTDATA_API_TOKEN

async function retrieve(question, k = 6) {
  const res = await client.discover(question, {
    intent: `authoritative sources that directly answer: ${question}`,
    includeContent: true,
    numResults: Math.min(k * 2, 20),  // over-fetch, then trim
  });
  // NOTE: the JS SDK returns a WRAPPER object, not a bare array:
  //   { success, data: [ {link,title,description,relevance_score,content?} ], totalResults, cost, taskId, ... }
  // The result rows are in `.data` (CLI/REST use `.results` instead — see discover-api).
  if (!res.success) throw new Error(`discover failed: ${res.error ?? 'unknown'}`);
  return (res.data ?? [])
    .filter(r => r.content && !/just a moment|captcha|access denied|not found/i.test(r.content) && r.content.length > 200)
    .sort((a, b) => b.relevance_score - a.relevance_score)
    .slice(0, k);
}
// → build a prompt from sources[].content, ask the LLM to answer WITH [n] citations to sources[].link

Full prompt-assembly + citation pattern: references/code.md.

Ingestion (build a vector knowledge base / search engine)

Pattern: discover broadly (high volume — zeroRanking via REST is ideal here), chunk each page's content, embed the chunks, upsert into a vector store with the source URL as metadata. At query time: embed the query, vector-search, optionally rerank, then feed to the LLM.

Stages: discover → dedup → chunk → embed → upsert (ingest), then embed query → search → rerank → generate (serve). Provider-agnostic code for both stages, including chunking and metadata, is in references/code.md.

For bulk corpus building, prefer the raw REST "mode":"zeroRanking" flow (max raw results, no ranking) from the discover-api skill — but note it ignores num_results and does not support include_content, so you fetch content separately (Discover standard/deep with content, or the scrape skill).

Design rules

  • Store provenance. Every chunk keeps its source link (and ideally title + relevance_score). RAG without citations is unverifiable.
  • Chunk for the model, not the page. ~500–1500 tokens with overlap; split on headings/paragraphs, not mid-sentence.
  • Validate content before embedding. Skip block pages and empty bodies (oversized PDFs return null content). Embedding garbage poisons retrieval.
  • Over-fetch then trim by relevance_score. Discover's score is a strong prior for top-k selection before (or instead of) a reranker.
  • Re-ingest on a schedule if freshness matters — web content drifts. The ingested base goes stale; live retrieval doesn't.
  • Cap and dedup. num_results ≤ 20 per call; dedup by normalized URL across calls so one article via three aggregators isn't triple-weighted.
  • Keep the embedder/vector store pluggable. Discover is the retrieval source; the embedding model and vector DB are your choice — don't hardwire one.

Verification gate

  1. Retrieval returns non-empty, on-topic chunks for a known test query (eyeball top-k links).
  2. No block-page / empty content made it into the index — spot-check stored chunks.
  3. Citations resolve — every [n] the LLM emits maps to a real source link in the retrieved set.
  4. Freshness is honored — if the app promises current data, confirm live retrieval (or a recent re-ingest), not a stale index.
  5. Grounding check — answers are supported by retrieved content, not the model's prior; test with a question whose answer only exists in a retrieved page.

Red flags

  • Building an ingestion pipeline when the user needs fresh answers (use live retrieval), or hammering Discover live when a cached index would do.
  • Embedding content without filtering block pages / nulls.
  • Dropping source URLs — you can't cite or refresh what you didn't store.
  • Treating num_results as unlimited (cap 20) or expecting include_content under zeroRanking.
  • Letting the LLM answer from training data — enforce "answer only from provided sources; if absent, say so."
  • One giant chunk per page (kills retrieval precision) or mid-sentence splits.

References

  • references/code.md — runnable JS + Python for both architectures: live retrieval with prompt+citation assembly, and the full ingestion pipeline (discover → dedup → chunk → embed → upsert → query), with a provider-agnostic embedder/vector-store interface.

Related skills

  • discover-api — the retrieval API (trigger/poll, modes, include_content, limits). Read first.
  • live-research — one-off synthesized report instead of a standing system.
  • scrape — fetch markdown for specific URLs you already have.
  • js-sdk-best-practices / python-sdk-best-practices — client.discover() option details and batch patterns.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Rag Pipeline AI skill do?

Build a RAG (retrieval-augmented generation) pipeline or a custom search engine on top of Bright Data's Discover API — using intent-ranked web results + parsed page content as the retrieval/ingestion layer for an LLM or vector store. Use when the user wants to "build a RAG pipeline", "add web search to my LLM/agent", "ground my model in live web data", "build a search engine over the web", "ingest web content into a vector DB / knowledge base", or "give my chatbot retrieval". Covers both live retrieval (Discover at query time as a web-grounded retriever) and ingestion (Discover → chunk → em...

Why use Rag Pipeline on TypingMind?

Because you install it once and use it with any model. Rag Pipeline is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Rag Pipeline in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/brightdata/skills/tree/main/skills/rag-pipeline. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Rag Pipeline?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Rag Pipeline?

As many as you like. As long as a model supports skills, you can use Rag Pipeline with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Rag Pipeline AI skill free?

Yes. It is published on GitHub by brightdata under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇