Feat: Add support for document meta fields update through api (#5120)

### What problem does this PR solve?

add support for update document meta data through  api
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Co-authored-by: wenju.li <wenju.li@deepctr.cn>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
liwenju0
2025-02-19 13:39:31 +08:00
committed by GitHub
parent fab0f07379
commit 3ced290eb5
4 changed files with 12 additions and 0 deletions

View File

@ -49,6 +49,9 @@ class Document(Base):
super().__init__(rag, res_dict)
def update(self, update_message: dict):
if "meta_fields" in update_message:
if not isinstance(update_message["meta_fields"], dict):
raise Exception("meta_fields must be a dictionary")
res = self.put(f'/datasets/{self.dataset_id}/documents/{self.id}',
update_message)
res = res.json()