Skip to content

Weaviate update version - #25447

Merged
crazywoola merged 26 commits into
langgenius:mainfrom
DhruvGorasiya:weaviateUpdateVersion
Oct 14, 2025
Merged

crazywoola merged 26 commits into
langgenius:mainfrom
DhruvGorasiya:weaviateUpdateVersion

Conversation

@DhruvGorasiya

@DhruvGorasiya DhruvGorasiya commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

This pull request updates the Weaviate client dependency to a newer major version and ensures compatibility in both the Python package configuration and the Docker development environment. The most important changes are as follows:

Dependency Updates:

  • Updated the weaviate-client dependency in api/pyproject.toml from version ~3.24.0 to accept any 4.x.x version, ensuring compatibility with the latest Weaviate features and bug fixes.

Development Environment Configuration:

  • Modified docker/docker-compose.override.yml to mount the weaviate_vector.py file as read-only into the api service and to explicitly install the weaviate package version >=4.0.0 at container startup, ensuring the development environment matches the new dependency requirements.to support the latest Python client (Weaviate Integration)
    close feat: Weaviate supports Chinese bm25 #12223 #12258

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Sep 9, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary of Changes

Hello @DhruvGorasiya, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the Weaviate vector database integration by upgrading to the latest Weaviate Python client (v4). The update involves a complete overhaul of the underlying adapter logic to leverage the new client's features and API, ensuring compatibility, improved performance, and a more intuitive interaction with Weaviate. It also includes new testing infrastructure and documentation to support the updated integration.

Highlights

  • Weaviate Client Upgrade: The Weaviate Python client dependency has been updated from version 3.x to 4.x to support the latest Weaviate API, bringing significant changes to how the client interacts with the Weaviate vector database.
  • Weaviate Adapter Refactoring: The core Weaviate vector database adapter (weaviate_vector.py) has been extensively refactored to align with the new Weaviate v4 client API. This includes changes to client initialization, collection management, data insertion (using the new batch API and DataObject), and all search and deletion operations.
  • Enhanced Testing and Documentation: New files have been added to provide comprehensive testing and documentation for the Weaviate v4 integration. This includes a detailed smoke test guide (README_SMOKE_TEST.md), a standalone smoke test script, and dedicated unit and integration tests to ensure the new implementation is robust and functional.
  • Docker Environment Update: A new docker-compose.override.yml file has been introduced to ensure the correct Weaviate client version is installed within the Docker API service and to mount the updated Weaviate vector file, facilitating development and testing in a containerized environment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@dosubot dosubot Bot added the 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. label Sep 9, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request successfully updates the Weaviate integration to support the v4 Python client, which is a significant and necessary upgrade. The core logic has been refactored to use the new client API, and new tests and documentation have been added to support this change. My review focuses on a few critical areas to ensure correctness and robustness: a potential regression in how document IDs are generated, a flaw in the gRPC connection logic, and ensuring the new unit tests accurately reflect the implementation. Addressing these points will make the integration more reliable.

Comment thread api/tests/unit/test_weaviate_v4.py Resolved
Comment thread api/README_SMOKE_TEST.md Resolved
Comment thread api/scripts/smoke_test_weaviate_v4.py Resolved
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Sep 24, 2025
@crazywoola

Copy link
Copy Markdown
Member

Hello, please resolve the conflicts. Most of the code LGTM. :)

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 9, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Oct 14, 2025
@crazywoola
crazywoola merged commit 48c42a9 into langgenius:main Oct 14, 2025
@kurokobo

kurokobo commented Oct 15, 2025 •

Copy link
Copy Markdown
Contributor

@DhruvGorasiya @crazywoola
Has this been tested thoroughly?

  • Instead of modifying the Dockerfile or entrypoint.sh, you’re taking a rather forceful and illogical approach by placing a docker-compose.override.yml file.
  • Has it actually been tested that existing Dify users with Weaviate 1.19 can migrate their data without issues just by switching the image to 1.27?

At the very least, there’s a side effect reported in #26938.

@DhruvGorasiya

Copy link
Copy Markdown
Contributor Author

Let me take a look at this and get back to you ASAP @kurokobo

@kurokobo

kurokobo commented Oct 15, 2025 •

Copy link
Copy Markdown
Contributor

@DhruvGorasiya
Thanks for your rapid response, I understand that the override file was added in order to run Weaviate 1.27 even with the Dify 1.9.1 image, and that this is just a temporary workaround until the next version of Dify is released. Is that correct?

  • However, override files are listed in .gitignore so that users can add services or customize configurations as needed. The override file added in this PR could lead to duplicate override files (yml and yaml), and it may unintentionally disable user-provided override files (because yml has priority), causing unforeseen side effects.
  • Also, the contents of the override file are not appropriate. You should specify the entrypoint instead of the command, otherwise pip install won’t be triggered.
  • In addition, you should be installing weaviate-client, not weaviate. The version specified also differs from what’s in pyproject.toml.
  • Moreover, the command does not consider virtual environment for Python at all. Even if you install weaviate-client with pip install, it only installs the module as system-wide and not in the virtual environment where Dify runs. You should be using uv instead.
  • If possible, it would be better to add these modification (volumes and entrypoint) directly to the docker-compose template file, rather than using an override file. However, please make sure to add a TODO comment to remove these additions when the next version is released.
  • Weaviate is accessed not only by the api but also by worker.

That said, as a prerequisite, changing the Weaviate version should only be done after testing that migrating data from 1.19 to 1.27 can be done automatically without user intervention (I haven't tested this myself, so maybe I'm just worrying too much).
Note, according to the Weaviate migration guide, it says to update only one minor version at a time, so even if it does work, this wouldn't be a supported migration path.

@DhruvGorasiya

DhruvGorasiya commented Oct 15, 2025 •

Copy link
Copy Markdown
Contributor Author

@kurokobo Thanks for the detailed feedback! Yes, your understanding is correct, this was meant as a temporary workaround until the next Dify release. I’m currently working on fixing the issues you pointed out (override behavior, entrypoint usage, correct package install, and virtual environment handling) and will update the PR accordingly soon.

@DhruvGorasiya

Copy link
Copy Markdown
Contributor Author

Hey @kurokobo I have created another PR with correct changes, I have removed the docker-compose-override file and I have updated the docker-compose-template and I have also added TODO message just as you said. Let me know if there are any changes that needs to be made.

#26964

wylswz pushed a commit that referenced this pull request Oct 16, 2025
Co-authored-by: crazywoola <427733928@qq.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
LawrenceZHLee pushed a commit to LawrenceZHLee/dify that referenced this pull request Oct 28, 2025
Co-authored-by: crazywoola <427733928@qq.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@dosubot dosubot Bot mentioned this pull request Nov 12, 2025
6 tasks done
Ssazurov pushed a commit to Ssazurov/dify that referenced this pull request Aug 8, 2026
Co-authored-by: crazywoola <427733928@qq.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants