Skip to content

Commit 94f2901

Browse files
committed
[Components] agentset #16193
Sources - New Ingest Job - New Document Actions - Create Namespace - Create Ingest Job - Search Namespace
1 parent 952648a commit 94f2901

File tree

13 files changed

+384
-396
lines changed

13 files changed

+384
-396
lines changed
Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import agentset from "../../agentset.app.mjs";
2-
import { axios } from "@pipedream/platform";
2+
import { PAYLOAD_TYPE_OPTIONS } from "../../common/constants.mjs";
3+
import { parseObject } from "../../common/utils.mjs";
34

45
export default {
56
key: "agentset-create-ingest-job",
67
name: "Create Ingest Job",
78
description: "Create an ingest job for the authenticated organization. [See the documentation](https://docs.agentset.ai/api-reference/endpoint/ingest-jobs/create)",
8-
version: "0.0.{{ts}}",
9+
version: "0.0.1",
910
type: "action",
1011
props: {
1112
agentset,
@@ -16,21 +17,84 @@ export default {
1617
],
1718
},
1819
payloadType: {
19-
propDefinition: [
20-
agentset,
21-
"payloadType",
22-
],
20+
type: "string",
21+
label: "Payload Type",
22+
description: "Type of payload for the ingest job",
23+
options: PAYLOAD_TYPE_OPTIONS,
24+
reloadProps: true,
2325
},
24-
payload: {
25-
propDefinition: [
26-
agentset,
27-
"payload",
28-
],
26+
text: {
27+
type: "string",
28+
label: "Text",
29+
description: "The text to ingest",
30+
hidden: true,
2931
},
32+
fileUrl: {
33+
type: "string",
34+
label: "File URL",
35+
description: "The URL of the file to ingest",
36+
hidden: true,
37+
},
38+
urls: {
39+
type: "string[]",
40+
label: "URLs",
41+
description: "The URLs to ingest",
42+
hidden: true,
43+
},
44+
name: {
45+
type: "string",
46+
label: "Name",
47+
description: "The name of the ingest job",
48+
optional: true,
49+
hidden: true,
50+
},
51+
},
52+
async additionalProps(props) {
53+
props.text.hidden = true;
54+
props.name.hidden = true;
55+
props.fileUrl.hidden = true;
56+
props.urls.hidden = true;
57+
58+
switch (this.payloadType) {
59+
case "TEXT":
60+
props.text.hidden = false;
61+
props.name.hidden = false;
62+
break;
63+
case "FILE":
64+
props.fileUrl.hidden = false;
65+
props.name.hidden = false;
66+
break;
67+
case "URLS":
68+
props.urls.hidden = false;
69+
break;
70+
}
71+
return {};
3072
},
3173
async run({ $ }) {
32-
const response = await this.agentset.createIngestJob(this.namespaceId, this.payloadType, this.payload);
33-
$.export("$summary", `Ingest job created successfully: ID ${response.id}`);
74+
const payload = {
75+
type: this.payloadType,
76+
};
77+
switch (this.payloadType) {
78+
case "TEXT":
79+
payload.text = this.text;
80+
payload.name = this.name;
81+
break;
82+
case "FILE":
83+
payload.fileUrl = this.fileUrl;
84+
payload.name = this.name;
85+
break;
86+
case "URLS":
87+
payload.urls = parseObject(this.urls);
88+
break;
89+
}
90+
const response = await this.agentset.createIngestJob({
91+
$,
92+
namespaceId: this.namespaceId,
93+
data: {
94+
payload,
95+
},
96+
});
97+
$.export("$summary", `Ingest job created successfully: ID ${response.data.id}`);
3498
return response;
3599
},
36100
};
Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import agentset from "../../agentset.app.mjs";
2-
import { axios } from "@pipedream/platform";
2+
import { slugify } from "../../common/utils.mjs";
33

