dify icon indicating copy to clipboard operation
dify copied to clipboard

chore: skip deprecated field_schema param in creating payload index on Qdrant

Open bowenliang123 opened this issue 9 months ago • 1 comments

Description

  • to eliminate the deprecation warning (ci log: https://github.com/langgenius/dify/actions/runs/8834708879/job/24257060509?pr=3795#step:12:78)
tests/integration_tests/vdb/qdrant/test_qdrant.py::test_qdrant_vector
  /opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/qdrant_remote.py:2359: DeprecationWarning: field_type is deprecated, use field_schema instead
    warnings.warn("field_type is deprecated, use field_schema instead", DeprecationWarning)
  • skip the deprecated param field_type and continue to use field_schema param

The method comments of create_payload_index method in qdrant_client.py of qdrant-client==1.7.3

             field_schema: Type of data to index
            field_type: Same as field_schema, but deprecated

And the implementation of create_payload_index in qdrant_remote.py of qdrant-client==1.7.3, where it throws warning. It's safe to use field_schema without providing the deprecated field_type.

           if field_type is not None:
              warnings.warn("field_type is deprecated, use field_schema instead", DeprecationWarning)
              field_schema = field_type

Type of Change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update, included: Dify Document
  • [x] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • [ ] Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [ ] TODO

Suggested Checklist:

  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] My changes generate no new warnings
  • [ ] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • [ ] optional I have made corresponding changes to the documentation
  • [ ] optional I have added tests that prove my fix is effective or that my feature works
  • [ ] optional New and existing unit tests pass locally with my changes

bowenliang123 avatar Apr 26 '24 13:04 bowenliang123

cc @JohnJyong

bowenliang123 avatar Apr 26 '24 13:04 bowenliang123