Skip to content

Commit ef7fc84

Browse files
committed
add versions
1 parent d6313a7 commit ef7fc84

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

Diff for: components/linkup/actions/sourced/sourced.mjs

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import app from "../../linkup.app.mjs";
2+
3+
export default {
4+
name: "Linkup Search",
5+
description: "Search and retrieve insights using the Linkup API. [See the documentation](https://docs.linkup.so/pages/api-reference/endpoint/post-search)",
6+
key: "linkup-search",
7+
version: "0.1.1",
8+
type: "action",
9+
props: {
10+
app,
11+
query: {
12+
type: "string",
13+
label: "Query",
14+
description: "The search query for Linkup.",
15+
},
16+
depth: {
17+
type: "string",
18+
label: "Search Depth",
19+
description: "Defines the precision of the search. `standard` returns results quickly; `deep` takes longer but yields more complete results.",
20+
options: [
21+
"standard",
22+
"deep",
23+
],
24+
},
25+
},
26+
additionalProps(props) {
27+
if (this.outputType === "structured") {
28+
props.structuredOutputSchema.optional = false;
29+
props.structuredOutputSchema.hidden = false;
30+
props.structuredOutputSchema.default = `{
31+
"type": "object",
32+
"properties": {
33+
"results": {
34+
"type": "array",
35+
"items": {
36+
"type": "object",
37+
"properties": {
38+
"name": {
39+
"type": "string"
40+
},
41+
"year": {
42+
"type": "number"
43+
}
44+
},
45+
"required": [
46+
"name",
47+
"year"
48+
],
49+
"additionalProperties": false
50+
}
51+
}
52+
},
53+
"required": [
54+
"results"
55+
],
56+
"additionalProperties": false
57+
}`;
58+
}
59+
return {};
60+
},
61+
async run({ $ }) {
62+
try {
63+
const response = await this.app.search({
64+
query: this.query,
65+
depth: this.depth,
66+
outputType: this.outputType,
67+
structuredOutputSchema:
68+
this.structuredOutputSchema && JSON.parse(this.structuredOutputSchema),
69+
includeImages: this.includeImages,
70+
});
71+
$.export("$summary", "Successfully completed search query");
72+
return response;
73+
} catch (error) {
74+
console.error("Error calling Linkup API:", error);
75+
throw new Error(`Failed to fetch data from Linkup API: ${error.message}`);
76+
}
77+
},
78+
};

0 commit comments

Comments
 (0)