@smythos/sre 1.5.45 → 1.5.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/constants.d.ts +2 -2
- package/package.json +1 -1
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts +9 -13
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts +2 -25
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/constants.ts +2 -2
package/dist/types/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const O3_AND_O4_MODELS: string[];
|
|
2
|
+
export declare const O3_AND_O4_MODELS_PATTERN: RegExp;
|
|
3
3
|
export declare const MODELS_WITHOUT_JSON_RESPONSE_SUPPORT: string[];
|
|
4
4
|
export declare const MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT: string[];
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -5,13 +5,8 @@ import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.cla
|
|
|
5
5
|
import { TLLMParams, TLLMPreparedParams, ILLMRequestContext, ToolData, TLLMMessageRole, APIKeySource, TLLMEvent } from '@sre/types/LLM.types';
|
|
6
6
|
import { OpenAIApiInterface, ToolConfig } from './OpenAIApiInterface';
|
|
7
7
|
import { HandlerDependencies } from '../types';
|
|
8
|
-
import { JSON_RESPONSE_INSTRUCTION, SUPPORTED_MIME_TYPES_MAP } from '@sre/constants';
|
|
9
|
-
import {
|
|
10
|
-
MODELS_WITHOUT_PRESENCE_PENALTY_SUPPORT,
|
|
11
|
-
MODELS_WITHOUT_TEMPERATURE_SUPPORT,
|
|
12
|
-
MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT,
|
|
13
|
-
MODELS_WITHOUT_JSON_RESPONSE_SUPPORT,
|
|
14
|
-
} from './constants';
|
|
8
|
+
import { JSON_RESPONSE_INSTRUCTION, SUPPORTED_MIME_TYPES_MAP, BUILT_IN_MODEL_PREFIX } from '@sre/constants';
|
|
9
|
+
import { MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT, MODELS_WITHOUT_JSON_RESPONSE_SUPPORT, O3_AND_O4_MODELS } from './constants';
|
|
15
10
|
|
|
16
11
|
import { isValidOpenAIReasoningEffort } from './utils';
|
|
17
12
|
|
|
@@ -134,32 +129,33 @@ export class ChatCompletionsApiInterface extends OpenAIApiInterface {
|
|
|
134
129
|
}
|
|
135
130
|
|
|
136
131
|
// Handle temperature
|
|
137
|
-
|
|
132
|
+
const modelName = params.modelEntryName?.replace(BUILT_IN_MODEL_PREFIX, '');
|
|
133
|
+
if (params?.temperature !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
|
|
138
134
|
body.temperature = params.temperature;
|
|
139
135
|
}
|
|
140
136
|
|
|
141
137
|
// Handle topP
|
|
142
|
-
if (params?.topP !== undefined) {
|
|
138
|
+
if (params?.topP !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
|
|
143
139
|
body.top_p = params.topP;
|
|
144
140
|
}
|
|
145
141
|
|
|
146
142
|
// Handle frequency penalty
|
|
147
|
-
if (params?.frequencyPenalty !== undefined) {
|
|
143
|
+
if (params?.frequencyPenalty !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
|
|
148
144
|
body.frequency_penalty = params.frequencyPenalty;
|
|
149
145
|
}
|
|
150
146
|
|
|
151
147
|
// Handle presence penalty
|
|
152
|
-
if (params?.presencePenalty !== undefined && !
|
|
148
|
+
if (params?.presencePenalty !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
|
|
153
149
|
body.presence_penalty = params.presencePenalty;
|
|
154
150
|
}
|
|
155
151
|
|
|
156
152
|
// Handle response format
|
|
157
|
-
if (params?.responseFormat?.type && !MODELS_WITHOUT_JSON_RESPONSE_SUPPORT.includes(
|
|
153
|
+
if (params?.responseFormat?.type && !MODELS_WITHOUT_JSON_RESPONSE_SUPPORT.includes(modelName)) {
|
|
158
154
|
body.response_format = params.responseFormat;
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
// Handle stop sequences
|
|
162
|
-
if (params?.stopSequences?.length) {
|
|
158
|
+
if (params?.stopSequences?.length && !O3_AND_O4_MODELS.includes(modelName)) {
|
|
163
159
|
body.stop = params.stopSequences;
|
|
164
160
|
}
|
|
165
161
|
|
|
@@ -4,24 +4,11 @@ import type { Stream } from 'openai/streaming';
|
|
|
4
4
|
|
|
5
5
|
import { BinaryInput } from '@sre/helpers/BinaryInput.helper';
|
|
6
6
|
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
7
|
-
import {
|
|
8
|
-
TLLMParams,
|
|
9
|
-
TLLMPreparedParams,
|
|
10
|
-
ILLMRequestContext,
|
|
11
|
-
TLLMMessageBlock,
|
|
12
|
-
ToolData,
|
|
13
|
-
TLLMToolResultMessageBlock,
|
|
14
|
-
TLLMMessageRole,
|
|
15
|
-
APIKeySource,
|
|
16
|
-
TLLMEvent,
|
|
17
|
-
OpenAIToolDefinition,
|
|
18
|
-
LegacyToolDefinition,
|
|
19
|
-
LLMModelInfo,
|
|
20
|
-
} from '@sre/types/LLM.types';
|
|
7
|
+
import { TLLMParams, TLLMPreparedParams, ILLMRequestContext, ToolData, APIKeySource, TLLMEvent, LLMModelInfo } from '@sre/types/LLM.types';
|
|
21
8
|
import { OpenAIApiInterface, ToolConfig } from './OpenAIApiInterface';
|
|
22
9
|
import { HandlerDependencies, TToolType } from '../types';
|
|
23
10
|
import { SUPPORTED_MIME_TYPES_MAP } from '@sre/constants';
|
|
24
|
-
import {
|
|
11
|
+
import { SEARCH_TOOL_COSTS } from './constants';
|
|
25
12
|
import { isValidOpenAIReasoningEffort } from './utils';
|
|
26
13
|
|
|
27
14
|
// File size limits in bytes
|
|
@@ -564,16 +551,6 @@ export class ResponsesApiInterface extends OpenAIApiInterface {
|
|
|
564
551
|
if (params?.maxTokens !== undefined) {
|
|
565
552
|
body.max_output_tokens = params.maxTokens;
|
|
566
553
|
}
|
|
567
|
-
|
|
568
|
-
// o3-pro does not support temperature
|
|
569
|
-
if (params?.temperature !== undefined && !MODELS_WITHOUT_TEMPERATURE_SUPPORT.includes(params.modelEntryName)) {
|
|
570
|
-
body.temperature = params.temperature;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
if (params?.topP !== undefined) {
|
|
574
|
-
body.top_p = params.topP;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
554
|
// #region GPT 5 specific fields
|
|
578
555
|
|
|
579
556
|
const isGPT5ReasoningModels = params.modelEntryName?.includes('gpt-5') && params?.capabilities?.reasoning;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
1
|
+
export const O3_AND_O4_MODELS = ['o3', 'o3-pro', 'o4-mini'];
|
|
2
|
+
export const O3_AND_O4_MODELS_PATTERN = /o3|o4/i;
|
|
3
3
|
export const MODELS_WITHOUT_JSON_RESPONSE_SUPPORT = ['o1-preview'];
|
|
4
4
|
export const MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT = ['o1-mini', 'o1-preview'];
|
|
5
5
|
|