Skip to content

Commit fe341ea

Browse files
committed
Add vector search endpoint actions and update package version
- Introduced actions for creating, deleting, getting, and listing vector search endpoints. - Added endpoint name prop for dynamic endpoint selection. - Updated package version to 0.2.0 and dependencies to the latest version. - Incremented version for existing actions to 0.0.2 where applicable.
1 parent dbccce1 commit fe341ea

File tree

9 files changed

+195
-5
lines changed

9 files changed

+195
-5
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import databricks from "../../databricks.app.mjs";
3+
4+
export default {
5+
key: "databricks-create-endpoint",
6+
name: "Create Endpoint",
7+
description: "Create a new vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/createendpoint)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
databricks,
12+
name: {
13+
type: "string",
14+
label: "Endpoint Name",
15+
description: "The name of the vector search endpoint",
16+
},
17+
},
18+
async run({ $ }) {
19+
try {
20+
const response = await this.databricks.createEndpoint({
21+
data: {
22+
name: this.name,
23+
endpoint_type: "STANDARD",
24+
},
25+
$,
26+
});
27+
28+
if (response) {
29+
$.export("$summary", `Successfully created endpoint with ID ${response.id}.`);
30+
}
31+
32+
return response;
33+
} catch ({ response }) {
34+
throw new ConfigurationError(response.data.message);
35+
}
36+
},
37+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-delete-endpoint",
5+
name: "Delete Endpoint",
6+
description: "Delete a vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/deleteendpoint)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
databricks,
11+
endpointName: {
12+
propDefinition: [
13+
databricks,
14+
"endpointName",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.databricks.deleteEndpoint({
20+
endpointName: this.endpointName,
21+
$,
22+
});
23+
24+
$.export("$summary", `Successfully deleted endpoint "${this.endpointName}".`);
25+
return response;
26+
},
27+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-get-endpoint",
5+
name: "Get Endpoint",
6+
description: "Get details of a specific vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/getendpoint)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
databricks,
11+
endpointName: {
12+
propDefinition: [
13+
databricks,
14+
"endpointName",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.databricks.getEndpoint({
20+
endpointName: this.endpointName,
21+
$,
22+
});
23+
24+
if (response) {
25+
$.export("$summary", `Successfully retrieved endpoint "${this.endpointName}".`);
26+
}
27+
28+
return response;
29+
},
30+
};

components/databricks/actions/get-run-output/get-run-output.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-get-run-output",
55
name: "Get Run Output",
66
description: "Retrieve the output and metadata of a single task run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-get-output)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
databricks,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-list-endpoints",
5+
name: "List Endpoints",
6+
description: "List all vector search endpoints. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/listendpoints)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
databricks,
11+
maxResults: {
12+
type: "integer",
13+
label: "Max Results",
14+
description: "Maximum number of endpoints to return",
15+
default: 100,
16+
},
17+
},
18+
async run({ $ }) {
19+
const allEndpoints = [];
20+
const params = {};
21+
22+
do {
23+
const {
24+
endpoints, next_page_token,
25+
} = await this.databricks.listEndpoints({
26+
params,
27+
$,
28+
});
29+
30+
allEndpoints.push(...endpoints);
31+
if (!next_page_token) break;
32+
params.page_token = next_page_token;
33+
} while (allEndpoints.length < this.maxResults);
34+
35+
if (allEndpoints.length > this.maxResults) {
36+
allEndpoints.length = this.maxResults;
37+
}
38+
39+
$.export("$summary", `Successfully retrieved ${allEndpoints.length} endpoint${allEndpoints.length === 1
40+
? ""
41+
: "s"}.`);
42+
43+
return allEndpoints;
44+
},
45+
};

components/databricks/actions/list-runs/list-runs.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-list-runs",
55
name: "List Runs",
66
description: "Lists all runs available to the user. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
databricks,

components/databricks/actions/run-job-now/run-job-now.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-run-job-now",
55
name: "Run Job Now",
66
description: "Run a job now and return the id of the triggered run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
databricks,

components/databricks/databricks.app.mjs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ export default {
4444
})) || [];
4545
},
4646
},
47+
endpointName: {
48+
type: "string",
49+
label: "Endpoint Name",
50+
description: "The name of the vector search endpoint",
51+
async options({ prevContext }) {
52+
const {
53+
endpoints, next_page_token,
54+
} = await this.listEndpoints({
55+
params: {
56+
page_token: prevContext.page_token,
57+
},
58+
});
59+
60+
return {
61+
options: endpoints.map(({ name }) => name),
62+
context: {
63+
page_token: next_page_token,
64+
},
65+
};
66+
},
67+
},
4768
},
4869
methods: {
4970
_baseUrl() {
@@ -90,5 +111,35 @@ export default {
90111
...args,
91112
});
92113
},
114+
createEndpoint(args = {}) {
115+
return this._makeRequest({
116+
path: "/vector-search/endpoints",
117+
method: "POST",
118+
...args,
119+
});
120+
},
121+
getEndpoint({
122+
endpointName, ...opts
123+
}) {
124+
return this._makeRequest({
125+
path: `/vector-search/endpoints/${endpointName}`,
126+
...opts,
127+
});
128+
},
129+
listEndpoints(args = {}) {
130+
return this._makeRequest({
131+
path: "/vector-search/endpoints",
132+
...args,
133+
});
134+
},
135+
deleteEndpoint({
136+
endpointName, ...opts
137+
}) {
138+
return this._makeRequest({
139+
path: `/vector-search/endpoints/${endpointName}`,
140+
method: "DELETE",
141+
...opts,
142+
});
143+
},
93144
},
94145
};

components/databricks/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/databricks",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Databricks Components",
55
"main": "databricks.app.mjs",
66
"keywords": [
@@ -13,6 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.5.1"
16+
"@pipedream/platform": "^3.1.0"
1717
}
1818
}

0 commit comments

Comments
 (0)