-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Components] speak_ai - new components #16256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,42 @@ | ||
import app from "../../speak_ai.app.mjs"; | ||
|
||
export default { | ||
key: "speak_ai-analyze-text", | ||
name: "Analyze Text", | ||
description: "Analyzes a block of text for key insights, sentiment, and keyword extraction using Speak Ai's NLP engine. [See the documentation](https://docs.speakai.co/#d65573c9-98ad-4089-93ad-9d0a173fdeea).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
folderId: { | ||
propDefinition: [ | ||
app, | ||
"folderId", | ||
], | ||
}, | ||
mediaId: { | ||
propDefinition: [ | ||
app, | ||
"mediaId", | ||
({ folderId }) => ({ | ||
folderId, | ||
mediaType: "text", | ||
}), | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
mediaId, | ||
} = this; | ||
|
||
const response = await app.getTextInsight({ | ||
$, | ||
mediaId, | ||
}); | ||
|
||
$.export("$summary", `Successfully analyzed text with ID \`${response.data.mediaId}\`.`); | ||
return response; | ||
}, | ||
}; |
41 changes: 41 additions & 0 deletions
41
components/speak_ai/actions/get-transcription/get-transcription.mjs
This file contains hidden or 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,41 @@ | ||
import app from "../../speak_ai.app.mjs"; | ||
|
||
export default { | ||
key: "speak_ai-get-transcription", | ||
name: "Get Transcription", | ||
description: "Retrieve the full transcription of a processed media file. [See the documentation](https://docs.speakai.co/#0b586e5b-6e0a-4b79-b440-e6889a803ccd).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
folderId: { | ||
propDefinition: [ | ||
app, | ||
"folderId", | ||
], | ||
}, | ||
mediaId: { | ||
propDefinition: [ | ||
app, | ||
"mediaId", | ||
({ folderId }) => ({ | ||
folderId, | ||
}), | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, | ||
mediaId, | ||
} = this; | ||
|
||
const response = await app.getInsight({ | ||
$, | ||
mediaId, | ||
}); | ||
|
||
$.export("$summary", `Successfully retrieved transcription for media ID \`${response.data.mediaId}\`.`); | ||
return response.data.insight.transcript; | ||
}, | ||
}; |
This file contains hidden or 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 "../../speak_ai.app.mjs"; | ||
|
||
export default { | ||
key: "speak_ai-upload-media", | ||
name: "Upload Media", | ||
description: "Upload an audio or video file for transcription and natural language processing into Speak AI. [See the documentation](https://docs.speakai.co/#c6106a66-6a3d-4b05-b4a2-4a68a4c1e95d).", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the media file", | ||
}, | ||
url: { | ||
type: "string", | ||
label: "URL", | ||
description: "Public URL or AWS signed URL", | ||
}, | ||
mediaType: { | ||
propDefinition: [ | ||
app, | ||
"mediaType", | ||
], | ||
}, | ||
folderId: { | ||
propDefinition: [ | ||
app, | ||
"folderId", | ||
], | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Description of the media file", | ||
optional: true, | ||
}, | ||
tags: { | ||
type: "string[]", | ||
label: "Tags", | ||
description: "Optional metadata tags for the media file upload", | ||
optional: true, | ||
}, | ||
}, | ||
methods: { | ||
uploadMedia(args = {}) { | ||
return this.app.post({ | ||
path: "/media/upload", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
uploadMedia, | ||
name, | ||
url, | ||
mediaType, | ||
folderId, | ||
description, | ||
tags, | ||
} = this; | ||
|
||
const response = await uploadMedia({ | ||
$, | ||
data: { | ||
name, | ||
url, | ||
mediaType, | ||
folderId, | ||
description, | ||
tags: Array.isArray(tags) | ||
? tags.join(",") | ||
: tags, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully uploaded media with ID \`${response.data.mediaId}\`.`); | ||
return response; | ||
}, | ||
}; |
This file contains hidden or 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,13 @@ | ||
const BASE_URL = "https://api.speakai.co"; | ||
const VERSION_PATH = "/v1"; | ||
|
||
const DEFAULT_LIMIT = 50; | ||
|
||
const WEBHOOK_ID = "webhookId"; | ||
|
||
export default { | ||
BASE_URL, | ||
VERSION_PATH, | ||
DEFAULT_LIMIT, | ||
WEBHOOK_ID, | ||
}; |
This file contains hidden or 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/speak_ai", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream Speak AI Components", | ||
"main": "speak_ai.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.3" | ||
} | ||
} | ||
} |
This file contains hidden or 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,18 @@ | ||
export default { | ||
MEDIA_CREATED: "media.created", | ||
MEDIA_ANALYZED: "media.analyzed", | ||
MEDIA_REANALYZED: "media.reanalyzed", | ||
MEDIA_FAILED: "media.failed", | ||
TEXT_CREATED: "text.created", | ||
TEXT_ANALYZED: "text.analyzed", | ||
TEXT_REANALYZED: "text.reanalyzed", | ||
TEXT_FAILED: "text.failed", | ||
TEXT_DELETED: "text.deleted", | ||
EMBED_RECORDER_CREATED: "embed_recorder.created", | ||
EMBED_RECORDER_DELETED: "embed_recorder.deleted", | ||
EMBED_RECORDER_RECORDING_RECEIVED: "embed_recorder.recording_received", | ||
MEETING_ASSISTANT_STATUS: "meeting_assistant.status", | ||
CHAT_STATUS: "chat.status", | ||
CSV_UPLOADED: "csv.uploaded", | ||
CSV_FAILED: "csv.failed", | ||
}; |
This file contains hidden or 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,87 @@ | ||
import { ConfigurationError } from "@pipedream/platform"; | ||
import app from "../../speak_ai.app.mjs"; | ||
import constants from "../../common/constants.mjs"; | ||
|
||
export default { | ||
props: { | ||
app, | ||
db: "$.service.db", | ||
http: "$.interface.http", | ||
}, | ||
hooks: { | ||
async activate() { | ||
const { | ||
http: { endpoint: callbackUrl }, | ||
createWebhook, | ||
getEvents, | ||
setWebhookId, | ||
} = this; | ||
|
||
const response = | ||
await createWebhook({ | ||
data: { | ||
callbackUrl, | ||
events: getEvents(), | ||
}, | ||
}); | ||
|
||
setWebhookId(response.data.webhookId); | ||
}, | ||
async deactivate() { | ||
const { | ||
deleteWebhook, | ||
getWebhookId, | ||
} = this; | ||
|
||
const webhookId = getWebhookId(); | ||
if (webhookId) { | ||
await deleteWebhook({ | ||
webhookId, | ||
}); | ||
} | ||
}, | ||
}, | ||
methods: { | ||
generateMeta() { | ||
throw new ConfigurationError("generateMeta is not implemented"); | ||
}, | ||
setWebhookId(value) { | ||
this.db.set(constants.WEBHOOK_ID, value); | ||
}, | ||
getWebhookId() { | ||
return this.db.get(constants.WEBHOOK_ID); | ||
}, | ||
getEvents() { | ||
throw new ConfigurationError("getEvents is not implemented"); | ||
}, | ||
async getData(resource) { | ||
return resource; | ||
}, | ||
async processResource(resource) { | ||
const data = await this.getData(resource); | ||
this.$emit({ | ||
...resource, | ||
data, | ||
}, this.generateMeta(resource)); | ||
}, | ||
createWebhook(args = {}) { | ||
return this.app.post({ | ||
debug: true, | ||
path: "/webhook", | ||
...args, | ||
}); | ||
}, | ||
deleteWebhook({ | ||
webhookId, ...args | ||
} = {}) { | ||
return this.app.delete({ | ||
debug: true, | ||
path: `/webhook/${webhookId}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ body }) { | ||
await this.processResource(body); | ||
}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
components/speak_ai/sources/new-media-created-instant/new-media-created-instant.mjs
This file contains hidden or 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,35 @@ | ||
import common from "../common/webhook.mjs"; | ||
import events from "../common/events.mjs"; | ||
import sampleEmit from "./test-event.mjs"; | ||
|
||
export default { | ||
...common, | ||
key: "speak_ai-new-media-created-instant", | ||
name: "New Media Created (Instant)", | ||
description: "Emit new event when a new media file is created. Useful for initiating workflows based on new media intake. [See the documentation](https://docs.speakai.co/#5777a89c-a6c3-4d0e-aab1-d33fdec5cbe8).", | ||
version: "0.0.1", | ||
type: "source", | ||
dedupe: "unique", | ||
methods: { | ||
...common.methods, | ||
getEvents() { | ||
return [ | ||
events.MEDIA_CREATED, | ||
]; | ||
}, | ||
async getData(resource) { | ||
const { data } = await this.app.getInsight({ | ||
mediaId: resource.mediaId, | ||
}); | ||
return data; | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
generateMeta(resource) { | ||
return { | ||
id: resource.mediaId, | ||
summary: `New Media Created: ${resource.mediaId}`, | ||
ts: Date.now(), | ||
}; | ||
}, | ||
}, | ||
sampleEmit, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.