44
export default {
55
key: "agentset-create-namespace",
66
name: "Create Namespace",
77
description: "Creates a namespace for the authenticated organization. [See the documentation](https://docs.agentset.ai/api-reference/endpoint/namespaces/create)",
8-
version: "0.0.{{ts}}",
8+
version: "0.0.1",
99
type: "action",
1010
props: {
1111
agentset,
@@ -14,75 +14,17 @@ export default {
1414
label: "Name",
1515
description: "The name of the namespace to create",
1616
},
17-
slug: {
18-
type: "string",
19-
label: "Slug",
20-
description: "A unique slug for the namespace",
21-
},
22-
embeddingConfigProvider: {
23-
type: "string",
24-
label: "Embedding Config Provider",
25-
description: "Provider for the embedding config",
26-
options: [
27-
"OPENAI",
28-
],
29-
},
30-
embeddingConfigModel: {
31-
type: "string",
32-
label: "Embedding Config Model",
33-
description: "The model for the embedding config",
34-
options: [
35-
"text-embedding-3-small",
36-
"text-embedding-3-large",
37-
],
38-
},
39-
embeddingConfigApiKey: {
40-
type: "string",
41-
label: "Embedding Config API Key",
42-
description: "API key for the embedding config provider",
43-
secret: true,
44-
},
45-
vectorStoreConfigProvider: {
46-
type: "string",
47-
label: "Vector Store Config Provider",
48-
description: "Provider for the vector store config",
49-
options: [
50-
"PINECONE",
51-
],
52-
},
53-
vectorStoreConfigApiKey: {
54-
type: "string",
55-
label: "Vector Store Config API Key",
56-
description: "API key for the vector store",
57-
secret: true,
58-
},
59-
vectorStoreConfigIndexHost: {
60-
type: "string",
61-
label: "Vector Store Config Index Host",
62-
description: "URL of the Pinecone index host",
63-
},
6417
},
6518
async run({ $ }) {
66-
const response = await this.agentset._makeRequest({
67-
method: "POST",
68-
path: "/namespace",
19+
const response = await this.agentset.createNamespace({
20+
$,
6921
data: {
7022
name: this.name,
71-
slug: this.slug,
72-
embeddingConfig: {
73-
provider: this.embeddingConfigProvider,
74-
model: this.embeddingConfigModel,
75-
apiKey: this.embeddingConfigApiKey,
76-
},
77-
vectorStoreConfig: {
78-
provider: this.vectorStoreConfigProvider,
79-
apiKey: this.vectorStoreConfigApiKey,
80-
indexHost: this.vectorStoreConfigIndexHost,
81-
},
23+
slug: slugify(this.name),
8224
},
8325
});
8426

85-
$.export("$summary", `Successfully created namespace ${response.name}`);
27+
$.export("$summary", `Successfully created namespace with ID: ${response.data.id}`);
8628
return response;
8729
},
8830
};

components/agentset/actions/search-namespace/search-namespace.mjs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import agentset from "../../agentset.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "agentset-search-namespace",
65
name: "Agentset Search Namespace",
76
description: "Complete retrieval pipeline for RAG with semantic search, filtering, and reranking. [See the documentation](https://docs.agentset.ai/api-reference/endpoint/search)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
agentset,
@@ -24,54 +23,64 @@ export default {
2423
type: "integer",
2524
label: "Top K",
2625
description: "Number of top documents to return",
26+
min: 1,
27+
max: 100,
2728
optional: true,
2829
},
2930
rerank: {
3031
type: "boolean",
3132
label: "Rerank",
32-
description: "Rerank documents based on query",
33+
description: "Whether to rerank the results",
3334
optional: true,
3435
},
3536
rerankLimit: {
3637
type: "integer",
3738
label: "Rerank Limit",
38-
description: "Limit for reranking documents",
39+
description: "The number of results to return after reranking",
40+
min: 1,
41+
max: 100,
3942
optional: true,
4043
},
4144
filter: {
42-
type: "string",
45+
type: "object",
4346
label: "Filter",
4447
description: "Filter to apply to search results",
4548
optional: true,
4649
},
4750
minScore: {
48-
type: "number",
51+
type: "string",
4952
label: "Minimum Score",
50-
description: "Minimum score threshold for results",
53+
description: "Minimum score to return. Range from 0 to 1",
5154
optional: true,
5255
},
5356
includeRelationship: {
5457
type: "boolean",
5558
label: "Include Relationship",
56-
description: "Include relationship data in results",
59+
description: "Whether to include relationships in the results",
5760
optional: true,
5861
},
5962
includeMetadata: {
6063
type: "boolean",
6164
label: "Include Metadata",
62-
description: "Include metadata in results",
65+
description: "Whether to include metadata in the results",
6366
optional: true,
6467
},
6568
},
69+
6670
async run({ $ }) {
67-
const response = await this.agentset.searchNamespace(this.namespaceId, this.query, {
68-
topK: this.topK,
69-
rerank: this.rerank,
70-
rerankLimit: this.rerankLimit,
71-
filter: this.filter,
72-
minScore: this.minScore,
73-
includeRelationships: this.includeRelationship,
74-
includeMetadata: this.includeMetadata,
71+
const response = await this.agentset.searchNamespace({
72+
$,
73+
namespaceId: this.namespaceId,
74+
data: {
75+
query: this.query,
76+
topK: this.topK,
77+
rerank: this.rerank,
78+
rerankLimit: this.rerankLimit,
79+
filter: this.filter,
80+
minScore: this.minScore && parseFloat(this.minScore),
81+
includeRelationships: this.includeRelationship,
82+
includeMetadata: this.includeMetadata,
83+
},
7584
});
7685

7786
$.export("$summary", `Successfully completed the search for query: "${this.query}"`);

0 commit comments

Comments
 (0)