Skip to content

Commit 7ad0ed7

Browse files
committed
use max_completion_tokens for o1, o2, & o3 models
1 parent db67e3d commit 7ad0ed7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

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/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/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/openai",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Pipedream OpenAI Components",
55
"main": "openai.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)