-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] weaviate #10916 #18377
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
[Components] weaviate #10916 #18377
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds a Weaviate app client with REST methods and propDefinitions, three actions (create class, delete class, get schema), a constants module for vector types, and a package.json bump adding a dependency. Create-class parses JSON property strings and calls the app createClass endpoint. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant A as Action (Create/Delete/Get)
participant W as Weaviate App Client
participant API as Weaviate REST API
rect #f5f8ff
note over U,A: Create Class
U->>A: Trigger Create Class
A->>A: Parse properties JSON[]
A->>W: createClass(data, $)
W->>API: POST /v1/schema (Bearer)
API-->>W: 201 Created
W-->>A: Response
A-->>U: $summary + result
end
rect #f5fff5
note over U,A: Delete Class
U->>A: Trigger Delete Class (classId)
A->>W: deleteClass({ classId }, $)
W->>API: DELETE /v1/schema/{classId}
API-->>W: 200 OK
W-->>A: Response
A-->>U: $summary + result
end
rect #fff8f5
note over U,A: Get Schema
U->>A: Trigger Get Schema
A->>W: getSchema($)
W->>API: GET /v1/schema
API-->>W: 200 OK (schema)
W-->>A: Schema
A-->>U: $summary + schema
end
sequenceDiagram
autonumber
participant UI as UI (prop options)
participant W as Weaviate App Client
participant API as Weaviate REST API
UI->>W: propDefinitions.classId.options()
W->>API: GET /v1/schema
API-->>W: { classes: [...] }
W-->>UI: mapped [{ value, label }]
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (6)
components/weaviate/weaviate.app.mjs (3)
14-17
: Consider making the properties description more detailed.The current description mentions JSON object strings but could be clearer about the exact schema and required fields for each property object.
Consider updating the description to include all required and optional fields:
- description: "The properties of the class. Each item must be a JSON object string, e.g.: `{ \"name\": \"title\", \"dataType\": [\"text\"], \"description\": \"Title of the object\" }`", + description: "The properties of the class. Each item must be a JSON object string with required fields: `name` (string), `dataType` (array). Optional fields: `description` (string), `vectorizer` (string), etc. Example: `{ \"name\": \"title\", \"dataType\": [\"text\"], \"description\": \"Title of the object\" }`",
37-48
: Inconsistent prop naming between classId and displayed label.The prop is named
classId
but the label says "Class Name" and the description says "Name of the Class". This inconsistency could confuse users.Apply this diff to improve clarity:
classId: { type: "string", - label: "Class Name", - description: "Name of the Class", + label: "Class", + description: "Select the class to operate on", async options() {
51-53
: Add URL validation for cluster_url.The base URL construction assumes
cluster_url
is properly formatted but doesn't validate it.Consider adding validation or URL formatting:
_baseUrl() { - return `https://${this.$auth.cluster_url}`; + const clusterUrl = this.$auth.cluster_url?.replace(/^https?:\/\//, '').replace(/\/$/, ''); + return `https://${clusterUrl}`; },components/weaviate/actions/delete-class/delete-class.mjs (1)
18-25
: Consider adding error handling for delete operations.The delete operation doesn't handle potential errors like attempting to delete a non-existent class.
Add try-catch for better error messaging:
async run({ $ }) { + try { const response = await this.app.deleteClass({ $, classId: this.classId, }); $.export("$summary", "Successfully deleted the class named " + this.classId); return response; + } catch (error) { + if (error.response?.status === 404) { + throw new Error(`Class '${this.classId}' not found`); + } + throw error; + } },components/weaviate/actions/create-class/create-class.mjs (2)
57-57
: Make the summary more informative.Include the class name so users see what was created at a glance.
- $.export("$summary", "Successfully sent the request to create a new class"); + $.export("$summary", `Created class ${this.className}`);
47-48
: Validate & normalizeclassName
to Weaviate GraphQL naming (must match/^[A-Z][_0-9A-Za-z]*$/
).Weaviate class names must start with an uppercase letter and follow GraphQL naming; normalize and validate before sending to avoid 4xx.
File: components/weaviate/actions/create-class/create-class.mjs (around lines 47–48)- const response = await this.app.createClass({ + const className = String(this.className || "").trim(); + if (!className) throw new Error("Class name is required"); + const response = await this.app.createClass({ $, data: { - class: this.className, + class: className,Also ensure the final value matches
/^[A-Z][_0-9A-Za-z]*$/
— either throw a clear error or auto-capitalize the first character.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
components/weaviate/actions/create-class/create-class.mjs
(1 hunks)components/weaviate/actions/delete-class/delete-class.mjs
(1 hunks)components/weaviate/actions/get-schema/get-schema.mjs
(1 hunks)components/weaviate/common/constants.mjs
(1 hunks)components/weaviate/package.json
(2 hunks)components/weaviate/weaviate.app.mjs
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/weaviate/package.json
🧬 Code graph analysis (4)
components/weaviate/actions/get-schema/get-schema.mjs (3)
components/weaviate/actions/create-class/create-class.mjs (1)
response
(44-56)components/weaviate/actions/delete-class/delete-class.mjs (1)
response
(19-22)components/weaviate/weaviate.app.mjs (1)
response
(42-42)
components/weaviate/weaviate.app.mjs (3)
components/weaviate/actions/create-class/create-class.mjs (1)
response
(44-56)components/weaviate/actions/delete-class/delete-class.mjs (1)
response
(19-22)components/weaviate/actions/get-schema/get-schema.mjs (1)
response
(13-15)
components/weaviate/actions/delete-class/delete-class.mjs (3)
components/weaviate/actions/create-class/create-class.mjs (1)
response
(44-56)components/weaviate/actions/get-schema/get-schema.mjs (1)
response
(13-15)components/weaviate/weaviate.app.mjs (1)
response
(42-42)
components/weaviate/actions/create-class/create-class.mjs (3)
components/weaviate/actions/delete-class/delete-class.mjs (1)
response
(19-22)components/weaviate/actions/get-schema/get-schema.mjs (1)
response
(13-15)components/weaviate/weaviate.app.mjs (1)
response
(42-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/weaviate/package.json (2)
3-3
: Version bump looks good.The version change from 0.0.1 to 0.1.0 appropriately indicates a minor release with new features added.
15-17
: Dependency addition is appropriate.Adding
@pipedream/platform
as a dependency is correct for Pipedream components that need to make HTTP requests via axios.components/weaviate/weaviate.app.mjs (3)
1-2
: Imports look good.The axios import from
@pipedream/platform
and the constants import are properly structured.
54-69
: Request method implementation looks good.The
_makeRequest
helper properly handles authentication headers and merges options.
70-91
: REST API methods are well-structured.The three methods (
createClass
,deleteClass
,getSchema
) correctly delegate to_makeRequest
with appropriate paths and HTTP methods.components/weaviate/actions/get-schema/get-schema.mjs (1)
1-19
: Action implementation looks good.The get-schema action is simple and correctly uses the app's
getSchema
method with proper success messaging.components/weaviate/actions/create-class/create-class.mjs (1)
35-41
: vectorizer referenced but no propDefinition found — add the prop or remove the fieldcomponents/weaviate/actions/create-class/create-class.mjs:49 — contains
vectorizer: this.vectorizer
but novectorizer
propDefinition found under components/weaviate. Preferred: add the propDefinition and pass it through:vectorIndexType: { propDefinition: [ app, "vectorIndexType", ], }, + vectorizer: { + propDefinition: [ + app, + "vectorizer", + ], + },Alternatively remove the payload line
vectorizer: this.vectorizer
.
}, | ||
}, | ||
async run({ $ }) { | ||
const parsedProperties = this.properties?.map((p) => JSON.parse(p)) || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Harden properties
parsing to avoid unhandled JSON.parse errors and accept objects.
Invalid JSON will currently throw and fail the step; also breaks if an element is already an object.
- const parsedProperties = this.properties?.map((p) => JSON.parse(p)) || [];
+ const parsedProperties = Array.isArray(this.properties)
+ ? this.properties.map((p, i) => {
+ if (typeof p === "string") {
+ try { return JSON.parse(p); }
+ catch (e) { throw new Error(`Invalid JSON in "properties"[${i}]: ${e.message}`); }
+ }
+ return p;
+ }).filter(Boolean)
+ : [];
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const parsedProperties = this.properties?.map((p) => JSON.parse(p)) || []; | |
const parsedProperties = Array.isArray(this.properties) | |
? this.properties.map((p, i) => { | |
if (typeof p === "string") { | |
try { return JSON.parse(p); } | |
catch (e) { throw new Error(`Invalid JSON in "properties"[${i}]: ${e.message}`); } | |
} | |
return p; | |
}).filter(Boolean) | |
: []; |
🤖 Prompt for AI Agents
In components/weaviate/actions/create-class/create-class.mjs around line 43,
parsing of this.properties assumes every element is a JSON string and uses
JSON.parse directly, which throws on invalid JSON and fails for elements already
objects; change the mapping to handle three cases: if the element is
undefined/null skip it, if it's a string attempt JSON.parse inside a try/catch
and skip or log/collect only successfully parsed values, and if it's already an
object use it as-is; ensure the overall result defaults to an empty array when
this.properties is falsy and avoid throwing by catching parse errors and not
propagating them.
export default { | ||
VECTOR_TYPES: [ | ||
"hnsw", | ||
"flat", | ||
], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Consider verifying if the vector types list is complete.
The constants module correctly exports the vector types. However, ensure these are all the supported vector index types in Weaviate.
🌐 Web query:
What are all the supported vector index types in Weaviate?
💡 Result:
Weaviate supports three vector index types: hnsw, flat, and dynamic. (docs.weaviate.io)
Citations:
Include 'dynamic' in VECTOR_TYPES export.
Weaviate supports "hnsw", "flat", and "dynamic" — update components/weaviate/common/constants.mjs (lines 1–6) to add "dynamic" to VECTOR_TYPES.
🤖 Prompt for AI Agents
In components/weaviate/common/constants.mjs around lines 1 to 6, the exported
VECTOR_TYPES array is missing the "dynamic" type; update the VECTOR_TYPES array
to include "dynamic" alongside "hnsw" and "flat" so it reads with the three
supported values ("hnsw", "flat", "dynamic"), and keep the export shape
unchanged.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lcaresia, LGTM! Ready for QA!
* Added actions * Update components/weaviate/actions/create-class/create-class.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Luan Cazarine <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Leonardo AI components * added unzoom image action * fixing link errors * more lint fixes * Merging pull request #18359 * fix: pagination prop and params struct * fix: no need for paginate here * chore: update version * chore: cleanup * chore: update package * feat: allow raw response * chore: bump package * fix: buffer response instead * Update components/google_drive/actions/download-file/download-file.mjs Co-authored-by: Jorge Cortes <[email protected]> * versions * pnpm-lock.yaml * pnpm-lock.yaml * pnpm-lock.yaml * feat: add content selector * chore: bump package * fix: comments * chore: bump versions * chore: fix versions * fixes: QA fixes * feat: add cursor to req * package.json --------- Co-authored-by: joao <[email protected]> Co-authored-by: joaocoform <[email protected]> Co-authored-by: Jorge Cortes <[email protected]> Co-authored-by: Michelle Bergeron <[email protected]> Co-authored-by: Luan Cazarine <[email protected]> * Merging pull request #18361 * update siteId prop * pnpm-lock.yaml * package.json version * Google Sheets - update row refresh fields (#18369) * change prop order and refresh fields * bump package.json * Pipedrive - fix app name (#18370) * use pipedriveApp instead of app * bump package.json * Pipedrive - pipelineId integer (#18372) * pipelineId - integer * bump versions * Adding app scaffolding for lightspeed_ecom_c_series * Adding app scaffolding for financial_data * Adding app scaffolding for microsoft_authenticator * Merging pull request #18345 * updates * versions * versions * Merging pull request #18368 * updates * remove console.log * versions * Coinbase Developer Platform - New Wallet Event (#18342) * new component * pnpm-lock.yaml * updates * updates * Hubspot - update search-crm (#18360) * update search-crm * limit results to one page * update version * package.json version * Merging pull request #18347 * widget props * fix version * Adding app scaffolding for rundeck * Merging pull request #18378 * Update Taiga component with new actions and sources - Bump version to 0.1.0 in package.json and add dependency on @pipedream/platform. - Introduce new actions for creating, updating, and deleting issues, tasks, and user stories. - Add sources for tracking changes and deletions of issues and tasks. - Implement utility functions for parsing and cleaning objects in common/utils.mjs. - Enhance prop definitions for better integration with Taiga API. * pnpm update * Refactor Taiga actions to utilize parseObject utility - Added parseObject utility for tags, watchers, and points in update-issue, update-task, and update-userstory actions. - Removed the update-project action as it is no longer needed. - Enhanced base source to include secret key validation for webhook security. * Merging pull request #18382 * add testSources prop * pnpm-lock.yaml * fix * Merging pull request #18323 * Added actions * Added actions * Added actions * Merging pull request #18377 * Added actions * Update components/weaviate/actions/create-class/create-class.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Luan Cazarine <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Merging pull request #18376 * Adding app scaffolding for etrusted * Adding app scaffolding for intelliflo_office * Adding app scaffolding for thoughtspot * Adding app scaffolding for kordiam * Adding app scaffolding for ticketsauce * trustpilot fixes (#18152) * trustpilot fixes * more fixes * update versions * more version updates * fixes * Bump all Trustpilot actions to version 0.1.0 Major improvements and API updates across all actions: - Enhanced private API support with proper authentication - Improved parameter handling and validation - Better error handling and response structures - Added new conversation flow for product reviews - Fixed endpoint URLs to match latest API documentation - Streamlined request/response processing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * up version and clean up sources * merge * fix business ID * delete temp action * Update components/trustpilot/sources/new-product-reviews/new-product-reviews.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update components/trustpilot/sources/new-product-reviews/new-product-reviews.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update components/trustpilot/sources/new-product-reviews/new-product-reviews.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update components/trustpilot/sources/new-service-reviews/new-service-reviews.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * comments * Pagination * fixes * comments * missed some `$`'s * unduplicated * more fixes * final comments * more comments * . --------- Co-authored-by: Claude <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Adding app scaffolding for peekalink * 18314 twilio (#18350) * Update Twilio component versions and dependencies - Update Twilio Send Message action adding detailed description for 'from' prop and refactoring phone number validation logic. - Incremented action versions for several Twilio actions. * pnpm update * Updating LinkedIn API version (#18399) * Merging pull request #18394 * Databricks API - Jobs action components (#18371) * Notion property building improvements (#18381) * validate property types * versions * Google Business - add debug log (#18407) * add debug log * bump versions * Notion API Key - update @pipedream/notion version (#18409) * update @pipedream/notion dependency version * pnpm-lock.yaml * Adding app scaffolding for reduct_video * Adding app scaffolding for shopware * Adding app scaffolding for instamojo * Hubspot - bug fix to sources w/ property changes (#18379) * updates * versions * Google sheets type fix (#18411) * Fixing worksheetId prop type from string to integer * Version bumps --------- Co-authored-by: Leo Vu <[email protected]> * Merging pull request #18393 * new components * remove console.log * versions * update * Merging pull request #18408 * 403 error message * versions * update * Merging pull request #18419 * Changes per PR Review * Removes leonardo_ai_actions.mdc not indented for merging * synced lockfile after install * fully lock form-data for leonardo_ai * conflict solving * lint fixes * Chipped down Readme, implemented async options in gen motion --------- Co-authored-by: jocarino <[email protected]> Co-authored-by: joao <[email protected]> Co-authored-by: joaocoform <[email protected]> Co-authored-by: Jorge Cortes <[email protected]> Co-authored-by: Michelle Bergeron <[email protected]> Co-authored-by: Luan Cazarine <[email protected]> Co-authored-by: michelle0927 <[email protected]> Co-authored-by: Andrew Chuang <[email protected]> Co-authored-by: danhsiung <[email protected]> Co-authored-by: Lucas Caresia <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Job <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Guilherme Falcão <[email protected]> Co-authored-by: Leo Vu <[email protected]>
WHY
Summary by CodeRabbit
New Features
Chores