tiangong-ai/agent-skills113 installs
dify-knowledge-base-search
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.
How do I install this agent skill?
npx skills add https://github.com/tiangong-ai/agent-skills --skill dify-knowledge-base-searchIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides a standard interface for interacting with Dify's Knowledge Base API using environment variables for secure credential management. It is subject to a low risk of indirect prompt injection when processing data retrieved from the external API.
- Socketpass
No alerts
- Snykwarn
Risk: MEDIUM · 1 issue
What does this agent skill do?
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.json
Interpret 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
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/tiangong-ai/agent-skills/dify-knowledge-base-search">View dify-knowledge-base-search on skillZs</a>