data-and-rag
Use DB-GPT 0.8.1 data and RAG workflows for local documents, datasource schema inspection, chunking, embeddings, retrieval, knowledge indexing, vector stores, and graph stores; route live knowledge or datasource CRUD to the API/client skill and provider setup to model serving.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-and-rag
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use DB-GPT 0.8.1 data and RAG workflows for local documents, datasource schema inspection, chunking, embeddings, retrieval, knowledge indexing, vector stores, and graph stores; route live knowledge or datasource CRUD to the API/client skill and provider setup to model serving.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/connectors-and-stores.md7.6 KB
- 参考文档references/data-formats.md6.8 KB
- 参考文档references/rag-api-reference.md9.4 KB
- 参考文档references/troubleshooting.md9.3 KB
- 参考文档references/workflows.md6.9 KB
- 脚本scripts/local_rag_smoke.py9.8 KB
03 SKILL.md 正文
DB-GPT data and RAG
Use this route when the task mentions DB-GPT knowledge spaces, document ingestion, CSV/Markdown/TXT/PDF/DOCX/XLSX loading, chunk parameters, schema RAG, embeddings, retrievers, Chroma, BM25/full-text, Milvus, Qdrant, graph RAG, or vector/graph storage. This skill covers package-level construction and validation for DB-GPT 0.8.1. It does not perform live service CRUD or install model/provider backends.
Route first
- Local file or text ingestion: use data-formats.md.
- Chunking, knowledge objects, assemblers, retrievers, and signatures: use rag-api-reference.md.
- SQLite or another database, schema introspection, vector/full-text/graph backend selection: use connectors-and-stores.md.
- An end-to-end local-to-index-to-retrieve plan or configuration: use workflows.md.
- Failures, skipped documents, missing extras, bad embeddings, or remote services: use troubleshooting.md.
- CRUD of datasource/knowledge spaces, uploads, or chat endpoints: hand off
to
apis-client-and-sandbox; retain only the indexing/storage semantics here. - Provider packages, API keys, local model downloads, or serving: hand off to
models-and-serving. - Generic
dbgptcommand routing, profiles, or workspace setup: hand off tosetup-and-cli.
Operating contract
Input is one or more local documents, a Knowledge object, or a configured
BaseConnector, plus an explicit index/retrieval strategy. Output is a
validated list of documents/chunks, a persisted index/assembler, or retrieved
Chunk objects with content, metadata, ids, and optionally scores. Keep the
following invariant visible:
source -> loader -> Document -> ChunkManager -> index store -> retriever -> context
Indexing and conversation are separate. Do not imply that retrieval re-indexes
source files. Preserve source metadata (source, row/page/sheet identifiers,
headers, and stable document/chunk ids) so downstream answers can be traced.
Standard workflow
- Classify the input and trust boundary. Prefer a local, tiny fixture for parser or splitter checks. Treat URLs, uploaded files, databases, vector services, graph services, and provider calls as external state. Do not fetch a URL or connect to a service unless the user explicitly supplied a safe endpoint and permission.
- Select the loader.
KnowledgeFactory.create(datasource=..., knowledge_type=...)orKnowledgeFactory.from_file_path(...)dispatches document extensions;KnowledgeFactory.from_text(...)is deterministic and local. Use the concrete knowledge class when encoding, source columns, or loader behavior must be controlled. - Load and inspect before indexing. Check file existence, readable encoding, non-empty content, document count, metadata, and parser-specific warnings. Reject an empty input or record a deterministic skip rather than persisting an empty vector. For a mixed directory, process each file independently and report skipped files with reasons.
- Choose chunking deliberately. Start with
ChunkParameters()(size 512, overlap 50) only when its defaults fit the input. Select a supportedchunk_strategy:CHUNK_BY_SIZE,CHUNK_BY_PAGE,CHUNK_BY_PARAGRAPH,CHUNK_BY_SEPARATOR, orCHUNK_BY_MARKDOWN_HEADER. Ensurechunk_overlap < chunk_size; use zero overlap for independent rows/pages and positive overlap for prose continuity. - Build the assembler. Use
EmbeddingAssemblerwith anIndexStoreBasefor semantic retrieval,BM25Assembleronly with an explicitly reachable Elasticsearch service, orDBSchemaAssemblerfor database schema chunks. Pass an embedding function explicitly for vector stores; do not silently substitute a remote/provider model. - Persist and retrieve. Prefer bounded batches through
assembler.persist(max_chunks_once_load=..., max_threads=...)or the assembler's async equivalent. Callas_retriever(top_k=...), thenretrieve,retrieve_with_scores,aretrieve, oraretrieve_with_scores. Record the score threshold and filters used. - Validate the result. Confirm all accepted chunks have non-empty content, source metadata, unique ids, and the expected chunk bounds/overlap. For a vector store, probe the embedding dimension before the first network or persistent write and fail early on a mismatch. For schema RAG, verify table and field metadata and that the final retrieved content is usable SQL/schema context.
- Report boundaries. State which checks were local/import-only, which backend was actually exercised, and which GPU, provider, database, vector, or graph service was skipped.
API and configuration anchors
ChunkParametersis a Pydantic model withchunk_strategy=None,text_splitter=None,splitter_type=SplitterType.USER_DEFINE,chunk_size=512,chunk_overlap=50,separator="\n", andenable_merge=None.KnowledgeFactory.createacceptsdatasource,knowledge_type, and optional metadata. Supported factory modes includeDOCUMENT,URL, andTEXT; URL loading is network-bound and is not a local parser smoke test.SQLiteConnectorParameters(path, check_same_thread=False, driver="sqlite")uses a required path;:memory:is valid.SQLiteConnector.from_parametersandSQLiteConnector.from_file_pathcreate SQLAlchemy-backed connectors.EmbeddingAssembler.load_from_knowledgerequiresknowledgeandindex_store; it optionally accepts chunk parameters,embedding_model,embeddings, and aRetrieverStrategy.as_retriever(top_k=4)returns an embedding retriever by default.BM25Assembler.load_from_knowledgerequiresknowledgeand anElasticsearchStoreConfig; its defaults are index namedbgpt,k1=2.0, andb=0.75. Construction and persistence contact Elasticsearch.DBSchemaAssembler.load_from_connectionrequires a connector and table vector store, optionally a field vector store, chunk parameters, embedding settings, andmax_seq_length=512.ChromaVectorConfigacceptspersist_path,collection_metadata, user and password fields, and load concurrency fields.ChromaStorerequires aChromaVectorConfig, collectionname, and a non-null embedding function; Chroma is local/persistent when configured with a local path, but it still writes state and must use a disposable test directory for checks.- RAG configuration commonly controls
chunk_size,chunk_overlap,similarity_top_k,similarity_score_threshold,query_rewrite,max_chunks_once_load,max_threads, andrerank_top_k. Graph settings add extraction, similarity, community, and graph-search controls. Keep secrets in environment/config management, never in a skill example.
Validation shortcut
For an offline smoke that does not import DB-GPT or contact Elasticsearch, Chroma, an embedding provider, or a graph service, run the bundled helper:
python scripts/local_rag_smoke.py --help
python scripts/local_rag_smoke.py --fixture-dir ./tiny-rag-fixture --chunk-size 32 --chunk-overlap 4
The helper creates no files unless --fixture-dir is supplied, uses only the
Python standard library, reports deterministic skips for unsupported or invalid
files, chunks local text/Markdown/CSV, and can inspect a SQLite schema. It is a
fixture validator, not a substitute for DB-GPT's loader or backend behavior.
Quality and safety gates
- Never treat a successful import as proof that a parser, embedding model, vector index, or graph service works.
- Never use the original checkout, source-relative examples, private paths, or credentials as runtime dependencies.
- Do not send malformed/empty documents to a remote index. Make invalid-file handling explicit: skip with a warning for batch ingestion, or fail fast when the caller requested strict all-or-nothing behavior.
- Do not reuse a vector collection across embedding models without checking its dimension and model identity. A dimension mismatch must be rejected before network/persistent writes.
- Do not claim BM25, Milvus, Qdrant, Elasticsearch, TuGraph, Neo4j, Memgraph, MySQL, or provider coverage from CPU-only local tests. The confirmed baseline is CPU plus local file/SQLite behavior; external services are optional.
- Knowledge-space creation, document upload/delete, datasource CRUD, and chat are service/API operations. Route them to the API/client sub-skill and preserve deletion/duplicate semantics there.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).