dify-knowledge-base-search
Skill11 starsChanged 3 months agoMITView on GitHub
Dify dataset retrieve API for knowledge base chunk search/testing. Use when integrating or debugging Dify knowledge base retrieval requests, retrieval_model options, or response shaping.
- Reads credentials
In this repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- academic-paper-downloadSkill
- airnow-hourly-obs-fetchSkill
- ai-tech-fulltext-fetchSkill
- ai-tech-rss-fetchSkill
- ai-tech-summarySkill
- apply-environmental-thinkingSkill
- bluesky-cascade-fetchSkill
- convert-image-to-jpgSkill
- dify-knowledge-base-uploadSkill
- document-granular-decomposeSkill
- domain-onboardingSkill
- eceee-news-fulltext-fetchSkill
- email-imap-appendSkill
- email-imap-fetchSkill
- email-imap-full-fetchSkill
- email-smtp-sendSkill
- epa-eis-records-fetchSkill
- federal-register-doc-fetchSkill
- fetch-abstract-to-kbSkill
- fetch-meta-from-kbSkill
- fetch-meta-to-kbSkill
- figshare-data-downloadSkill
- gdelt-doc-searchSkill
- gdelt-events-fetchSkill
- gdelt-gkg-fetchSkill
- gdelt-mentions-fetchSkill
- gdelt-web-ngrams-searchSkill
- github-contribution-period-analysisSkill
- nasa-firms-fire-fetchSkill
- notebooklmSkill
- openaq-data-fetchSkill
- open-meteo-air-quality-fetchSkill
- open-meteo-flood-fetchSkill
- open-meteo-historical-fetchSkill
- regulationsgov-attachments-fetchSkill
- regulationsgov-comment-detail-fetchSkill
- regulationsgov-comments-fetchSkill
- remove-similar-imageSkill
- river-outfall-status-visualizerSkill
- sustainability-fulltext-fetchSkill
- sustainability-rss-fetchSkill
- sustainability-summarySkill
- synology-file-stationSkill
- tiangong-auto-researchSkill
- tiangong-auto-research-workbuddySkill
- tiangong-kb-course-fulltext-fetchSkill
- tiangong-kb-course-searchSkill
- tiangong-kb-edu-searchSkill
- tiangong-kb-esg-searchSkill
- tiangong-kb-ingestSkill
- tiangong-kb-patent-searchSkill
- tiangong-kb-report-searchSkill
- tiangong-kb-sci-searchSkill
- tiangong-kb-textbook-searchSkill
- tsinghua-graduate-thesisSkill
- usbr-project-records-fetchSkill
- usbr-rise-fetchSkill
- use-thuenv-presentation-styleSkill
- usgs-water-iv-fetchSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Read these env vars:
- Very specific: line 20
Use assets/example-request.json as the payload template.
- Very specific: line 32
If records is empty, increase retrieval_model.top_k moderately and retry.
- Very specific: line 35
If auth fails, verify DIFY_API_KEY and Authorization header format.
- Very specific: line 36
If route fails, verify DIFY_API_BASE_URL includes /v1.
- Very specific: line 37
If results are low quality, refine query and tune top_k.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Dify Knowledge Base Search
Prepare required inputs
- Provide
dataas JSON containingqueryand optionalretrieval_model.top_k. - Read these env vars:
DIFY_API_BASE_URL: base API URL and include/v1(example:https://api.dify.ai/v1).DIFY_DATASET_ID: target dataset ID.DIFY_API_KEY: send asAuthorization: Bearer <DIFY_API_KEY>.
Send request
- Endpoint:
${DIFY_API_BASE_URL}/datasets/${DIFY_DATASET_ID}/retrieve - Headers:
Content-Type: application/jsonAuthorization: Bearer <DIFY_API_KEY>
- Use
assets/example-request.jsonas the payload template.
curl -sS --location --request POST "$DIFY_API_BASE_URL/datasets/$DIFY_DATASET_ID/retrieve" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DIFY_API_KEY" \
--data @assets/example-request.jsonInterpret response
- Request shape:
{ "query": string, "retrieval_model"?: { "top_k": number } } - Success shape: 200 with
{ query, records: [...] } - If
recordsis empty, increaseretrieval_model.top_kmoderately and retry.
Troubleshoot quickly
- If auth fails, verify
DIFY_API_KEYandAuthorizationheader format. - If route fails, verify
DIFY_API_BASE_URLincludes/v1. - If results are low quality, refine
queryand tunetop_k.
References
references/env.mdreferences/request-response.mdreferences/testing.md
Assets
assets/example-request.json
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

