diff --git a/components/openai/actions/analyze-image-content/analyze-image-content.mjs b/components/openai/actions/analyze-image-content/analyze-image-content.mjs index 3062ec31322c9..037c5ba568331 100644 --- a/components/openai/actions/analyze-image-content/analyze-image-content.mjs +++ b/components/openai/actions/analyze-image-content/analyze-image-content.mjs @@ -8,7 +8,7 @@ export default { key: "openai-analyze-image-content", name: "Analyze Image Content", 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)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { openai, diff --git a/components/openai/actions/cancel-run/cancel-run.mjs b/components/openai/actions/cancel-run/cancel-run.mjs index f2fb2bc614054..40d0a6eaf4fc1 100644 --- a/components/openai/actions/cancel-run/cancel-run.mjs +++ b/components/openai/actions/cancel-run/cancel-run.mjs @@ -4,7 +4,7 @@ export default { key: "openai-cancel-run", name: "Cancel Run (Assistants)", description: "Cancels a run that is in progress. [See the documentation](https://platform.openai.com/docs/api-reference/runs/cancelRun)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/chat-with-assistant/chat-with-assistant.mjs b/components/openai/actions/chat-with-assistant/chat-with-assistant.mjs index e7d7d03496eb2..16d9c25d819f5 100644 --- a/components/openai/actions/chat-with-assistant/chat-with-assistant.mjs +++ b/components/openai/actions/chat-with-assistant/chat-with-assistant.mjs @@ -6,7 +6,7 @@ export default { key: "openai-chat-with-assistant", name: "Chat with Assistant", 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)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { openai, diff --git a/components/openai/actions/chat/chat.mjs b/components/openai/actions/chat/chat.mjs index 8f741e50e9551..0d139f6922e76 100644 --- a/components/openai/actions/chat/chat.mjs +++ b/components/openai/actions/chat/chat.mjs @@ -6,7 +6,7 @@ import { ConfigurationError } from "@pipedream/platform"; export default { ...common, name: "Chat", - version: "0.2.1", + version: "0.2.2", key: "openai-chat", 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)", type: "action", diff --git a/components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs b/components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs index 7e30c012cffa5..bf10ee2669a47 100644 --- a/components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs +++ b/components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs @@ -3,7 +3,7 @@ import common from "../common/common-helper.mjs"; export default { ...common, name: "Classify Items into Categories", - version: "0.1.1", + version: "0.1.2", key: "openai-classify-items-into-categories", description: "Classify items into specific categories using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)", type: "action", diff --git a/components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs b/components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs index 890ca942945b6..aad60c68cd1d3 100644 --- a/components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs +++ b/components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs @@ -5,7 +5,7 @@ export default { key: "openai-convert-text-to-speech", name: "Convert Text to Speech (TTS)", description: "Generates audio from the input text. [See the documentation](https://platform.openai.com/docs/api-reference/audio/createSpeech)", - version: "0.0.9", + version: "0.0.10", type: "action", props: { openai, diff --git a/components/openai/actions/create-assistant/create-assistant.mjs b/components/openai/actions/create-assistant/create-assistant.mjs index 4b1a7c5fb872b..da3d212fc2522 100644 --- a/components/openai/actions/create-assistant/create-assistant.mjs +++ b/components/openai/actions/create-assistant/create-assistant.mjs @@ -6,7 +6,7 @@ export default { key: "openai-create-assistant", name: "Create Assistant", description: "Creates an assistant with a model and instructions. [See the documentation](https://platform.openai.com/docs/api-reference/assistants/createAssistant)", - version: "0.1.7", + version: "0.1.8", type: "action", props: { openai, diff --git a/components/openai/actions/create-batch/create-batch.mjs b/components/openai/actions/create-batch/create-batch.mjs index de83b3161f2a2..1c5b18f47f06c 100644 --- a/components/openai/actions/create-batch/create-batch.mjs +++ b/components/openai/actions/create-batch/create-batch.mjs @@ -8,7 +8,7 @@ export default { key: "openai-create-batch", name: "Create Batch", description: "Creates and executes a batch from an uploaded file of requests. [See the documentation](https://platform.openai.com/docs/api-reference/batch/create)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { openai, diff --git a/components/openai/actions/create-embeddings/create-embeddings.mjs b/components/openai/actions/create-embeddings/create-embeddings.mjs index 20d400b6deb7b..66c0697a8d7be 100644 --- a/components/openai/actions/create-embeddings/create-embeddings.mjs +++ b/components/openai/actions/create-embeddings/create-embeddings.mjs @@ -4,7 +4,7 @@ import common from "../common/common.mjs"; export default { name: "Create Embeddings", - version: "0.0.13", + version: "0.0.14", key: "openai-create-embeddings", 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)", type: "action", diff --git a/components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs b/components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs index 611c9daddeb55..6dcc7a58b60e9 100644 --- a/components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs +++ b/components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs @@ -4,7 +4,7 @@ export default { key: "openai-create-fine-tuning-job", name: "Create Fine Tuning Job", 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)", - version: "0.0.9", + version: "0.0.10", type: "action", props: { openai, diff --git a/components/openai/actions/create-image/create-image.mjs b/components/openai/actions/create-image/create-image.mjs index 01a8fb8a5f770..e103ff5c67e28 100644 --- a/components/openai/actions/create-image/create-image.mjs +++ b/components/openai/actions/create-image/create-image.mjs @@ -4,7 +4,7 @@ import fs from "fs"; export default { name: "Create Image (Dall-E)", - version: "0.1.17", + version: "0.1.18", key: "openai-create-image", description: "Creates an image given a prompt returning a URL to the image. [See the documentation](https://platform.openai.com/docs/api-reference/images)", type: "action", diff --git a/components/openai/actions/create-moderation/create-moderation.mjs b/components/openai/actions/create-moderation/create-moderation.mjs index fbb1000812945..4a2646f5cc611 100644 --- a/components/openai/actions/create-moderation/create-moderation.mjs +++ b/components/openai/actions/create-moderation/create-moderation.mjs @@ -5,7 +5,7 @@ export default { key: "openai-create-moderation", name: "Create Moderation", description: "Classifies if text is potentially harmful. [See the documentation](https://platform.openai.com/docs/api-reference/moderations/create)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { openai, diff --git a/components/openai/actions/create-thread/create-thread.mjs b/components/openai/actions/create-thread/create-thread.mjs index f1581782c808e..6047fd0ff7c53 100644 --- a/components/openai/actions/create-thread/create-thread.mjs +++ b/components/openai/actions/create-thread/create-thread.mjs @@ -6,7 +6,7 @@ export default { key: "openai-create-thread", name: "Create Thread (Assistants)", 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)", - version: "0.0.9", + version: "0.0.10", type: "action", props: { openai, diff --git a/components/openai/actions/create-transcription/create-transcription.mjs b/components/openai/actions/create-transcription/create-transcription.mjs index 6fcec2e43d091..8c977872fb8cd 100644 --- a/components/openai/actions/create-transcription/create-transcription.mjs +++ b/components/openai/actions/create-transcription/create-transcription.mjs @@ -24,7 +24,7 @@ const pipelineAsync = promisify(stream.pipeline); export default { name: "Create Transcription (Whisper)", - version: "0.1.13", + version: "0.1.14", key: "openai-create-transcription", description: "Transcribes audio into the input language. [See the documentation](https://platform.openai.com/docs/api-reference/audio/create).", type: "action", diff --git a/components/openai/actions/create-vector-store-file/create-vector-store-file.mjs b/components/openai/actions/create-vector-store-file/create-vector-store-file.mjs new file mode 100644 index 0000000000000..035e72411f8f9 --- /dev/null +++ b/components/openai/actions/create-vector-store-file/create-vector-store-file.mjs @@ -0,0 +1,77 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-create-vector-store-file", + name: "Create Vector Store File", + description: "Create a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/createFile)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + fileId: { + propDefinition: [ + openai, + "fileId", + ], + }, + chunkingStrategy: { + type: "string", + label: "Chunking Strategy", + description: "The chunking strategy used to chunk the file", + options: [ + "auto", + "static", + ], + optional: true, + reloadProps: true, + }, + }, + additionalProps() { + const props = {}; + + if (this?.chunkingStrategy === "static") { + props.maxChunkSizeTokens = { + type: "integer", + label: "Max Chunk Size Tokens", + description: "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.", + default: 800, + optional: true, + }; + props.chunkOverlapTokens = { + type: "integer", + label: "Chunk Overlap Tokens", + description: "The number of tokens that overlap between chunks. The default value is `400`. Note that the overlap must not exceed half of max_chunk_size_tokens.", + default: 400, + optional: true, + }; + } + + return props; + }, + async run({ $ }) { + const response = await this.openai.createVectorStoreFile({ + $, + vectorStoreId: this.vectorStoreId, + data: { + file_id: this.fileId, + chunking_strategy: this.chunkingStrategy && { + type: this.chunkingStrategy, + static: this.chunkingStrategy === "static" + ? { + max_chunk_size_tokens: this.maxChunkSizeTokens, + chunk_overlap_tokens: this.chunkOverlapTokens, + } + : undefined, + }, + }, + }); + $.export("$summary", `Successfully created vector store file with ID: ${response.id}`); + return response; + }, +}; diff --git a/components/openai/actions/create-vector-store/create-vector-store.mjs b/components/openai/actions/create-vector-store/create-vector-store.mjs new file mode 100644 index 0000000000000..3ee22b8216163 --- /dev/null +++ b/components/openai/actions/create-vector-store/create-vector-store.mjs @@ -0,0 +1,103 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-create-vector-store", + name: "Create Vector Store", + description: "Create a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/create)", + version: "0.0.1", + type: "action", + props: { + openai, + fileIds: { + propDefinition: [ + openai, + "fileId", + ], + type: "string[]", + label: "File IDs", + description: "An array of File IDs that the vector store should use", + optional: true, + reloadProps: true, + }, + name: { + type: "string", + label: "Name", + description: "Name of the vector store", + optional: true, + }, + expiryDays: { + type: "integer", + label: "Expiration Days", + description: "The number of days after the `last_active_at` time that the vector store will expire", + optional: true, + }, + metadata: { + type: "object", + label: "Metadata", + description: "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format", + optional: true, + }, + }, + additionalProps() { + const props = {}; + if (!this.fileIds?.length) { + return props; + } + + props.chunkingStrategy = { + type: "string", + label: "Chunking Strategy", + description: "The chunking strategy used to chunk the file(s)", + options: [ + "auto", + "static", + ], + optional: true, + reloadProps: true, + }; + + if (this?.chunkingStrategy === "static") { + props.maxChunkSizeTokens = { + type: "integer", + label: "Max Chunk Size Tokens", + description: "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.", + default: 800, + optional: true, + }; + props.chunkOverlapTokens = { + type: "integer", + label: "Chunk Overlap Tokens", + description: "The number of tokens that overlap between chunks. The default value is `400`. Note that the overlap must not exceed half of max_chunk_size_tokens.", + default: 400, + optional: true, + }; + } + + return props; + }, + async run({ $ }) { + const response = await this.openai.createVectorStore({ + $, + data: { + file_ids: this.fileIds, + name: this.name, + expires_after: this.expiryDays && { + anchor: "last_active_at", + days: this.expiryDays, + }, + chunking_strategy: this.chunkingStrategy && { + type: this.chunkingStrategy, + static: this.chunkingStrategy === "static" + ? { + max_chunk_size_tokens: this.maxChunkSizeTokens, + chunk_overlap_tokens: this.chunkOverlapTokens, + } + : undefined, + }, + metadata: this.metadata, + }, + }); + $.export("$summary", `Successfully created vector store with ID: ${response.id}`); + return response; + }, +}; diff --git a/components/openai/actions/delete-file/delete-file.mjs b/components/openai/actions/delete-file/delete-file.mjs index 9340375ab91d7..9aa7593802a3a 100644 --- a/components/openai/actions/delete-file/delete-file.mjs +++ b/components/openai/actions/delete-file/delete-file.mjs @@ -4,7 +4,7 @@ export default { key: "openai-delete-file", name: "Delete File", description: "Deletes a specified file from OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/delete)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/delete-vector-store-file/delete-vector-store-file.mjs b/components/openai/actions/delete-vector-store-file/delete-vector-store-file.mjs new file mode 100644 index 0000000000000..68ea78acde3dd --- /dev/null +++ b/components/openai/actions/delete-vector-store-file/delete-vector-store-file.mjs @@ -0,0 +1,36 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-delete-vector-store-file", + name: "Delete Vector Store File", + description: "Deletes a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/deleteFile)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + vectorStoreFileId: { + propDefinition: [ + openai, + "vectorStoreFileId", + (c) => ({ + vectorStoreId: c.vectorStoreId, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.openai.deleteVectorStoreFile({ + $, + vectorStoreId: this.vectorStoreId, + vectorStoreFileId: this.vectorStoreFileId, + }); + $.export("$summary", `Successfully deleted vector store file with ID: ${this.vectorStoreFileId}`); + return response; + }, +}; diff --git a/components/openai/actions/delete-vector-store/delete-vector-store.mjs b/components/openai/actions/delete-vector-store/delete-vector-store.mjs new file mode 100644 index 0000000000000..27550a19a255b --- /dev/null +++ b/components/openai/actions/delete-vector-store/delete-vector-store.mjs @@ -0,0 +1,26 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-delete-vector-store", + name: "Delete Vector Store", + description: "Delete a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/delete)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + }, + async run({ $ }) { + const response = await this.openai.deleteVectorStore({ + $, + vectorStoreId: this.vectorStoreId, + }); + $.export("$summary", `Successfully deleted vector store with ID: ${this.vectorStoreId}`); + return response; + }, +}; diff --git a/components/openai/actions/list-files/list-files.mjs b/components/openai/actions/list-files/list-files.mjs index 8c88b1991c2a7..92722d240fc5d 100644 --- a/components/openai/actions/list-files/list-files.mjs +++ b/components/openai/actions/list-files/list-files.mjs @@ -4,7 +4,7 @@ export default { key: "openai-list-files", name: "List Files", 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)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/list-messages/list-messages.mjs b/components/openai/actions/list-messages/list-messages.mjs index 37c2cda81f74e..acbf2087550a9 100644 --- a/components/openai/actions/list-messages/list-messages.mjs +++ b/components/openai/actions/list-messages/list-messages.mjs @@ -4,7 +4,7 @@ export default { key: "openai-list-messages", name: "List Messages (Assistants)", description: "Lists the messages for a given thread. [See the documentation](https://platform.openai.com/docs/api-reference/messages/listMessages)", - version: "0.0.11", + version: "0.0.12", type: "action", props: { openai, diff --git a/components/openai/actions/list-run-steps/list-run-steps.mjs b/components/openai/actions/list-run-steps/list-run-steps.mjs index 3f191a2bd8534..e9a84b3ccd361 100644 --- a/components/openai/actions/list-run-steps/list-run-steps.mjs +++ b/components/openai/actions/list-run-steps/list-run-steps.mjs @@ -4,7 +4,7 @@ export default { key: "openai-list-run-steps", name: "List Run Steps (Assistants)", 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)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/list-runs/list-runs.mjs b/components/openai/actions/list-runs/list-runs.mjs index 1201a20374901..f9d9bd0e4f6b1 100644 --- a/components/openai/actions/list-runs/list-runs.mjs +++ b/components/openai/actions/list-runs/list-runs.mjs @@ -4,7 +4,7 @@ export default { key: "openai-list-runs", name: "List Runs (Assistants)", description: "Returns a list of runs belonging to a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/list)", - version: "0.0.11", + version: "0.0.12", type: "action", props: { openai, diff --git a/components/openai/actions/list-vector-store-files/list-vector-store-files.mjs b/components/openai/actions/list-vector-store-files/list-vector-store-files.mjs new file mode 100644 index 0000000000000..c66f966ceb87c --- /dev/null +++ b/components/openai/actions/list-vector-store-files/list-vector-store-files.mjs @@ -0,0 +1,53 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-list-vector-store-files", + name: "List Vector Store Files", + description: "Returns a list of vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/listFiles)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + limit: { + propDefinition: [ + openai, + "limit", + ], + }, + order: { + propDefinition: [ + openai, + "order", + ], + }, + }, + async run({ $ }) { + const response = this.openai.paginate({ + resourceFn: this.openai.listVectorStoreFiles, + args: { + $, + vectorStoreId: this.vectorStoreId, + params: { + order: this.order, + }, + }, + max: this.limit, + }); + + const vectorStoreFiles = []; + for await (const vectorStoreFile of response) { + vectorStoreFiles.push(vectorStoreFile); + } + + $.export("$summary", `Successfully retrieved ${vectorStoreFiles.length} vector store file${vectorStoreFiles.length === 1 + ? "" + : "s"}`); + return vectorStoreFiles; + }, +}; diff --git a/components/openai/actions/list-vector-stores/list-vector-stores.mjs b/components/openai/actions/list-vector-stores/list-vector-stores.mjs new file mode 100644 index 0000000000000..e8f123a78c4d9 --- /dev/null +++ b/components/openai/actions/list-vector-stores/list-vector-stores.mjs @@ -0,0 +1,46 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-list-vector-stores", + name: "List Vector Stores", + description: "Returns a list of vector stores. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/list)", + version: "0.0.1", + type: "action", + props: { + openai, + limit: { + propDefinition: [ + openai, + "limit", + ], + }, + order: { + propDefinition: [ + openai, + "order", + ], + }, + }, + async run({ $ }) { + const response = this.openai.paginate({ + resourceFn: this.openai.listVectorStores, + args: { + $, + params: { + order: this.order, + }, + }, + max: this.limit, + }); + + const vectorStores = []; + for await (const vectorStore of response) { + vectorStores.push(vectorStore); + } + + $.export("$summary", `Successfully retrieved ${vectorStores.length} vector store${vectorStores.length === 1 + ? "" + : "s"}`); + return vectorStores; + }, +}; diff --git a/components/openai/actions/modify-assistant/modify-assistant.mjs b/components/openai/actions/modify-assistant/modify-assistant.mjs index 37bd585a53c04..9af7ac17a7a1a 100644 --- a/components/openai/actions/modify-assistant/modify-assistant.mjs +++ b/components/openai/actions/modify-assistant/modify-assistant.mjs @@ -6,7 +6,7 @@ export default { key: "openai-modify-assistant", name: "Modify an Assistant", description: "Modifies an existing OpenAI assistant. [See the documentation](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant)", - version: "0.1.7", + version: "0.1.8", type: "action", props: { openai, diff --git a/components/openai/actions/retrieve-file-content/retrieve-file-content.mjs b/components/openai/actions/retrieve-file-content/retrieve-file-content.mjs index 952bba36ccb96..128841faa6ffa 100644 --- a/components/openai/actions/retrieve-file-content/retrieve-file-content.mjs +++ b/components/openai/actions/retrieve-file-content/retrieve-file-content.mjs @@ -5,7 +5,7 @@ export default { key: "openai-retrieve-file-content", name: "Retrieve File Content", description: "Retrieves the contents of the specified file. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve-content)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/retrieve-file/retrieve-file.mjs b/components/openai/actions/retrieve-file/retrieve-file.mjs index 671a9bb3561b9..171fa29378e73 100644 --- a/components/openai/actions/retrieve-file/retrieve-file.mjs +++ b/components/openai/actions/retrieve-file/retrieve-file.mjs @@ -4,7 +4,7 @@ export default { key: "openai-retrieve-file", name: "Retrieve File", description: "Retrieves a specific file from OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/retrieve-run-step/retrieve-run-step.mjs b/components/openai/actions/retrieve-run-step/retrieve-run-step.mjs index 4536673229e3b..0a44686bab787 100644 --- a/components/openai/actions/retrieve-run-step/retrieve-run-step.mjs +++ b/components/openai/actions/retrieve-run-step/retrieve-run-step.mjs @@ -4,7 +4,7 @@ export default { key: "openai-retrieve-run-step", name: "Retrieve Run Step (Assistants)", description: "Retrieve a specific run step in a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/getRunStep)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/retrieve-run/retrieve-run.mjs b/components/openai/actions/retrieve-run/retrieve-run.mjs index e5dfc49cbcbb6..f3827345e7711 100644 --- a/components/openai/actions/retrieve-run/retrieve-run.mjs +++ b/components/openai/actions/retrieve-run/retrieve-run.mjs @@ -4,7 +4,7 @@ export default { key: "openai-retrieve-run", name: "Retrieve Run (Assistants)", description: "Retrieves a specific run within a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/getRun)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs b/components/openai/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs new file mode 100644 index 0000000000000..aa58ba1ae65fe --- /dev/null +++ b/components/openai/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs @@ -0,0 +1,36 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-retrieve-vector-store-file", + name: "Retrieve Vector Store File", + description: "Retrieve a vector store file. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores-files/getFile)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + vectorStoreFileId: { + propDefinition: [ + openai, + "vectorStoreFileId", + (c) => ({ + vectorStoreId: c.vectorStoreId, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.openai.getVectorStoreFile({ + $, + vectorStoreId: this.vectorStoreId, + vectorStoreFileId: this.vectorStoreFileId, + }); + $.export("$summary", `Successfully retrieved vector store file with ID: ${this.vectorStoreFileId}`); + return response; + }, +}; diff --git a/components/openai/actions/retrieve-vector-store/retrieve-vector-store.mjs b/components/openai/actions/retrieve-vector-store/retrieve-vector-store.mjs new file mode 100644 index 0000000000000..858f00c494f66 --- /dev/null +++ b/components/openai/actions/retrieve-vector-store/retrieve-vector-store.mjs @@ -0,0 +1,26 @@ +import openai from "../../openai.app.mjs"; + +export default { + key: "openai-retrieve-vector-store", + name: "Retrieve Vector Store", + description: "Retrieve a vector store. [See the documentation](https://platform.openai.com/docs/api-reference/vector-stores/retrieve)", + version: "0.0.1", + type: "action", + props: { + openai, + vectorStoreId: { + propDefinition: [ + openai, + "vectorStoreId", + ], + }, + }, + async run({ $ }) { + const response = await this.openai.getVectorStore({ + $, + vectorStoreId: this.vectorStoreId, + }); + $.export("$summary", `Successfully retrieved vector store with ID: ${this.vectorStoreId}`); + return response; + }, +}; diff --git a/components/openai/actions/send-prompt/send-prompt.mjs b/components/openai/actions/send-prompt/send-prompt.mjs index fa1bf3abae291..c5c100847ecd9 100644 --- a/components/openai/actions/send-prompt/send-prompt.mjs +++ b/components/openai/actions/send-prompt/send-prompt.mjs @@ -4,7 +4,7 @@ import common from "../common/common.mjs"; export default { ...common, name: "Create Completion (Send Prompt)", - version: "0.1.12", + version: "0.1.13", key: "openai-send-prompt", 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)", type: "action", diff --git a/components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs b/components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs index 72a3b47548369..0c7bb6c7b700c 100644 --- a/components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs +++ b/components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs @@ -5,7 +5,7 @@ export default { key: "openai-submit-tool-outputs-to-run", name: "Submit Tool Outputs to Run (Assistants)", description: "Submits tool outputs to a run that requires action. [See the documentation](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { openai, diff --git a/components/openai/actions/summarize/summarize.mjs b/components/openai/actions/summarize/summarize.mjs index 36e43c22ff4f9..82ddfc6781511 100644 --- a/components/openai/actions/summarize/summarize.mjs +++ b/components/openai/actions/summarize/summarize.mjs @@ -4,7 +4,7 @@ import constants from "../../common/constants.mjs"; export default { ...common, name: "Summarize Text", - version: "0.1.1", + version: "0.1.2", key: "openai-summarize", description: "Summarizes text using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)", type: "action", diff --git a/components/openai/actions/translate-text/translate-text.mjs b/components/openai/actions/translate-text/translate-text.mjs index 9e2758532b2ad..73e5450963a28 100644 --- a/components/openai/actions/translate-text/translate-text.mjs +++ b/components/openai/actions/translate-text/translate-text.mjs @@ -9,7 +9,7 @@ const langOptions = lang.LANGUAGES.map((l) => ({ export default { ...common, name: "Translate Text (Whisper)", - version: "0.1.1", + version: "0.1.2", key: "openai-translate-text", description: "Translate text from one language to another using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)", type: "action", diff --git a/components/openai/actions/upload-file/upload-file.mjs b/components/openai/actions/upload-file/upload-file.mjs index 5b6aa9c981cac..13fa75a99ef69 100644 --- a/components/openai/actions/upload-file/upload-file.mjs +++ b/components/openai/actions/upload-file/upload-file.mjs @@ -6,7 +6,7 @@ export default { key: "openai-upload-file", name: "Upload File", 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)", - version: "0.0.13", + version: "0.0.14", type: "action", props: { openai, diff --git a/components/openai/openai.app.mjs b/components/openai/openai.app.mjs index afc6469debd14..c8d28bbdc225b 100644 --- a/components/openai/openai.app.mjs +++ b/components/openai/openai.app.mjs @@ -67,6 +67,58 @@ export default { }; }, }, + vectorStoreId: { + type: "string", + label: "Vector Store ID", + description: "The identifier of a vector store", + async options({ prevContext }) { + const params = prevContext?.after + ? { + after: prevContext.after, + } + : {}; + const { + data: vectorStores, last_id: after, + } = await this.listVectorStores({ + params, + }); + return { + options: vectorStores.map((vectorStore) => ({ + label: vectorStore.name || vectorStore.id, + value: vectorStore.id, + })), + context: { + after, + }, + }; + }, + }, + vectorStoreFileId: { + type: "string", + label: "Vector Store File ID", + description: "The identifier of a vector store file", + async options({ + vectorStoreId, prevContext, + }) { + const params = prevContext?.after + ? { + after: prevContext.after, + } + : {}; + const { + data: vectorStoreFiles, last_id: after, + } = await this.listVectorStoreFiles({ + vectorStoreId, + params, + }); + return { + options: vectorStoreFiles.map((vectorStoreFile) => vectorStoreFile.id), + context: { + after, + }, + }; + }, + }, name: { type: "string", label: "Name", @@ -620,6 +672,15 @@ export default { ...args, }); }, + getVectorStore({ + vectorStoreId, ...args + }) { + return this._makeRequest({ + path: `/vector_stores/${vectorStoreId}`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, listVectorStores(args = {}) { return this._makeRequest({ path: "/vector_stores", @@ -627,6 +688,62 @@ export default { ...args, }); }, + createVectorStore(args = {}) { + return this._makeRequest({ + method: "POST", + path: "/vector_stores", + headers: this._betaHeaders("v2"), + ...args, + }); + }, + deleteVectorStore({ + vectorStoreId, ...args + }) { + return this._makeRequest({ + method: "DELETE", + path: `/vector_stores/${vectorStoreId}`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, + getVectorStoreFile({ + vectorStoreId, vectorStoreFileId, ...args + }) { + return this._makeRequest({ + path: `/vector_stores/${vectorStoreId}/files/${vectorStoreFileId}`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, + listVectorStoreFiles({ + vectorStoreId, ...args + }) { + return this._makeRequest({ + path: `/vector_stores/${vectorStoreId}/files`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, + createVectorStoreFile({ + vectorStoreId, ...args + }) { + return this._makeRequest({ + method: "POST", + path: `/vector_stores/${vectorStoreId}/files`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, + deleteVectorStoreFile({ + vectorStoreId, vectorStoreFileId, ...args + }) { + return this._makeRequest({ + method: "DELETE", + path: `/vector_stores/${vectorStoreId}/files/${vectorStoreFileId}`, + headers: this._betaHeaders("v2"), + ...args, + }); + }, createModeration(args = {}) { return this._makeRequest({ method: "POST", diff --git a/components/openai/package.json b/components/openai/package.json index 79c6ebea67a8f..37800efcf05e4 100644 --- a/components/openai/package.json +++ b/components/openai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/openai", - "version": "0.6.1", + "version": "0.7.0", "description": "Pipedream OpenAI Components", "main": "openai.app.mjs", "keywords": [ diff --git a/components/openai/sources/new-batch-completed/new-batch-completed.mjs b/components/openai/sources/new-batch-completed/new-batch-completed.mjs index 66904d43aabbb..d6729d664db88 100644 --- a/components/openai/sources/new-batch-completed/new-batch-completed.mjs +++ b/components/openai/sources/new-batch-completed/new-batch-completed.mjs @@ -6,7 +6,7 @@ export default { key: "openai-new-batch-completed", name: "New Batch Completed", description: "Emit new event when a new batch is completed in OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/batch/list)", - version: "0.0.4", + version: "0.0.5", type: "source", dedupe: "unique", methods: { diff --git a/components/openai/sources/new-file-created/new-file-created.mjs b/components/openai/sources/new-file-created/new-file-created.mjs index 90263faa0bc0b..dc92e4d5d3c79 100644 --- a/components/openai/sources/new-file-created/new-file-created.mjs +++ b/components/openai/sources/new-file-created/new-file-created.mjs @@ -6,7 +6,7 @@ export default { key: "openai-new-file-created", name: "New File Created", description: "Emit new event when a new file is created in OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/list)", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", props: { diff --git a/components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs b/components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs index 610022d0d259e..cdf35531b4f24 100644 --- a/components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs +++ b/components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs @@ -6,7 +6,7 @@ export default { key: "openai-new-fine-tuning-job-created", name: "New Fine Tuning Job Created", 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)", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", methods: { diff --git a/components/openai/sources/new-run-state-changed/new-run-state-changed.mjs b/components/openai/sources/new-run-state-changed/new-run-state-changed.mjs index 7536c757cdb4f..31ec1fe5265e2 100644 --- a/components/openai/sources/new-run-state-changed/new-run-state-changed.mjs +++ b/components/openai/sources/new-run-state-changed/new-run-state-changed.mjs @@ -6,7 +6,7 @@ export default { key: "openai-new-run-state-changed", name: "New Run State Changed", description: "Emit new event every time a run changes its status. [See the documentation](https://platform.openai.com/docs/api-reference/runs/listRuns)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", props: {