Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smythos/sre",
"version": "1.5.45",
"version": "1.5.46",
"description": "Smyth Runtime Environment",
"author": "Alaa-eddine KADDOURI",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.cla
import { TLLMParams, TLLMPreparedParams, ILLMRequestContext, ToolData, TLLMMessageRole, APIKeySource, TLLMEvent } from '@sre/types/LLM.types';
import { OpenAIApiInterface, ToolConfig } from './OpenAIApiInterface';
import { HandlerDependencies } from '../types';
import { JSON_RESPONSE_INSTRUCTION, SUPPORTED_MIME_TYPES_MAP } from '@sre/constants';
import {
MODELS_WITHOUT_PRESENCE_PENALTY_SUPPORT,
MODELS_WITHOUT_TEMPERATURE_SUPPORT,
MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT,
MODELS_WITHOUT_JSON_RESPONSE_SUPPORT,
} from './constants';
import { JSON_RESPONSE_INSTRUCTION, SUPPORTED_MIME_TYPES_MAP, BUILT_IN_MODEL_PREFIX } from '@sre/constants';
import { MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT, MODELS_WITHOUT_JSON_RESPONSE_SUPPORT, O3_AND_O4_MODELS } from './constants';

import { isValidOpenAIReasoningEffort } from './utils';

Expand Down Expand Up @@ -134,32 +129,33 @@ export class ChatCompletionsApiInterface extends OpenAIApiInterface {
}

// Handle temperature
if (params?.temperature !== undefined && !MODELS_WITHOUT_TEMPERATURE_SUPPORT.includes(params.modelEntryName)) {
const modelName = params.modelEntryName?.replace(BUILT_IN_MODEL_PREFIX, '');
if (params?.temperature !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
body.temperature = params.temperature;
}

// Handle topP
if (params?.topP !== undefined) {
if (params?.topP !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
body.top_p = params.topP;
}

// Handle frequency penalty
if (params?.frequencyPenalty !== undefined) {
if (params?.frequencyPenalty !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
body.frequency_penalty = params.frequencyPenalty;
}

// Handle presence penalty
if (params?.presencePenalty !== undefined && !MODELS_WITHOUT_PRESENCE_PENALTY_SUPPORT.includes(params.modelEntryName)) {
if (params?.presencePenalty !== undefined && !O3_AND_O4_MODELS.includes(modelName)) {
body.presence_penalty = params.presencePenalty;
}

// Handle response format
if (params?.responseFormat?.type && !MODELS_WITHOUT_JSON_RESPONSE_SUPPORT.includes(params.modelEntryName)) {
if (params?.responseFormat?.type && !MODELS_WITHOUT_JSON_RESPONSE_SUPPORT.includes(modelName)) {
body.response_format = params.responseFormat;
}

// Handle stop sequences
if (params?.stopSequences?.length) {
if (params?.stopSequences?.length && !O3_AND_O4_MODELS.includes(modelName)) {
body.stop = params.stopSequences;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@ import type { Stream } from 'openai/streaming';

import { BinaryInput } from '@sre/helpers/BinaryInput.helper';
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
import {
TLLMParams,
TLLMPreparedParams,
ILLMRequestContext,
TLLMMessageBlock,
ToolData,
TLLMToolResultMessageBlock,
TLLMMessageRole,
APIKeySource,
TLLMEvent,
OpenAIToolDefinition,
LegacyToolDefinition,
LLMModelInfo,
} from '@sre/types/LLM.types';
import { TLLMParams, TLLMPreparedParams, ILLMRequestContext, ToolData, APIKeySource, TLLMEvent, LLMModelInfo } from '@sre/types/LLM.types';
import { OpenAIApiInterface, ToolConfig } from './OpenAIApiInterface';
import { HandlerDependencies, TToolType } from '../types';
import { SUPPORTED_MIME_TYPES_MAP } from '@sre/constants';
import { MODELS_WITHOUT_TEMPERATURE_SUPPORT, SEARCH_TOOL_COSTS } from './constants';
import { SEARCH_TOOL_COSTS } from './constants';
import { isValidOpenAIReasoningEffort } from './utils';

// File size limits in bytes
Expand Down Expand Up @@ -564,16 +551,6 @@ export class ResponsesApiInterface extends OpenAIApiInterface {
if (params?.maxTokens !== undefined) {
body.max_output_tokens = params.maxTokens;
}

// o3-pro does not support temperature
if (params?.temperature !== undefined && !MODELS_WITHOUT_TEMPERATURE_SUPPORT.includes(params.modelEntryName)) {
body.temperature = params.temperature;
}

if (params?.topP !== undefined) {
body.top_p = params.topP;
}

// #region GPT 5 specific fields

const isGPT5ReasoningModels = params.modelEntryName?.includes('gpt-5') && params?.capabilities?.reasoning;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const MODELS_WITHOUT_TEMPERATURE_SUPPORT = ['o3-pro', 'o4-mini'];
export const MODELS_WITHOUT_PRESENCE_PENALTY_SUPPORT = ['o4-mini'];
export const O3_AND_O4_MODELS = ['o3', 'o3-pro', 'o4-mini'];
export const O3_AND_O4_MODELS_PATTERN = /o3|o4/i;
export const MODELS_WITHOUT_JSON_RESPONSE_SUPPORT = ['o1-preview'];
export const MODELS_WITHOUT_SYSTEM_MESSAGE_SUPPORT = ['o1-mini', 'o1-preview'];

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smythos/sdk",
"version": "1.0.43",
"version": "1.0.44",
"description": "SRE SDK",
"keywords": [
"smythos",
Expand Down