feat: support reading tags via API (#12891)#13732
Conversation
|
@yingfeng PTAL |
74c149e to
fa0c542
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13732 +/- ##
==========================================
- Coverage 98.14% 96.72% -1.42%
==========================================
Files 10 10
Lines 702 703 +1
Branches 112 112
==========================================
- Hits 689 680 -9
- Misses 3 5 +2
- Partials 10 18 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a7fbbfd to
fdc1eb9
Compare
|
@yingfeng wait a moment. I will fix all the unit test errors. |
fdc1eb9 to
4f748c1
Compare
|
@yingfeng I have fixed all the unit test errors. Please take a look again. |
|
@yingfeng The unit tests were cancelled, could you please help me re-run all the unit tests? |
There was a problem hiding this comment.
Pull request overview
This PR adds support for exposing chunk tag keywords (tag_kwd) through the API and propagates that field through the Python SDK, retrieval outputs, and test coverage.
Changes:
- Expose
tag_kwdin chunk list/retrieval outputs and SDK chunk objects. - Accept and validate
tag_kwdon chunk create/update endpoints. - Add HTTP API + Python SDK test cases covering
tag_kwd.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
api/apps/sdk/doc.py |
Adds tag_kwd to chunk model/output and validates tag_kwd in add/update chunk endpoints (plus OpenAPI response/request docs in some places). |
api/apps/chunk_app.py |
Adds tag_kwd validation for web chunk create/set flows. |
sdk/python/ragflow_sdk/modules/document.py |
Adds tag_kwd parameter to Python SDK Document.add_chunk() request body. |
sdk/python/ragflow_sdk/modules/chunk.py |
Adds tag_kwd attribute so SDK chunk objects retain the field. |
rag/nlp/search.py |
Includes tag_kwd in retrieval result payloads. |
internal/service/chunk.go |
Includes tag_kwd when building retrieval test results. |
test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_add_chunk.py |
Adds SDK tests/validation for tag_kwd on chunk creation. |
test/testcases/test_sdk_api/test_chunk_management_within_dataset/test_update_chunk.py |
Adds SDK tests for tag_kwd on chunk update. |
test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py |
Adds HTTP API tests for tag_kwd on chunk creation and updates validation helper. |
test/testcases/test_http_api/test_chunk_management_within_dataset/test_update_chunk.py |
Adds HTTP API tests for tag_kwd on chunk update. |
test/testcases/conftest.py |
Fixes f-string quoting in token fixture error message. |
example/http/chunk_example.sh |
Adds a curl example showing tag_kwd in list-chunks output. |
Comments suppressed due to low confidence (1)
test/testcases/test_http_api/test_chunk_management_within_dataset/test_add_chunk.py:184
- Inside the
expected_code == 0branch,if res["code"] != 0: assert Falseis unreachable because the test already assertedres["code"] == expected_code. Removing this dead check will simplify the test and avoid confusion.
if expected_code == 0:
validate_chunk_details(dataset_id, document_id, payload, res)
if res["code"] != 0:
assert False, res
68cc845 to
70f6d40
Compare
|
@yingfeng I have modified my code based on the comments from Copilot. Please take look again. |
f980042 to
a4c55dc
Compare
|
Since you've modified API, can you add corresponding adjustments to API documents in this PR? |
947d6ea to
73aef7a
Compare
@yongtenglei Thanks for your suggestion. I have removed |
1. add unit tests 2. update HTTP API docs and Python SDK docs
73aef7a to
e298d6d
Compare
@yingfeng Thanks for your suggestion. I have updated the docs corresponding to this PR. Please take a look again. |
### What problem does this PR solve? Enable reading Tag Set tags via API (expose tag_kwd field). The result of the queried list chunks is as shown below: <img width="1422" height="818" alt="image" src="https://github.com/user-attachments/assets/abd1960a-fe34-489e-9d72-525f8e574938" /> ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: heyang.why <heyang.why@alibaba-inc.com>
### What problem does this PR solve? Enable reading Tag Set tags via API (expose tag_kwd field). The result of the queried list chunks is as shown below: <img width="1422" height="818" alt="image" src="https://github.com/user-attachments/assets/abd1960a-fe34-489e-9d72-525f8e574938" /> ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: heyang.why <heyang.why@alibaba-inc.com>
What problem does this PR solve?
Enable reading Tag Set tags via API (expose tag_kwd field). The result of the queried list chunks is as shown below:
Type of change