diff --git a/components/linkup/actions/answer/answer.mjs b/components/linkup/actions/answer/answer.mjs new file mode 100644 index 0000000000000..dbddae56980a8 --- /dev/null +++ b/components/linkup/actions/answer/answer.mjs @@ -0,0 +1,40 @@ +import app from "../../linkup.app.mjs"; + +export default { + name: "Linkup Answer", + description: "Get a natural language answer to your natural language question.", + key: "linkup-answer", + version: "0.0.1", + type: "action", + props: { + app, + query: { + type: "string", + label: "Query", + description: "The search query for Linkup.", + }, + depth: { + type: "string", + label: "Search Depth", + description: "Defines the precision of the search. `standard` returns results quickly; `deep` takes longer but yields more complete results.", + options: [ + "standard", + "deep", + ], + }, + }, + async run({ $ }) { + try { + const response = await this.app.search({ + query: this.query, + depth: this.depth, + outputType: "sourcedAnswer", + }); + $.export("$summary", "Successfully completed search query"); + return response; + } catch (error) { + console.error("Error calling Linkup API:", error); + throw new Error(`Failed to fetch data from Linkup API: ${error.message}`); + } + }, +}; diff --git a/components/linkup/actions/search/search.mjs b/components/linkup/actions/search/search.mjs index 1c57ef0288954..8beeb9472467d 100644 --- a/components/linkup/actions/search/search.mjs +++ b/components/linkup/actions/search/search.mjs @@ -2,9 +2,9 @@ import app from "../../linkup.app.mjs"; export default { name: "Linkup Search", - description: "Search and retrieve insights using the Linkup API. [See the documentation](https://docs.linkup.so/pages/api-reference/endpoint/post-search)", + description: "Retrieve a list of objects relevant to a natural language search query.", key: "linkup-search", - version: "0.0.1", + version: "0.1.1", type: "action", props: { app, @@ -22,84 +22,13 @@ export default { "deep", ], }, - outputType: { - type: "string", - label: "Output Type", - description: "The type of output you want to get. Use `structured` for a custom-formatted response defined by `structuredOutputSchema`", - options: [ - { - value: "sourcedAnswer", - label: "Natural language answer and its sources", - }, - { - value: "searchResults", - label: "Raw context", - }, - { - value: "structured", - label: "Json format of the response", - }, - ], - reloadProps: true, - }, - structuredOutputSchema: { - type: "string", - label: "Structured Output Schema", - description: "Schema for structured output (only applicable if Output Type is 'structured'). Provide a JSON schema (as a string) representing the desired response format.", - optional: true, - hidden: true, - }, - includeImages: { - type: "boolean", - label: "Include Images", - description: "Defines whether the API should include images in its results", - optional: true, - }, - }, - additionalProps(props) { - if (this.outputType === "structured") { - props.structuredOutputSchema.optional = false; - props.structuredOutputSchema.hidden = false; - props.structuredOutputSchema.default = `{ - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "year": { - "type": "number" - } - }, - "required": [ - "name", - "year" - ], - "additionalProperties": false - } - } - }, - "required": [ - "results" - ], - "additionalProperties": false - }`; - } - return {}; }, async run({ $ }) { try { const response = await this.app.search({ query: this.query, depth: this.depth, - outputType: this.outputType, - structuredOutputSchema: - this.structuredOutputSchema && JSON.parse(this.structuredOutputSchema), - includeImages: this.includeImages, + outputType: "searchResults", }); $.export("$summary", "Successfully completed search query"); return response; diff --git a/components/linkup/actions/sourced/sourced.mjs b/components/linkup/actions/sourced/sourced.mjs new file mode 100644 index 0000000000000..37811faf2e8f7 --- /dev/null +++ b/components/linkup/actions/sourced/sourced.mjs @@ -0,0 +1,40 @@ +import app from "../../linkup.app.mjs"; + +export default { + name: "Linkup Sourced", + description: "Get a natural language answer to your natural language question", + key: "linkup-sourced", + version: "0.1.1", + type: "action", + props: { + app, + query: { + type: "string", + label: "Query", + description: "The search query for Linkup.", + }, + depth: { + type: "string", + label: "Search Depth", + description: "Defines the precision of the search. `standard` returns results quickly; `deep` takes longer but yields more complete results.", + options: [ + "standard", + "deep", + ], + }, + }, + async run({ $ }) { + try { + const response = await this.app.search({ + query: this.query, + depth: this.depth, + outputType: "sourcedAnswer", + }); + $.export("$summary", "Successfully completed search query"); + return response; + } catch (error) { + console.error("Error calling Linkup API:", error); + throw new Error(`Failed to fetch data from Linkup API: ${error.message}`); + } + }, +}; diff --git a/components/linkup/package.json b/components/linkup/package.json index 52e05175f933a..b1488359616f0 100644 --- a/components/linkup/package.json +++ b/components/linkup/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linkup", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Linkup Components", "main": "linkup.app.mjs", "keywords": [