Skip to content

Commit d485fcb

Browse files
committed
add configuration error
1 parent e72c47f commit d485fcb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

components/openai/actions/chat/chat.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import openai from "../../openai.app.mjs";
22
import common from "../common/common.mjs";
33
import constants from "../../common/constants.mjs";
4+
import { ConfigurationError } from "@pipedream/platform";
45

56
export default {
67
...common,
@@ -44,7 +45,7 @@ export default {
4445
audio: {
4546
type: "string",
4647
label: "Audio",
47-
description: "Provide the file path to an audio file in the `/tmp` directory. Compatible with the `gpt-4o-audio-preview` model. Currently supports `wav` and `mp3` files.",
48+
description: "Provide the file path to an audio file in the `/tmp` directory. For use with the `gpt-4o-audio-preview` model. Currently supports `wav` and `mp3` files.",
4849
optional: true,
4950
},
5051
responseFormat: {
@@ -71,6 +72,10 @@ export default {
7172
};
7273
},
7374
async run({ $ }) {
75+
if (this.audio && !this.modelId.includes("gpt-4o-audio-preview")) {
76+
throw new ConfigurationError("Use of audio files requires using the `gpt-4o-audio-preview` model.");
77+
}
78+
7479
const args = this._getChatArgs();
7580

7681
const response = await this.openai.createChatCompletion({

0 commit comments

Comments
 (0)