@pipedream/openai 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/analyze-image-content/analyze-image-content.mjs +1 -1
- package/actions/cancel-run/cancel-run.mjs +1 -1
- package/actions/chat/chat.mjs +1 -1
- package/actions/chat-with-assistant/chat-with-assistant.mjs +1 -1
- package/actions/classify-items-into-categories/classify-items-into-categories.mjs +1 -1
- package/actions/convert-text-to-speech/convert-text-to-speech.mjs +1 -1
- package/actions/create-assistant/create-assistant.mjs +1 -1
- package/actions/create-batch/create-batch.mjs +1 -1
- package/actions/create-embeddings/create-embeddings.mjs +1 -1
- package/actions/create-fine-tuning-job/create-fine-tuning-job.mjs +1 -1
- package/actions/create-image/create-image.mjs +1 -1
- package/actions/create-moderation/create-moderation.mjs +1 -1
- package/actions/create-thread/create-thread.mjs +1 -1
- package/actions/create-vector-store/create-vector-store.mjs +1 -1
- package/actions/create-vector-store-file/create-vector-store-file.mjs +1 -1
- package/actions/delete-file/delete-file.mjs +1 -1
- package/actions/delete-vector-store/delete-vector-store.mjs +1 -1
- package/actions/delete-vector-store-file/delete-vector-store-file.mjs +1 -1
- package/actions/list-files/list-files.mjs +1 -1
- package/actions/list-messages/list-messages.mjs +1 -1
- package/actions/list-run-steps/list-run-steps.mjs +1 -1
- package/actions/list-runs/list-runs.mjs +1 -1
- package/actions/list-vector-store-files/list-vector-store-files.mjs +1 -1
- package/actions/list-vector-stores/list-vector-stores.mjs +1 -1
- package/actions/modify-assistant/modify-assistant.mjs +1 -1
- package/actions/retrieve-file/retrieve-file.mjs +1 -1
- package/actions/retrieve-file-content/retrieve-file-content.mjs +1 -1
- package/actions/retrieve-run/retrieve-run.mjs +1 -1
- package/actions/retrieve-run-step/retrieve-run-step.mjs +1 -1
- package/actions/retrieve-vector-store/retrieve-vector-store.mjs +1 -1
- package/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs +1 -1
- package/actions/send-prompt/send-prompt.mjs +1 -1
- package/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs +1 -1
- package/actions/summarize/summarize.mjs +1 -1
- package/actions/translate-text/translate-text.mjs +1 -1
- package/actions/upload-file/upload-file.mjs +1 -1
- package/openai.app.mjs +1 -1
- package/package.json +1 -2
- package/sources/new-batch-completed/new-batch-completed.mjs +1 -1
- package/sources/new-file-created/new-file-created.mjs +1 -1
- package/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs +1 -1
- package/sources/new-run-state-changed/new-run-state-changed.mjs +1 -1
- package/actions/create-transcription/create-transcription.mjs +0 -264
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "openai-analyze-image-content",
|
|
9
9
|
name: "Analyze Image Content",
|
|
10
10
|
description: "Send a message or question about an image and receive a response. [See the documentation](https://platform.openai.com/docs/api-reference/runs/createThreadAndRun)",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.4",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-cancel-run",
|
|
5
5
|
name: "Cancel Run (Assistants)",
|
|
6
6
|
description: "Cancels a run that is in progress. [See the documentation](https://platform.openai.com/docs/api-reference/runs/cancelRun)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
package/actions/chat/chat.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { ConfigurationError } from "@pipedream/platform";
|
|
|
6
6
|
export default {
|
|
7
7
|
...common,
|
|
8
8
|
name: "Chat",
|
|
9
|
-
version: "0.2.
|
|
9
|
+
version: "0.2.5",
|
|
10
10
|
key: "openai-chat",
|
|
11
11
|
description: "The Chat API, using the `gpt-3.5-turbo` or `gpt-4` model. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
|
|
12
12
|
type: "action",
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-chat-with-assistant",
|
|
7
7
|
name: "Chat with Assistant",
|
|
8
8
|
description: "Sends a message and generates a response, storing the message history for a continuous conversation. [See the documentation](https://platform.openai.com/docs/api-reference/runs/createThreadAndRun)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.9",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
openai,
|
|
@@ -3,7 +3,7 @@ import common from "../common/common-helper.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
...common,
|
|
5
5
|
name: "Classify Items into Categories",
|
|
6
|
-
version: "0.1.
|
|
6
|
+
version: "0.1.4",
|
|
7
7
|
key: "openai-classify-items-into-categories",
|
|
8
8
|
description: "Classify items into specific categories using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
|
|
9
9
|
type: "action",
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "openai-convert-text-to-speech",
|
|
6
6
|
name: "Convert Text to Speech (TTS)",
|
|
7
7
|
description: "Generates audio from the input text. [See the documentation](https://platform.openai.com/docs/api-reference/audio/createSpeech)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.12",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
openai,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-create-assistant",
|
|
7
7
|
name: "Create Assistant",
|
|
8
8
|
description: "Creates an assistant with a model and instructions. [See the documentation](https://platform.openai.com/docs/api-reference/assistants/createAssistant)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.11",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
openai,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "openai-create-batch",
|
|
9
9
|
name: "Create Batch",
|
|
10
10
|
description: "Creates and executes a batch from an uploaded file of requests. [See the documentation](https://platform.openai.com/docs/api-reference/batch/create)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.7",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
openai,
|
|
@@ -4,7 +4,7 @@ import common from "../common/common.mjs";
|
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
name: "Create Embeddings",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.16",
|
|
8
8
|
key: "openai-create-embeddings",
|
|
9
9
|
description: "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. [See the documentation](https://platform.openai.com/docs/api-reference/embeddings)",
|
|
10
10
|
type: "action",
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-create-fine-tuning-job",
|
|
5
5
|
name: "Create Fine Tuning Job",
|
|
6
6
|
description: "Creates a job that fine-tunes a specified model from a given dataset. [See the documentation](https://platform.openai.com/docs/api-reference/fine-tuning/create)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.12",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ import fs from "fs";
|
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
name: "Create Image (Dall-E)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.20",
|
|
8
8
|
key: "openai-create-image",
|
|
9
9
|
description: "Creates an image given a prompt returning a URL to the image. [See the documentation](https://platform.openai.com/docs/api-reference/images)",
|
|
10
10
|
type: "action",
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "openai-create-moderation",
|
|
6
6
|
name: "Create Moderation",
|
|
7
7
|
description: "Classifies if text is potentially harmful. [See the documentation](https://platform.openai.com/docs/api-reference/moderations/create)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.7",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
openai,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-create-thread",
|
|
7
7
|
name: "Create Thread (Assistants)",
|
|
8
8
|
description: "Creates a thread with optional messages and metadata, and optionally runs the thread using the specified assistant. [See the documentation](https://platform.openai.com/docs/api-reference/threads/createThread)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.13",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-create-vector-store",
|
|
5
5
|
name: "Create Vector Store",
|
|
6
6
|
description: "Create a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/create)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-create-vector-store-file",
|
|
5
5
|
name: "Create Vector Store File",
|
|
6
6
|
description: "Create a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/createFile)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-delete-file",
|
|
5
5
|
name: "Delete File",
|
|
6
6
|
description: "Deletes a specified file from OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/delete)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-delete-vector-store",
|
|
5
5
|
name: "Delete Vector Store",
|
|
6
6
|
description: "Delete a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/delete)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-delete-vector-store-file",
|
|
5
5
|
name: "Delete Vector Store File",
|
|
6
6
|
description: "Deletes a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/deleteFile)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-files",
|
|
5
5
|
name: "List Files",
|
|
6
6
|
description: "Returns a list of files that belong to the user's organization. [See the documentation](https://platform.openai.com/docs/api-reference/files/list)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-messages",
|
|
5
5
|
name: "List Messages (Assistants)",
|
|
6
6
|
description: "Lists the messages for a given thread. [See the documentation](https://platform.openai.com/docs/api-reference/messages/listMessages)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.14",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-run-steps",
|
|
5
5
|
name: "List Run Steps (Assistants)",
|
|
6
6
|
description: "Returns a list of run steps belonging to a run. [See the documentation](https://platform.openai.com/docs/api-reference/runs/list-run-steps)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-runs",
|
|
5
5
|
name: "List Runs (Assistants)",
|
|
6
6
|
description: "Returns a list of runs belonging to a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/list)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.14",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-vector-store-files",
|
|
5
5
|
name: "List Vector Store Files",
|
|
6
6
|
description: "Returns a list of vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/listFiles)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-list-vector-stores",
|
|
5
5
|
name: "List Vector Stores",
|
|
6
6
|
description: "Returns a list of vector stores. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/list)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-modify-assistant",
|
|
7
7
|
name: "Modify an Assistant",
|
|
8
8
|
description: "Modifies an existing OpenAI assistant. [See the documentation](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.11",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-retrieve-file",
|
|
5
5
|
name: "Retrieve File",
|
|
6
6
|
description: "Retrieves a specific file from OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "openai-retrieve-file-content",
|
|
6
6
|
name: "Retrieve File Content",
|
|
7
7
|
description: "Retrieves the contents of the specified file. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve-content)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.13",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-retrieve-run",
|
|
5
5
|
name: "Retrieve Run (Assistants)",
|
|
6
6
|
description: "Retrieves a specific run within a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/getRun)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-retrieve-run-step",
|
|
5
5
|
name: "Retrieve Run Step (Assistants)",
|
|
6
6
|
description: "Retrieve a specific run step in a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/getRunStep)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-retrieve-vector-store",
|
|
5
5
|
name: "Retrieve Vector Store",
|
|
6
6
|
description: "Retrieve a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/retrieve)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "openai-retrieve-vector-store-file",
|
|
5
5
|
name: "Retrieve Vector Store File",
|
|
6
6
|
description: "Retrieve a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/getFile)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
openai,
|
|
@@ -4,7 +4,7 @@ import common from "../common/common.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
...common,
|
|
6
6
|
name: "Create Completion (Send Prompt)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.15",
|
|
8
8
|
key: "openai-send-prompt",
|
|
9
9
|
description: "OpenAI recommends using the **Chat** action for the latest `gpt-3.5-turbo` API, since it's faster and 10x cheaper. This action creates a completion for the provided prompt and parameters using the older `/completions` API. [See the documentation](https://beta.openai.com/docs/api-reference/completions/create)",
|
|
10
10
|
type: "action",
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "openai-submit-tool-outputs-to-run",
|
|
6
6
|
name: "Submit Tool Outputs to Run (Assistants)",
|
|
7
7
|
description: "Submits tool outputs to a run that requires action. [See the documentation](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.13",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
openai,
|
|
@@ -4,7 +4,7 @@ import constants from "../../common/constants.mjs";
|
|
|
4
4
|
export default {
|
|
5
5
|
...common,
|
|
6
6
|
name: "Summarize Text",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.4",
|
|
8
8
|
key: "openai-summarize",
|
|
9
9
|
description: "Summarizes text using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
|
|
10
10
|
type: "action",
|
|
@@ -9,7 +9,7 @@ const langOptions = lang.LANGUAGES.map((l) => ({
|
|
|
9
9
|
export default {
|
|
10
10
|
...common,
|
|
11
11
|
name: "Translate Text (Whisper)",
|
|
12
|
-
version: "0.1.
|
|
12
|
+
version: "0.1.4",
|
|
13
13
|
key: "openai-translate-text",
|
|
14
14
|
description: "Translate text from one language to another using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
|
|
15
15
|
type: "action",
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-upload-file",
|
|
7
7
|
name: "Upload File",
|
|
8
8
|
description: "Upload a file that can be used across various endpoints/features. The size of individual files can be a maximum of 512mb. [See the documentation](https://platform.openai.com/docs/api-reference/files/create)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.16",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
openai,
|
package/openai.app.mjs
CHANGED
|
@@ -349,7 +349,7 @@ export default {
|
|
|
349
349
|
const models = await this.models({
|
|
350
350
|
$,
|
|
351
351
|
});
|
|
352
|
-
return models.filter((model) => model.id.match(/
|
|
352
|
+
return models.filter((model) => model.id.match(/4o|o[1-9]/gi));
|
|
353
353
|
},
|
|
354
354
|
async getCompletionModels({ $ }) {
|
|
355
355
|
const models = await this.models({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Pipedream OpenAI Components",
|
|
5
5
|
"main": "openai.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
18
17
|
"@pipedream/platform": "^3.0.3",
|
|
19
18
|
"@pipedream/types": "^0.1.4",
|
|
20
19
|
"axios": "^1.6.2",
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-new-batch-completed",
|
|
7
7
|
name: "New Batch Completed",
|
|
8
8
|
description: "Emit new event when a new batch is completed in OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/batch/list)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.7",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-new-file-created",
|
|
7
7
|
name: "New File Created",
|
|
8
8
|
description: "Emit new event when a new file is created in OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/list)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.12",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-new-fine-tuning-job-created",
|
|
7
7
|
name: "New Fine Tuning Job Created",
|
|
8
8
|
description: "Emit new event when a new fine-tuning job is created in OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/fine-tuning/list)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.12",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "openai-new-run-state-changed",
|
|
7
7
|
name: "New Run State Changed",
|
|
8
8
|
description: "Emit new event every time a run changes its status. [See the documentation](https://platform.openai.com/docs/api-reference/runs/listRuns)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.8",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
props: {
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import ffmpegInstaller from "@ffmpeg-installer/ffmpeg";
|
|
2
|
-
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
-
import axios from "axios";
|
|
4
|
-
import Bottleneck from "bottleneck";
|
|
5
|
-
import { exec } from "child_process";
|
|
6
|
-
import FormData from "form-data";
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import {
|
|
9
|
-
extname,
|
|
10
|
-
join,
|
|
11
|
-
} from "path";
|
|
12
|
-
import stream from "stream";
|
|
13
|
-
import { promisify } from "util";
|
|
14
|
-
import openai from "../../openai.app.mjs";
|
|
15
|
-
import common from "../common/common.mjs";
|
|
16
|
-
import constants from "../../common/constants.mjs";
|
|
17
|
-
import lang from "../common/lang.mjs";
|
|
18
|
-
|
|
19
|
-
const COMMON_AUDIO_FORMATS_TEXT = "Your audio file must be in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.";
|
|
20
|
-
const CHUNK_SIZE_MB = 20;
|
|
21
|
-
|
|
22
|
-
const execAsync = promisify(exec);
|
|
23
|
-
const pipelineAsync = promisify(stream.pipeline);
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
name: "Create Transcription (Whisper)",
|
|
27
|
-
version: "0.1.15",
|
|
28
|
-
key: "openai-create-transcription",
|
|
29
|
-
description: "Transcribes audio into the input language. [See the documentation](https://platform.openai.com/docs/api-reference/audio/create).",
|
|
30
|
-
type: "action",
|
|
31
|
-
props: {
|
|
32
|
-
openai,
|
|
33
|
-
uploadType: {
|
|
34
|
-
label: "Audio Upload Type",
|
|
35
|
-
description: "Are you uploading an audio file from [your workflow's `/tmp` directory](https://pipedream.com/docs/code/nodejs/working-with-files/#the-tmp-directory), or providing a URL to the file?",
|
|
36
|
-
type: "string",
|
|
37
|
-
options: [
|
|
38
|
-
"File",
|
|
39
|
-
"URL",
|
|
40
|
-
],
|
|
41
|
-
reloadProps: true,
|
|
42
|
-
},
|
|
43
|
-
language: {
|
|
44
|
-
label: "Language",
|
|
45
|
-
description: "**Optional**. The language of the input audio. Supplying the input language will improve accuracy and latency.",
|
|
46
|
-
type: "string",
|
|
47
|
-
optional: true,
|
|
48
|
-
options: lang.LANGUAGES.map((l) => ({
|
|
49
|
-
label: l.label,
|
|
50
|
-
value: l.value,
|
|
51
|
-
})),
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
async additionalProps() {
|
|
55
|
-
const props = {};
|
|
56
|
-
switch (this.uploadType) {
|
|
57
|
-
case "File":
|
|
58
|
-
props.path = {
|
|
59
|
-
type: "string",
|
|
60
|
-
label: "File Path",
|
|
61
|
-
description: `A path to your audio file to transcribe, e.g. \`/tmp/audio.mp3\`. ${COMMON_AUDIO_FORMATS_TEXT} Add the appropriate extension (mp3, mp4, etc.) on your filename — OpenAI uses the extension to determine the file type. [See the Pipedream docs on saving files to \`/tmp\`](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)`,
|
|
62
|
-
};
|
|
63
|
-
break;
|
|
64
|
-
case "URL":
|
|
65
|
-
props.url = {
|
|
66
|
-
type: "string",
|
|
67
|
-
label: "URL",
|
|
68
|
-
description: `A public URL to the audio file to transcribe. This URL must point directly to the audio file, not a webpage that links to the audio file. ${COMMON_AUDIO_FORMATS_TEXT}`,
|
|
69
|
-
};
|
|
70
|
-
break;
|
|
71
|
-
default:
|
|
72
|
-
throw new ConfigurationError("Invalid upload type specified. Please provide 'File' or 'URL'.");
|
|
73
|
-
}
|
|
74
|
-
// Because we need to display the file or URL above, and not below, these optional props
|
|
75
|
-
// TODO: Will be fixed when we render optional props correctly when used with additionalProps
|
|
76
|
-
props.prompt = {
|
|
77
|
-
label: "Prompt",
|
|
78
|
-
description: "**Optional** text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting) should match the audio language.",
|
|
79
|
-
type: "string",
|
|
80
|
-
optional: true,
|
|
81
|
-
};
|
|
82
|
-
props.responseFormat = {
|
|
83
|
-
label: "Response Format",
|
|
84
|
-
description: "**Optional**. The format of the response. The default is `json`.",
|
|
85
|
-
type: "string",
|
|
86
|
-
default: "json",
|
|
87
|
-
optional: true,
|
|
88
|
-
options: constants.TRANSCRIPTION_FORMATS,
|
|
89
|
-
};
|
|
90
|
-
props.temperature = common.props.temperature;
|
|
91
|
-
|
|
92
|
-
return props;
|
|
93
|
-
},
|
|
94
|
-
methods: {
|
|
95
|
-
createForm({
|
|
96
|
-
file, outputDir,
|
|
97
|
-
}) {
|
|
98
|
-
const form = new FormData();
|
|
99
|
-
form.append("model", "whisper-1");
|
|
100
|
-
if (this.prompt) form.append("prompt", this.prompt);
|
|
101
|
-
if (this.temperature) form.append("temperature", this.temperature);
|
|
102
|
-
if (this.language) form.append("language", this.language);
|
|
103
|
-
if (this.responseFormat) form.append("response_format", this.responseFormat);
|
|
104
|
-
const readStream = fs.createReadStream(join(outputDir, file));
|
|
105
|
-
form.append("file", readStream);
|
|
106
|
-
return form;
|
|
107
|
-
},
|
|
108
|
-
async splitLargeChunks(files, outputDir) {
|
|
109
|
-
for (const file of files) {
|
|
110
|
-
if (fs.statSync(`${outputDir}/${file}`).size / (1024 * 1024) > CHUNK_SIZE_MB) {
|
|
111
|
-
await this.chunkFile({
|
|
112
|
-
file: `${outputDir}/${file}`,
|
|
113
|
-
outputDir,
|
|
114
|
-
index: file.slice(6, 9),
|
|
115
|
-
});
|
|
116
|
-
await execAsync(`rm -f "${outputDir}/${file}"`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
async chunkFileAndTranscribe({
|
|
121
|
-
file, $,
|
|
122
|
-
}) {
|
|
123
|
-
const outputDir = join("/tmp", "chunks");
|
|
124
|
-
await execAsync(`mkdir -p "${outputDir}"`);
|
|
125
|
-
await execAsync(`rm -f "${outputDir}/*"`);
|
|
126
|
-
|
|
127
|
-
await this.chunkFile({
|
|
128
|
-
file,
|
|
129
|
-
outputDir,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
let files = await fs.promises.readdir(outputDir);
|
|
133
|
-
// ffmpeg will sometimes return chunks larger than the allowed size,
|
|
134
|
-
// so we need to identify large chunks and break them down further
|
|
135
|
-
await this.splitLargeChunks(files, outputDir);
|
|
136
|
-
files = await fs.promises.readdir(outputDir);
|
|
137
|
-
|
|
138
|
-
return this.transcribeFiles({
|
|
139
|
-
files,
|
|
140
|
-
outputDir,
|
|
141
|
-
$,
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
async chunkFile({
|
|
145
|
-
file, outputDir, index,
|
|
146
|
-
}) {
|
|
147
|
-
const ffmpegPath = ffmpegInstaller.path;
|
|
148
|
-
const ext = extname(file);
|
|
149
|
-
|
|
150
|
-
const fileSizeInMB = fs.statSync(file).size / (1024 * 1024);
|
|
151
|
-
// We're limited to 26MB per request. Because of how ffmpeg splits files,
|
|
152
|
-
// we need to be conservative in the number of chunks we create
|
|
153
|
-
const conservativeChunkSizeMB = CHUNK_SIZE_MB;
|
|
154
|
-
const numberOfChunks = !index
|
|
155
|
-
? Math.ceil(fileSizeInMB / conservativeChunkSizeMB)
|
|
156
|
-
: 2;
|
|
157
|
-
|
|
158
|
-
if (numberOfChunks === 1) {
|
|
159
|
-
await execAsync(`cp "${file}" "${outputDir}/chunk-000${ext}"`);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const { stdout } = await execAsync(`${ffmpegPath} -i "${file}" 2>&1 | grep "Duration"`);
|
|
164
|
-
const duration = stdout.match(/\d{2}:\d{2}:\d{2}\.\d{2}/s)[0];
|
|
165
|
-
const [
|
|
166
|
-
hours,
|
|
167
|
-
minutes,
|
|
168
|
-
seconds,
|
|
169
|
-
] = duration.split(":").map(parseFloat);
|
|
170
|
-
|
|
171
|
-
const totalSeconds = (hours * 60 * 60) + (minutes * 60) + seconds;
|
|
172
|
-
const segmentTime = Math.ceil(totalSeconds / numberOfChunks);
|
|
173
|
-
|
|
174
|
-
const command = `${ffmpegPath} -i "${file}" -f segment -segment_time ${segmentTime} -c copy "${outputDir}/chunk-${index
|
|
175
|
-
? `${index}-`
|
|
176
|
-
: ""}%03d${ext}"`;
|
|
177
|
-
await execAsync(command);
|
|
178
|
-
},
|
|
179
|
-
transcribeFiles({
|
|
180
|
-
files, outputDir, $,
|
|
181
|
-
}) {
|
|
182
|
-
const limiter = new Bottleneck({
|
|
183
|
-
maxConcurrent: 1,
|
|
184
|
-
minTime: 1000 / 59,
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
return Promise.all(files.map((file) => {
|
|
188
|
-
return limiter.schedule(() => this.transcribe({
|
|
189
|
-
file,
|
|
190
|
-
outputDir,
|
|
191
|
-
$,
|
|
192
|
-
}));
|
|
193
|
-
}));
|
|
194
|
-
},
|
|
195
|
-
transcribe({
|
|
196
|
-
file, outputDir, $,
|
|
197
|
-
}) {
|
|
198
|
-
const form = this.createForm({
|
|
199
|
-
file,
|
|
200
|
-
outputDir,
|
|
201
|
-
});
|
|
202
|
-
return this.openai.createTranscription({
|
|
203
|
-
$,
|
|
204
|
-
form,
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
getFullText(transcriptions = []) {
|
|
208
|
-
return transcriptions.map((t) => t.text || t).join(" ");
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
async run({ $ }) {
|
|
212
|
-
const {
|
|
213
|
-
url,
|
|
214
|
-
path,
|
|
215
|
-
} = this;
|
|
216
|
-
|
|
217
|
-
if (!url && !path) {
|
|
218
|
-
throw new ConfigurationError("Must specify either File URL or File Path");
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
let file;
|
|
222
|
-
|
|
223
|
-
if (path) {
|
|
224
|
-
if (!fs.existsSync(path)) {
|
|
225
|
-
throw new ConfigurationError(`${path} does not exist`);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
file = path;
|
|
229
|
-
} else if (url) {
|
|
230
|
-
const ext = extname(url).split("?")[0];
|
|
231
|
-
|
|
232
|
-
const response = await axios({
|
|
233
|
-
method: "GET",
|
|
234
|
-
url,
|
|
235
|
-
responseType: "stream",
|
|
236
|
-
timeout: 250000,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
const bufferStream = new stream.PassThrough();
|
|
240
|
-
response.data.pipe(bufferStream);
|
|
241
|
-
|
|
242
|
-
const downloadPath = join("/tmp", `audio${ext}`);
|
|
243
|
-
const writeStream = fs.createWriteStream(downloadPath);
|
|
244
|
-
|
|
245
|
-
await pipelineAsync(bufferStream, writeStream);
|
|
246
|
-
|
|
247
|
-
file = downloadPath;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const transcriptions = await this.chunkFileAndTranscribe({
|
|
251
|
-
file,
|
|
252
|
-
$,
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
if (transcriptions.length) {
|
|
256
|
-
$.export("$summary", "Successfully created transcription");
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return {
|
|
260
|
-
transcription: this.getFullText(transcriptions),
|
|
261
|
-
transcriptions,
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
};
|