Skip to content

Commit 2e3f684

Browse files
refactor: rename max_tokens to max_completion_tokens for SDK v5 compatibility
- Updated parameter name in index.js to align with SDK v5 specifications. - Adjusted test case to verify the new parameter name and ensure deprecated parameter is not present.
1 parent 0fc1590 commit 2e3f684

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Commit message: `,
158158
model,
159159
messages,
160160
temperature: 0.7,
161-
max_tokens: 200,
161+
max_completion_tokens: 200,
162162
}
163163

164164
let response

tests/gpt5-models.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ describe('Model Configuration', () => {
9797
)
9898
})
9999

100-
it('should use max_tokens parameter (SDK v5 compatible)', async () => {
100+
it('should use max_completion_tokens parameter (forward-compatible)', async () => {
101101
const indexContent = fs.readFileSync(
102102
path.join(__dirname, '..', 'index.js'),
103103
'utf8',
104104
)
105105

106-
// Check that max_tokens is used (SDK v5 parameter)
107-
expect(indexContent).toContain('max_tokens: 200')
106+
// Check that max_completion_tokens is used (works with all models including o1)
107+
expect(indexContent).toContain('max_completion_tokens: 200')
108108
// Should NOT contain deprecated parameter
109-
expect(indexContent).not.toContain('max_completion_tokens')
109+
expect(indexContent).not.toContain('max_tokens:')
110110
})
111111
})
112112

0 commit comments

Comments
 (0)