-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* package and pnpm lock * pnpm lock * AI-generated app file * App file adjustments * AI generated action #1 * Improvements on AI output * pnpm * Adding and updating props * Adjustments to document translation action * Prop definitions and adding optional props * Detect AI Content + improvements * Analyze sentiment in text + more propDefinitions * Generate Image (AI) * pnpm * Description adjustments * Generate Image finalizing * Prop adjustments * typos
- Loading branch information
Showing
9 changed files
with
420 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
components/eden_ai/actions/analyze-sentiment-in-text/analyze-sentiment-in-text.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import app from "../../eden_ai.app.mjs"; | ||
|
||
export default { | ||
key: "eden_ai-analyze-sentiment-in-text", | ||
name: "Analyze Sentiment in Text", | ||
description: "Analyzes sentiment in the provided text. [See the documentation](https://docs.edenai.co/reference/text_sentiment_analysis_create)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
text: { | ||
propDefinition: [ | ||
app, | ||
"text", | ||
], | ||
}, | ||
providers: { | ||
propDefinition: [ | ||
app, | ||
"providers", | ||
], | ||
}, | ||
fallbackProviders: { | ||
propDefinition: [ | ||
app, | ||
"fallbackProviders", | ||
], | ||
}, | ||
showOriginalResponse: { | ||
propDefinition: [ | ||
app, | ||
"showOriginalResponse", | ||
], | ||
}, | ||
language: { | ||
propDefinition: [ | ||
app, | ||
"language", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
text, | ||
providers, | ||
fallbackProviders, | ||
showOriginalResponse, | ||
language, | ||
} = this; | ||
|
||
const params = { | ||
$, | ||
data: { | ||
text, | ||
providers: providers.join(), | ||
fallback_providers: fallbackProviders?.join(), | ||
show_original_response: showOriginalResponse, | ||
language, | ||
}, | ||
}; | ||
|
||
const response = await this.app.analyzeSentimentInText(params); | ||
$.export("$summary", "Sentiment analysis successfully performed"); | ||
return response; | ||
}, | ||
}; |
68 changes: 68 additions & 0 deletions
68
components/eden_ai/actions/detect-ai-content/detect-ai-content.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import app from "../../eden_ai.app.mjs"; | ||
|
||
export default { | ||
key: "eden_ai-detect-ai-content", | ||
name: "Detect AI Content", | ||
description: | ||
"Detects AI content in the provided text. [See the documentation](https://docs.edenai.co/reference/text_ai_detection_create)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
text: { | ||
propDefinition: [ | ||
app, | ||
"text", | ||
], | ||
}, | ||
providers: { | ||
propDefinition: [ | ||
app, | ||
"providers", | ||
], | ||
}, | ||
fallbackProviders: { | ||
propDefinition: [ | ||
app, | ||
"fallbackProviders", | ||
], | ||
}, | ||
showOriginalResponse: { | ||
propDefinition: [ | ||
app, | ||
"showOriginalResponse", | ||
], | ||
}, | ||
language: { | ||
propDefinition: [ | ||
app, | ||
"language", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
text, | ||
providers, | ||
fallbackProviders, | ||
showOriginalResponse, | ||
language, | ||
} = this; | ||
|
||
const params = { | ||
$, | ||
data: { | ||
text, | ||
providers: providers.join(), | ||
fallback_providers: fallbackProviders?.join(), | ||
show_original_response: showOriginalResponse, | ||
language, | ||
}, | ||
}; | ||
|
||
const response = await this.app.detectAIContent(params); | ||
$.export("$summary", "AI content detection completed successfully"); | ||
return response; | ||
}, | ||
}; |
82 changes: 82 additions & 0 deletions
82
components/eden_ai/actions/generate-image/generate-image.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import app from "../../eden_ai.app.mjs"; | ||
|
||
export default { | ||
key: "eden_ai-generate-image", | ||
name: "Generate Image", | ||
description: "Generates an image from the provided description. [See the documentation](https://docs.edenai.co/reference/image_generation_create)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
text: { | ||
propDefinition: [ | ||
app, | ||
"text", | ||
], | ||
description: "Description of the desired image(s) - the maximum length is 1000 characters.", | ||
}, | ||
resolution: { | ||
type: "string", | ||
label: "Resolution", | ||
description: "Resolution of the image.", | ||
options: [ | ||
"256x256", | ||
"512x512", | ||
"1024x1024", | ||
], | ||
}, | ||
numImages: { | ||
type: "integer", | ||
label: "Number of images", | ||
description: "The number of images to generate.", | ||
optional: true, | ||
default: 1, | ||
min: 1, | ||
max: 10, | ||
}, | ||
providers: { | ||
propDefinition: [ | ||
app, | ||
"providers", | ||
], | ||
}, | ||
fallbackProviders: { | ||
propDefinition: [ | ||
app, | ||
"fallbackProviders", | ||
], | ||
}, | ||
showOriginalResponse: { | ||
propDefinition: [ | ||
app, | ||
"showOriginalResponse", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
text, | ||
resolution, | ||
numImages, | ||
providers, | ||
fallbackProviders, | ||
showOriginalResponse, | ||
} = this; | ||
|
||
const params = { | ||
$, | ||
data: { | ||
text, | ||
resolution, | ||
number_of_images: numImages, | ||
providers: providers.join(), | ||
fallback_providers: fallbackProviders?.join(), | ||
show_original_response: showOriginalResponse, | ||
}, | ||
}; | ||
|
||
const response = await this.app.generateImage(params); | ||
$.export("$summary", "Image generated successfully"); | ||
return response; | ||
}, | ||
}; |
108 changes: 108 additions & 0 deletions
108
components/eden_ai/actions/translate-document/translate-document.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import app from "../../eden_ai.app.mjs"; | ||
import { ConfigurationError } from "@pipedream/platform"; | ||
import FormData from "form-data"; | ||
import fs from "fs"; | ||
|
||
export default { | ||
key: "eden_ai-translate-document", | ||
name: "Translate Document", | ||
description: "Translates a document from a local file or URL. [See the documentation](https://docs.edenai.co/reference/translation_document_translation_create)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
providers: { | ||
propDefinition: [ | ||
app, | ||
"providers", | ||
], | ||
}, | ||
fallbackProviders: { | ||
propDefinition: [ | ||
app, | ||
"fallbackProviders", | ||
], | ||
}, | ||
showOriginalResponse: { | ||
propDefinition: [ | ||
app, | ||
"showOriginalResponse", | ||
], | ||
}, | ||
sourceLanguage: { | ||
propDefinition: [ | ||
app, | ||
"language", | ||
], | ||
label: "Source Language", | ||
optional: true, | ||
}, | ||
targetLanguage: { | ||
propDefinition: [ | ||
app, | ||
"language", | ||
], | ||
label: "Target Language", | ||
}, | ||
file: { | ||
type: "string", | ||
label: "File Path", | ||
description: "The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).", | ||
optional: true, | ||
}, | ||
fileUrl: { | ||
type: "string", | ||
label: "File URL", | ||
description: "The URL of the file to translate", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
providers, fallbackProviders, showOriginalResponse, sourceLanguage, targetLanguage, file, fileUrl, // eslint-disable-line max-len | ||
} = this; | ||
|
||
let headers, data = { | ||
providers: providers.join(), | ||
fallback_providers: fallbackProviders.join(), | ||
show_original_response: showOriginalResponse, | ||
source_language: sourceLanguage, | ||
target_language: targetLanguage, | ||
}; | ||
|
||
if (file) { | ||
const formData = new FormData(); | ||
Object.entries(data).forEach(([ | ||
key, | ||
value, | ||
]) => { | ||
if (value !== undefined) { | ||
formData.append(key, value); | ||
} | ||
}); | ||
|
||
formData.append("file", fs.createReadStream(file.startsWith("/tmp/") | ||
? file | ||
: `/tmp/${file}`)); | ||
headers = { | ||
"Content-Type": `multipart/form-data; boundary=${formData._boundary}`, | ||
}; | ||
data = formData; | ||
} else if (fileUrl) { | ||
data.file_url = fileUrl; | ||
headers = { | ||
"Content-Type": "application/json", | ||
}; | ||
} else { | ||
throw new ConfigurationError("You must provide either a file or a file URL"); | ||
} | ||
|
||
const response = await this.app.translateText({ | ||
$, | ||
data, | ||
headers, | ||
}); | ||
$.export("$summary", "Document translated successfully"); | ||
return response; | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
6b58e13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
pipedream-docs – ./docs
pipedream-docs-pipedreamers.vercel.app
pipedream-docs-git-master-pipedreamers.vercel.app
pipedream-docs-test.vercel.app
docs-proxy.pipedream.net
docs-proxy.pipedream.com