Skip to content

Commit 43f5a2f

Browse files
authored
OpenAI - use max_completion_tokens (#17287)
* use max_completion_tokens for o1, o2, & o3 models * pnpm-lock.yaml * versions
1 parent 9ff0a29 commit 43f5a2f

File tree

11 files changed

+17
-12
lines changed

11 files changed

+17
-12
lines changed

components/openai/actions/chat-using-file-search/chat-using-file-search.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import constants from "../../common/constants.mjs";
55
export default {
66
...common,
77
name: "Chat using File Search",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
key: "openai-chat-using-file-search",
1010
description: "Chat with your files knowledge base (vector stores). [See the documentation](https://platform.openai.com/docs/guides/tools-file-search)",
1111
type: "action",

components/openai/actions/chat-using-functions/chat-using-functions.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import constants from "../../common/constants.mjs";
55
export default {
66
...common,
77
name: "Chat using Functions",
8-
version: "0.0.5",
8+
version: "0.0.6",
99
key: "openai-chat-using-functions",
1010
description: "Chat with your models and allow them to invoke functions. Optionally, you can build and invoke workflows as functions. [See the documentation](https://platform.openai.com/docs/guides/function-calling)",
1111
type: "action",

components/openai/actions/chat-using-web-search/chat-using-web-search.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import constants from "../../common/constants.mjs";
55
export default {
66
...common,
77
name: "Chat using Web Search",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
key: "openai-chat-using-web-search",
1010
description: "Chat using the web search tool. [See the documentation](https://platform.openai.com/docs/guides/tools-web-search)",
1111
type: "action",

components/openai/actions/chat/chat.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import constants from "../../common/constants.mjs";
55
export default {
66
...common,
77
name: "Chat",
8-
version: "0.3.0",
8+
version: "0.3.1",
99
key: "openai-chat",
1010
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)",
1111
type: "action",

components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import common from "../common/common-helper.mjs";
33
export default {
44
...common,
55
name: "Classify Items into Categories",
6-
version: "0.1.6",
6+
version: "0.1.7",
77
key: "openai-classify-items-into-categories",
88
description: "Classify items into specific categories using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
99
type: "action",

components/openai/actions/common/common.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ export default {
5959
},
6060
methods: {
6161
_getCommonArgs() {
62-
return {
62+
const args = {
6363
model: this.modelId,
6464
prompt: this.prompt,
65-
max_tokens: this.maxTokens,
6665
temperature: this.temperature
6766
? +this.temperature
6867
: this.temperature,
@@ -80,6 +79,12 @@ export default {
8079
best_of: this.bestOf,
8180
user: this.user,
8281
};
82+
if (this.modelId.startsWith("o1") || this.modelId.startsWith("o3") || this.modelId.startsWith("o4")) {
83+
args.max_completion_tokens = this.maxTokens;
84+
} else {
85+
args.max_tokens = this.maxTokens;
86+
}
87+
return args;
8388
},
8489
async _getUserMessageContent() {
8590
let content = [];

components/openai/actions/create-embeddings/create-embeddings.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import common from "../common/common.mjs";
44

55
export default {
66
name: "Create Embeddings",
7-
version: "0.0.18",
7+
version: "0.0.19",
88
key: "openai-create-embeddings",
99
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)",
1010
type: "action",

components/openai/actions/send-prompt/send-prompt.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import common from "../common/common.mjs";
44
export default {
55
...common,
66
name: "Create Completion (Send Prompt)",
7-
version: "0.1.17",
7+
version: "0.1.18",
88
key: "openai-send-prompt",
99
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)",
1010
type: "action",

components/openai/actions/summarize/summarize.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import constants from "../../common/constants.mjs";
44
export default {
55
...common,
66
name: "Summarize Text",
7-
version: "0.1.6",
7+
version: "0.1.7",
88
key: "openai-summarize",
99
description: "Summarizes text using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
1010
type: "action",

components/openai/actions/translate-text/translate-text.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const langOptions = lang.LANGUAGES.map((l) => ({
99
export default {
1010
...common,
1111
name: "Translate Text (Whisper)",
12-
version: "0.1.6",
12+
version: "0.1.7",
1313
key: "openai-translate-text",
1414
description: "Translate text from one language to another using the Chat API. [See the documentation](https://platform.openai.com/docs/api-reference/chat)",
1515
type: "action",

0 commit comments

Comments
 (0)