chore(deps): update dependency openai to v6 (#7155)

This commit is contained in:
Elian Doran 2025-10-01 19:31:40 +03:00 committed by GitHub
commit 3a84a78cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 14 deletions

View File

@ -110,7 +110,7 @@
"multer": "2.0.2",
"normalize-strings": "1.1.1",
"ollama": "0.6.0",
"openai": "5.12.0",
"openai": "6.0.0",
"rand-token": "1.0.1",
"safe-compare": "1.1.4",
"sanitize-filename": "1.6.3",

View File

@ -5,6 +5,7 @@ import { getOpenAIOptions } from './providers.js';
import OpenAI from 'openai';
import { PROVIDER_PROMPTS } from '../constants/llm_prompt_constants.js';
import log from '../../log.js';
import { ChatCompletionMessageFunctionToolCall } from 'openai/resources/index.mjs';
export class OpenAIService extends BaseAIService {
private openai: OpenAI | null = null;
@ -101,7 +102,7 @@ export class OpenAIService extends BaseAIService {
log.info('OpenAI API Stream Started');
// Create a closure to hold accumulated tool calls
const accumulatedToolCalls: OpenAI.Chat.ChatCompletionMessageToolCall[] = [];
const accumulatedToolCalls: OpenAI.Chat.ChatCompletionMessageFunctionToolCall[] = [];
// Return a response with the stream handler
const response: ChatResponse = {
@ -201,7 +202,7 @@ export class OpenAIService extends BaseAIService {
completeText = content;
// Check if there are tool calls in the non-stream response
const toolCalls = stream.choices[0]?.message?.tool_calls;
const toolCalls = stream.choices[0]?.message?.tool_calls as ChatCompletionMessageFunctionToolCall[];
if (toolCalls) {
response.tool_calls = toolCalls;
console.log('OpenAI API Tool Calls in Non-iterable Response:', JSON.stringify(toolCalls, null, 2));
@ -251,7 +252,7 @@ export class OpenAIService extends BaseAIService {
completionTokens: completion.usage?.completion_tokens,
totalTokens: completion.usage?.total_tokens
},
tool_calls: completion.choices[0].message.tool_calls
tool_calls: completion.choices[0].message.tool_calls as ChatCompletionMessageFunctionToolCall[]
};
}
} catch (error) {

16
pnpm-lock.yaml generated
View File

@ -694,8 +694,8 @@ importers:
specifier: 0.6.0
version: 0.6.0
openai:
specifier: 5.12.0
version: 5.12.0(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@6.0.5))
specifier: 6.0.0
version: 6.0.0(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@6.0.5))
rand-token:
specifier: 1.0.1
version: 1.0.1
@ -10289,12 +10289,12 @@ packages:
resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}
engines: {node: '>=18'}
openai@5.12.0:
resolution: {integrity: sha512-vUdt02xiWgOHiYUmW0Hj1Qu9OKAiVQu5Bd547ktVCiMKC1BkB5L3ImeEnCyq3WpRKR6ZTaPgekzqdozwdPs7Lg==}
openai@6.0.0:
resolution: {integrity: sha512-J7LEmTn3WLZnbyEmMYcMPyT5A0fGzhPwSvVUcNRKy6j2hJIbqSFrJERnUHYNkcoCCalRumypnj9AVoe5bVHd3Q==}
hasBin: true
peerDependencies:
ws: ^8.18.0
zod: ^3.23.8
zod: ^3.25 || ^4.0
peerDependenciesMeta:
ws:
optional: true
@ -14944,8 +14944,6 @@ snapshots:
'@ckeditor/ckeditor5-utils': 46.1.1
'@ckeditor/ckeditor5-watchdog': 46.1.1
es-toolkit: 1.39.5
transitivePeerDependencies:
- supports-color
'@ckeditor/ckeditor5-dev-build-tools@43.1.0(@swc/helpers@0.5.17)(tslib@2.8.1)(typescript@5.9.3)':
dependencies:
@ -21241,6 +21239,8 @@ snapshots:
ckeditor5-collaboration@46.1.1:
dependencies:
'@ckeditor/ckeditor5-collaboration-core': 46.1.1
transitivePeerDependencies:
- supports-color
ckeditor5-premium-features@46.1.1(bufferutil@4.0.9)(ckeditor5@46.1.1(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41))(utf-8-validate@6.0.5):
dependencies:
@ -26474,7 +26474,7 @@ snapshots:
is-inside-container: 1.0.0
wsl-utils: 0.1.0
openai@5.12.0(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@6.0.5)):
openai@6.0.0(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@6.0.5)):
optionalDependencies:
ws: 8.18.3(bufferutil@4.0.9)(utf-8-validate@6.0.5)