Another crack at o3
| @@ -3075,7 +3075,7 @@ export function isStreamingEnabled() { | ||
| 3075 | 3075 | (main_api == 'openai' && |
| 3076 | 3076 | oai_settings.stream_openai && |
| 3077 | 3077 | !noStreamSources.includes(oai_settings.chat_completion_source) && |
| 3078 | 3078 | !(oai_settings.chat_completion_source == chat_completion_sources.OPENAI && (oai_settings.openai_model.startsWith('o1-') || oai_settings.openai_model.startsWith('o3'))) && |
| 3079 | 3079 | !(oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE && oai_settings.google_model.includes('bison'))) |
| 3080 | 3080 | || (main_api == 'kobold' && kai_settings.streaming_kobold && kai_flags.can_use_streaming) |
| 3081 | 3081 | || (main_api == 'novel' && nai_settings.streaming_novel) |
| @@ -1869,7 +1869,7 @@ async function sendOpenAIRequest(type, messages, signal) { | ||
| 1869 | 1869 | const isQuiet = type === 'quiet'; |
| 1870 | 1870 | const isImpersonate = type === 'impersonate'; |
| 1871 | 1871 | const isContinue = type === 'continue'; |
| 1872 | 1872 | const stream = oai_settings.stream_openai && !isQuiet && !isScale && !(isGoogle && oai_settings.google_model.includes('bison')) && !(isOAI && (oai_settings.openai_model.startsWith('o1-') || oai_settings.openai_model.startsWith('o3'))); |
| 1873 | 1873 | const useLogprobs = !!power_user.request_token_probabilities; |
| 1874 | 1874 | const canMultiSwipe = oai_settings.n > 1 && !isContinue && !isImpersonate && !isQuiet && (isOAI || isCustom); |
| 1875 | 1875 | |
| @@ -2050,7 +2050,7 @@ async function sendOpenAIRequest(type, messages, signal) { | ||
| 2050 | 2050 | await ToolManager.registerFunctionToolsOpenAI(generate_data); |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | 2053 | if (isOAI && (oai_settings.openai_model.startsWith('o1-') || oai_settings.openai_model.startsWith('o3'))) { |
| 2054 | 2054 | generate_data.messages.forEach((msg) => { |
| 2055 | 2055 | if (msg.role === 'system') { |
| 2056 | 2056 | msg.role = 'user'; |
| @@ -4027,7 +4027,7 @@ function getMaxContextOpenAI(value) { | ||
| 4027 | 4027 | if (oai_settings.max_context_unlocked) { |
| 4028 | 4028 | return unlocked_max; |
| 4029 | 4029 | } |
| 4030 | 4030 | else if (value.startsWith('o1-') || value.startsWith('o3')) { |
| 4031 | 4031 | return max_128k; |
| 4032 | 4032 | } |
| 4033 | 4033 | else if (value.includes('chatgpt-4o-latest') || value.includes('gpt-4-turbo') || value.includes('gpt-4o') || value.includes('gpt-4-1106') || value.includes('gpt-4-0125') || value.includes('gpt-4-vision')) { |
| @@ -1107,10 +1107,6 @@ router.post('/generate', jsonParser, function (request, response) { | ||
| 1107 | 1107 | ...bodyParams, |
| 1108 | 1108 | }; |
| 1109 | 1109 | |
| 1110 | - if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.OPENAI && String(requestBody.model).startsWith('o3')) { | |
| 1111 | - delete requestBody.max_tokens; | |
| 1112 | - } | |
| 1113 | - | |
| 1114 | 1110 | if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM) { |
| 1115 | 1111 | excludeKeysByYaml(requestBody, request.body.custom_exclude_body); |
| 1116 | 1112 | } |
| @@ -398,7 +398,7 @@ function getWebTokenizersChunks(tokenizer, ids) { | ||
| 398 | 398 | * @returns {string} Tokenizer model to use |
| 399 | 399 | */ |
| 400 | 400 | export function getTokenizerModel(requestModel) { |
| 401 | 401 | if (requestModel.includes('o1-preview') || requestModel.includes('o1-mini') || requestModel.includes('o3-mini')) { |
| 402 | 402 | return 'gpt-4o'; |
| 403 | 403 | } |
| 404 | 404 | |