Unable to save custom metadata when creating documents through the api using text.
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.1.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
https://****/v1/datasets/{datasets_id}/document/create-by-text
{ "name": "text6", "text": "text6", "indexing_technique": "high_quality", "doc_type": "others", "doc_metadata":{ "tweet_author_username":"asd" }, "process_rule": { "mode": "automatic" } }
✔️ Expected Behavior
When creating a document, the doc_metadata passed in should also be created.
❌ Actual Behavior
No metadata was written when creating through the API.
@thejoven Hello! I'm here to assist you with bug reports, answer questions, and help you become a contributor.
The issue you're experiencing with saving custom metadata in Dify version 1.1.0 might be related to how the metadata is being processed or validated. Here are a few things to consider:
-
Validation Requirements: Ensure that both
doc_typeanddoc_metadataare provided correctly. If one is provided, both must be present; otherwise, it will raise anInvalidMetadataError[1]. -
Correct Metadata Format: Make sure that
doc_metadatais a dictionary and that the keys and values conform to the expected types defined in the schema for the specifieddoc_type. If thedoc_typeis "others", ensure that the metadata does not violate any implicit rules [1]. -
Known Issues: There is a known issue in Dify version 1.1.0 where API calls to the metadata endpoint return a 404 error due to an incorrect API endpoint URL. Ensure that the API endpoint is correctly configured in your
.envfile [2].
If these steps do not resolve the issue, it might be helpful to check the logs for any specific error messages related to metadata saving, as this could provide more insight into what might be going wrong.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
@thejoven Hello! I'm here to assist you with bug reports, answer questions, and help you become a contributor.
The issue you're experiencing with saving custom metadata in Dify version 1.1.0 might be related to how the metadata is being processed or validated. Here are a few things to consider:
- Validation Requirements: Ensure that both
doc_typeanddoc_metadataare provided correctly. If one is provided, both must be present; otherwise, it will raise anInvalidMetadataError[1].- Correct Metadata Format: Make sure that
doc_metadatais a dictionary and that the keys and values conform to the expected types defined in the schema for the specifieddoc_type. If thedoc_typeis "others", ensure that the metadata does not violate any implicit rules [1].- Known Issues: There is a known issue in Dify version 1.1.0 where API calls to the metadata endpoint return a 404 error due to an incorrect API endpoint URL. Ensure that the API endpoint is correctly configured in your
.envfile [2].If these steps do not resolve the issue, it might be helpful to check the logs for any specific error messages related to metadata saving, as this could provide more insight into what might be going wrong.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
I confirm that it is not possible to add custom metadata while creating a document. I can only create it and then complete it by updating the metadata interface.