@@ -2,22 +2,22 @@ import { useEffect } from "react";
2
2
import KernDropdown from "@/submodules/react-components/components/KernDropdown" ;
3
3
import { InputWithSlider } from "@/submodules/react-components/components/InputWithSlider" ;
4
4
import { LLmPropsOpenAI } from "../types" ;
5
+ import OpenAIoSeriesSwitch from "./OpenAIoSeriesSwitch" ;
5
6
6
7
7
8
8
9
// https://platform.openai.com/docs/models
9
- const MODEL_OPTIONS = [ 'gpt-4o-mini' , 'gpt-4o' , 'gpt-4' , 'gpt-4-turbo-preview' , 'gpt-4-1106-preview' , 'gpt-4-0125-preview' , 'gpt-4-turbo' , 'gpt-3.5-turbo' ]
10
- const VISION_MODEL_OPTIONS = [ 'gpt-4o' , 'gpt-4-turbo' , 'gpt-4o-mini' ]
11
10
const MAX_LENGTH = {
11
+ 'gpt-4o-mini' : 16384 ,
12
12
'gpt-3.5-turbo' : 16385 ,
13
13
'gpt-4' : 8192 ,
14
- 'gpt-4-turbo' : 128000 ,
15
- 'gpt-4-turbo-preview' : 128000 ,
16
- 'gpt-4-1106-preview' : 128000 ,
17
- 'gpt-4-0125-preview' : 128000 ,
18
- 'gpt-4o' : 128000 ,
19
- 'gpt-4o-mini' : 128000 ,
14
+ 'gpt-4-turbo' : 4096 ,
15
+ 'gpt-4o' : 16384 ,
16
+ 'o1' : 100000 ,
17
+ 'o1-mini' : 65536 ,
18
+ 'o3-mini' : 100000 ,
20
19
}
20
+ const MODEL_OPTIONS = Object . keys ( MAX_LENGTH ) ;
21
21
22
22
export default function OpenAI ( props : LLmPropsOpenAI ) {
23
23
@@ -29,27 +29,24 @@ export default function OpenAI(props: LLmPropsOpenAI) {
29
29
} , [ props . llmConfig . model ] )
30
30
31
31
useEffect ( ( ) => {
32
- if ( props . isVision ) {
33
- if ( props . llmConfig . model && ! VISION_MODEL_OPTIONS . includes ( props . llmConfig . model ) ) {
34
- props . setLlmConfig ( { ...props . llmConfig , model : VISION_MODEL_OPTIONS [ 0 ] } )
35
- }
36
- } else {
37
- if ( props . llmConfig . model && ! MODEL_OPTIONS . includes ( props . llmConfig . model ) ) {
38
- props . setLlmConfig ( { ...props . llmConfig , model : MODEL_OPTIONS [ 0 ] } )
39
- }
32
+ if ( props . llmConfig . model && ! MODEL_OPTIONS . includes ( props . llmConfig . model ) ) {
33
+ props . setLlmConfig ( { ...props . llmConfig , model : MODEL_OPTIONS [ 0 ] } )
40
34
}
41
35
} , [ ] )
42
-
43
36
return (
44
37
< div className = 'flex flex-col gap-y-6' >
45
38
< div >
46
39
< label className = "block mb-2 text-sm font-medium text-gray-900" > Model</ label >
47
40
< KernDropdown
48
41
buttonName = { props . llmConfig . model ? props . llmConfig . model : 'Select model' }
49
- options = { props . isVision ? VISION_MODEL_OPTIONS : MODEL_OPTIONS }
42
+ options = { MODEL_OPTIONS }
50
43
selectedOption = { ( option ) => props . setLlmConfig ( { ...props . llmConfig , model : option } ) }
51
44
disabled = { props . disabled }
52
45
/>
46
+ < OpenAIoSeriesSwitch
47
+ llmConfig = { props . llmConfig }
48
+ setLlmConfig = { props . setLlmConfig }
49
+ />
53
50
</ div >
54
51
{ props . onlyEssential ? null : < >
55
52
0 commit comments