Skip to content

Commit db3b6cd

Browse files
committed
updated
1 parent af3ef3b commit db3b6cd

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

components/databricks/actions/upsert-vector-search-index-data/upsert-vector-search-index-data.mjs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,24 @@ export default {
2626
],
2727
},
2828
rows: {
29-
type: "string[]",
29+
type: "string",
3030
label: "Rows to Upsert",
31-
description: "Array of rows to upsert. Each row should be a JSON object string. Example: `{ \"id\": \"1\", \"text\": \"hello world\", \"text_vector\": [1.0, 2.0, 3.0] }`",
31+
description: "Array of rows to upsert. Each row should be a JSON object string. Example: `[{ \"id\": \"1\", \"text\": \"hello world\", \"text_vector\": [0.1, 0.2, 0.3] }]`",
3232
},
3333
},
3434

3535
async run({ $ }) {
3636
const parsedRows = utils.parseObject(this.rows);
3737

3838
if (!Array.isArray(parsedRows) || !parsedRows.length) {
39-
throw new ConfigurationError("rows must be a non-empty array of JSON objects.");
39+
throw new ConfigurationError("rows must be a non-empty JSON array.");
4040
}
4141

42-
parsedRows.forEach((row, idx) => {
43-
if (!row || typeof row !== "object") {
44-
throw new ConfigurationError(`Row at index ${idx} is invalid. Each row must be a JSON object.`);
45-
}
46-
if (!row.id) {
47-
throw new ConfigurationError(`Row at index ${idx} is missing required primary key field "id".`);
48-
}
49-
});
50-
51-
const payload = {
52-
index_name: this.indexName,
53-
inputs_json: JSON.stringify(parsedRows),
54-
};
55-
5642
const response = await this.databricks.upsertVectorSearchIndexData({
57-
data: payload,
43+
indexName: this.indexName,
44+
data: {
45+
inputs_json: JSON.stringify(parsedRows),
46+
},
5847
$,
5948
});
6049

0 commit comments

Comments
 (0)