Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support tidb vector #4588

Merged
merged 13 commits into from
Jun 5, 2024
Merged

Conversation

Weaxs
Copy link
Contributor

@Weaxs Weaxs commented May 22, 2024

Description

Close #4381

Support TiDB Vector for knowledge.

  • add pymysql, pymysql 1.1.1 and tidb-vector 0.0.9

TiDB Vector doc: https://docs.google.com/document/d/15eAO0xrvEd6_tTxW_zEko4CECwnnSwQg8GGrqK1Caiw/edit

Fixes # (issue)

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
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

VECTOR_STORE: tidb_vector
TIDB_VECTOR_HOST: xxxx.eu-central-1.xxxx.aws.tidbcloud.com
TIDB_VECTOR_PORT: 4000
TIDB_VECTOR_USER: xxxxxx.root
TIDB_VECTOR_PASSWORD: xxxxxx
TIDB_VECTOR_DATABASE: dify

Dify knowledge screenshot:
image

Tidb Cloud Chat2Qery screenshot:
image

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

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. 📚 documentation Improvements or additions to documentation labels May 22, 2024
@takatost takatost requested a review from JohnJyong May 23, 2024 03:52
@JohnJyong
Copy link
Contributor

pls add the TIDB deploy docker-compose file and the unit test for TIDB, thanks @Weaxs

@Weaxs
Copy link
Contributor Author

Weaxs commented May 23, 2024

pls add the TIDB deploy docker-compose file and the unit test for TIDB, thanks @Weaxs

TIDB vector feature is not open source currently, it will be opened at the end of year,
So it is only used by tidb cloud now and no mirrors for deploying. 🥲

@JohnJyong
Copy link
Contributor

hi @Weaxs , sorry for replying to you so late, you can refer to tencent vector db’s unit test , commit below : https://github.com/langgenius/dify/pull/3568/files#diff-4c59736efdfdaff3b01f2ea5fe03ff75dbb1c5d767c16898d524e3d0d53467aa

@Weaxs
Copy link
Contributor Author

Weaxs commented Jun 4, 2024

hi @Weaxs , sorry for replying to you so late, you can refer to tencent vector db’s unit test , commit below : https://github.com/langgenius/dify/pull/3568/files#diff-4c59736efdfdaff3b01f2ea5fe03ff75dbb1c5d767c16898d524e3d0d53467aa

I have submitted api/tests/integration_tests/vdb/tidb_vector/test_tidb_vector.py in this PR.

Could you please review it when you have time, thx

@Weaxs Weaxs closed this Jun 5, 2024
@Weaxs Weaxs reopened this Jun 5, 2024

def text_exists(self, id: str) -> bool:
result = self.get_ids_by_metadata_field('doc_id', id)
return len(result) > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will caused : TypeError: object of type 'NoneType' has no len()

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 5, 2024
@JohnJyong JohnJyong merged commit 0797f9b into langgenius:main Jun 5, 2024
5 checks passed
@Weaxs Weaxs deleted the tidb-vector-support branch June 5, 2024 11:18
@takatost takatost mentioned this pull request Jun 14, 2024
dengpeng pushed a commit to dengpeng/dify that referenced this pull request Jun 16, 2024
HuberyHuV1 pushed a commit to HuberyHuV1/dify that referenced this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: support tidb vector
2 participants