fix: migrate Weaviate to weaviate-client v3 for agentKnowledgeVSEmbeddings compatibility (#5991)#5993
Conversation
….0.1 compatibility (FlowiseAI#5991) Root cause: Weaviate.ts used weaviate-ts-client v2 which creates a client without a collections property. @langchain/weaviate 1.0.1 expects weaviate-client v3 and calls this.client.collections.get(), causing TypeError: Cannot read properties of undefined (reading 'get').
Summary of ChangesHello, 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 addresses a critical compatibility issue within the Weaviate integration by upgrading the underlying client library. The update ensures that components relying on the Weaviate vector store can correctly initialize and interact with the database, preventing runtime errors and improving the stability of agent-based flows. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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 by creating a comment using either
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 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
|
There was a problem hiding this comment.
Code Review
This pull request successfully migrates from weaviate-ts-client v2 to weaviate-client v3, which is a necessary update to fix compatibility issues with @langchain/weaviate. The changes are well-structured, including the addition of unit tests for the new utility function. However, I've identified a few issues in the new parseHostPort helper and its usage: a code duplication, a bug in handling IPv6 addresses, and an issue with default port selection for HTTPS connections. My review includes suggestions to address these points to make the implementation more robust and maintainable.
packages/components/nodes/vectorstores/Weaviate/weaviateClientUtils.ts
Outdated
Show resolved
Hide resolved
…d HTTPS port - Remove duplicate parseHostPort from Weaviate.ts, import from weaviateClientUtils - Rewrite parseHostPort to handle bracketed IPv6 (e.g. [::1]:8080) correctly - Return port as optional (undefined when not specified) instead of hardcoded 8080 - Use nullish coalescing (??) for default port so HTTPS correctly defaults to 443 - Update tests to match new return type and add IPv6 coverage
Summary
Fixes #5991.
Root cause: Weaviate.ts used weaviate-ts-client v2 which creates a client without a
collectionsproperty. @langchain/weaviate 1.0.1 expects weaviate-client v3 and callsthis.client.collections.get(), causingTypeError: Cannot read properties of undefined (reading get)when using agentKnowledgeVSEmbeddings in AgentFlow V2.Fix: Replaced weaviate-ts-client with weaviate-client v3 and updated client creation to use
connectToCustom()with the correct httpHost/httpPort/httpSecure parameters.Changes
packages/components/package.json: Swapped weaviate-ts-client for weaviate-client ^3.5.2packages/components/nodes/vectorstores/Weaviate/Weaviate.ts: Migrated to weaviate-client v3 API (connectToCustom)packages/components/nodes/vectorstores/Weaviate/weaviateClientUtils.ts: Added parseHostPort helper for host:port parsingpackages/components/nodes/vectorstores/Weaviate/weaviateClientUtils.test.ts: Unit tests for parseHostPortpackages/components/src/utils.ts: Updated defaultAllowExternalDependencies for weaviate-clientpnpm-lock.yaml: Updated lockfileTesting
Made with Cursor