Interface DifyDatasetClient
public interface DifyDatasetClient
Dify Dataset Client Interface
Provides methods to interact with Dify's dataset API for managing datasets,
documents, segments, and related operations.
- Since:
- 2025/4/8 13:46
- Version:
- 0.8.0
- Author:
- yanghq
-
Method Summary
Modifier and TypeMethodDescriptionvoidactionMetaData(MetaDataActionRequest request) Performs an action on metadatavoidbindingTag(TagBindingRequest request) Bind tags to a resource (such as dataset, model, etc.)changeDocumentStatus(String datasetId, Set<String> documentIds, DocActionEnum status, String apiKey) Change the status of a documentcreate(DatasetCreateRequest request) Creates a new datasetCreates a document in a dataset using a fileCreates a document in a dataset using text contentcreateMetaData(MetaDataCreateRequest request) Creates metadata for a datasetcreateSegment(SegmentCreateRequest request) Creates a segment within a documentCreates a child chunk within a segmentcreateTag(TagCreateRequest request) Create a new tagvoidDeletes a datasetvoiddeleteDocument(String datasetId, String documentId, String apiKey) Deletes a document from a datasetvoiddeleteMetaData(String datasetId, String metadataId, String apiKey) Deletes metadata from a datasetvoiddeleteSegment(String datasetId, String documentId, String segmentId, String apiKey) Deletes a segment from a documentvoidDeletes a child chunk from a segmentvoidDelete a tag by tag ID with API key authenticationChecks the indexing status of a documentinfo(DatasetInfoRequest request) infolistDatasetTag(String datasetId, String apiKey) List all tags associated with a specific datasetlistMetaData(String datasetId, String apiKey) Lists all metadata for a datasetlistRerank(String apiKey) Lists all rerankList all tagslistTextEmbedding(String apiKey) Lists all text embeddings availableio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<DatasetResponse> page(DatasetPageRequest request) Retrieves a paginated list of datasetsio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<DocumentInfo> pageDocument(DatasetPageDocumentRequest request) Retrieves a paginated list of documents in a datasetpageSegment(SegmentPageRequest request) Retrieves a paginated list of segmentsio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<SegmentChildChunkResponse> Retrieves a paginated list of child chunks within a segmentretrieve(RetrieveRequest request) Retrieves data from the datasetvoidunbindingTag(TagUnbindingRequest request) Unbind tags from a resourceupdate(DatasetUpdateRequest request) updateUpdates an existing document with a new fileUpdates an existing document with new text contentvoidUpdates metadata for a documentupdateMetaData(MetaDataUpdateRequest request) Updates existing metadata for a datasetupdateSegment(SegmentUpdateRequest request) Updates an existing segmentUpdates an existing child chunk within a segmentupdateTag(TagUpdateRequest request) Update an existing taguploadFileInfo(String datasetId, String documentId, String apiKey) Retrieves file upload information for a document in a dataset
-
Method Details
-
create
Creates a new dataset- Parameters:
request- The dataset creation request containing dataset details- Returns:
- The created dataset response
-
page
io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<DatasetResponse> page(DatasetPageRequest request) Retrieves a paginated list of datasets- Parameters:
request- The request parameters for fetching datasets- Returns:
- Paginated result containing dataset data
-
info
info- Parameters:
request- request parameters- Returns:
- dataset data
-
update
update- Parameters:
request- request parameters- Returns:
- dataset data
-
delete
Deletes a dataset- Parameters:
datasetId- The ID of the dataset to deleteapiKey- The API key for authentication and authorization to the Dify API
-
createDocumentByText
Creates a document in a dataset using text content- Parameters:
request- The document creation request containing text data- Returns:
- The created document response
-
createDocumentByFile
Creates a document in a dataset using a file- Parameters:
request- The document creation request containing file data- Returns:
- The created document response
-
updateDocumentByText
Updates an existing document with new text content- Parameters:
request- The document update request containing new text data- Returns:
- The updated document response
-
updateDocumentByFile
Updates an existing document with a new file- Parameters:
request- The document update request containing new file data- Returns:
- The updated document response
-
pageDocument
io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<DocumentInfo> pageDocument(DatasetPageDocumentRequest request) Retrieves a paginated list of documents in a dataset- Parameters:
request- The request parameters for fetching documents- Returns:
- Paginated result containing document information
-
indexingStatus
Checks the indexing status of a document- Parameters:
request- The request parameters for checking indexing status- Returns:
- The document indexing status response
-
deleteDocument
Deletes a document from a dataset- Parameters:
datasetId- The ID of the dataset containing the documentdocumentId- The ID of the document to deleteapiKey- The API key for authentication and authorization to the Dify API
-
createSegment
Creates a segment within a document- Parameters:
request- The segment creation request- Returns:
- The created segment response
-
pageSegment
Retrieves a paginated list of segments- Parameters:
request- The request parameters for fetching segments- Returns:
- The segment response containing paginated segments
-
deleteSegment
Deletes a segment from a document- Parameters:
datasetId- The ID of the dataset containing the documentdocumentId- The ID of the document containing the segmentsegmentId- The ID of the segment to deleteapiKey- The API key for authentication and authorization to the Dify API
-
updateSegment
Updates an existing segment- Parameters:
request- The segment update request- Returns:
- The segment update response
-
createSegmentChildChunk
Creates a child chunk within a segment- Parameters:
request- The segment child chunk creation request- Returns:
- The segment child chunk creation response
-
pageSegmentChildChunk
io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<SegmentChildChunkResponse> pageSegmentChildChunk(SegmentChildChunkPageRequest request) Retrieves a paginated list of child chunks within a segment- Parameters:
request- The request parameters for fetching segment child chunks- Returns:
- Paginated result containing segment child chunk data
-
deleteSegmentChildChunk
Deletes a child chunk from a segment- Parameters:
request- The segment child chunk deletion request
-
updateSegmentChildChunk
Updates an existing child chunk within a segment- Parameters:
request- The segment child chunk update request- Returns:
- The segment child chunk update response
-
uploadFileInfo
Retrieves file upload information for a document in a dataset- Parameters:
datasetId- The ID of the datasetdocumentId- The ID of the documentapiKey- The API key for authentication and authorization to the Dify API- Returns:
- The upload file information response
-
retrieve
Retrieves data from the dataset- Parameters:
request- The retrieve request parameters- Returns:
- The retrieve response
-
createMetaData
Creates metadata for a dataset- Parameters:
request- The metadata creation request- Returns:
- The metadata response
-
updateMetaData
Updates existing metadata for a dataset- Parameters:
request- The metadata update request- Returns:
- The metadata response
-
deleteMetaData
Deletes metadata from a dataset- Parameters:
datasetId- The ID of the datasetmetadataId- The ID of the metadata to deleteapiKey- The API key for authentication and authorization to the Dify API
-
actionMetaData
Performs an action on metadata- Parameters:
request- The metadata action request
-
updateDocumentMetaData
Updates metadata for a document- Parameters:
request- The document metadata update request
-
listMetaData
Lists all metadata for a dataset- Parameters:
datasetId- The ID of the datasetapiKey- The API key for authentication and authorization to the Dify API- Returns:
- The metadata list response
-
listTextEmbedding
Lists all text embeddings available- Parameters:
apiKey- The API key for authentication and authorization to the Dify API- Returns:
- The text embedding list response
-
listRerank
Lists all rerank- Parameters:
apiKey- The API key for authentication and authorization to the Dify API- Returns:
- The rerank list response
-
createTag
Create a new tag- Parameters:
request- Tag creation request containing tag information- Returns:
- TagInfoResponse containing the created tag details
- Since:
- 1.3.0
-
listTag
List all tags- Parameters:
apiKey- API key for authentication (can be null)- Returns:
- List of TagInfoResponse containing all tag information
- Since:
- 1.3.0
-
updateTag
Update an existing tag- Parameters:
request- Tag update request containing updated tag information- Returns:
- TagInfoResponse containing the updated tag details
- Since:
- 1.3.0
-
deleteTag
Delete a tag by tag ID with API key authentication- Parameters:
tagId- ID of the tag to be deletedapiKey- API key for authentication (can be null)- Since:
- 1.3.0
-
bindingTag
Bind tags to a resource (such as dataset, model, etc.)- Parameters:
request- Tag binding request containing binding information- Since:
- 1.3.0
-
unbindingTag
Unbind tags from a resource- Parameters:
request- Tag unbinding request containing unbinding information- Since:
- 1.3.0
-
listDatasetTag
List all tags associated with a specific dataset- Parameters:
datasetId- ID of the dataset to query tags forapiKey- API key for authentication- Returns:
- DataSetTagsResponse containing dataset tag information
- Since:
- 1.3.0
-
changeDocumentStatus
DatasetStatusResponse changeDocumentStatus(String datasetId, Set<String> documentIds, DocActionEnum status, String apiKey) Change the status of a document- Parameters:
datasetId- ID of the dataset containing the documentdocumentIds- ID of the document to change statusstatus- New status for the documentapiKey- API key for authentication (can be null)- Returns:
- DatasetStatusResponse containing the updated document status
- Since:
- 1.3.3
-