@@ -9,7 +9,7 @@ use crossterm::{
9
9
} ;
10
10
use dialoguer:: Select ;
11
11
12
- use crate :: auth :: AuthError ;
12
+ use crate :: api_client :: Endpoint ;
13
13
use crate :: auth:: builder_id:: {
14
14
BuilderIdToken ,
15
15
TokenType ,
@@ -43,11 +43,11 @@ const MODEL_OPTIONS: [ModelOption; 2] = [
43
43
} ,
44
44
] ;
45
45
46
- const OPENAI_MODEL_OPTIONS : [ ModelOption ; 1 ] = [ ModelOption {
47
- name : "gpt-oss-120b-experimental " ,
46
+ const GPT_OSS_120B : ModelOption = ModelOption {
47
+ name : "openai- gpt-oss-120b-preview " ,
48
48
model_id : "OPENAI_GPT_OSS_120B_1_0" ,
49
49
context_window_tokens : 128_000 ,
50
- } ] ;
50
+ } ;
51
51
52
52
#[ deny( missing_docs) ]
53
53
#[ derive( Debug , PartialEq , Args ) ]
@@ -144,18 +144,15 @@ pub async fn default_model_id(os: &Os) -> &'static str {
144
144
145
145
/// Returns the available models for use.
146
146
pub async fn get_model_options ( os : & Os ) -> Result < Vec < ModelOption > , ChatError > {
147
- let is_amzn_user = BuilderIdToken :: load ( & os. database )
148
- . await ?
149
- . ok_or ( AuthError :: NoToken ) ?
150
- . is_amzn_user ( ) ;
151
-
152
147
let mut model_options = MODEL_OPTIONS . into_iter ( ) . collect :: < Vec < _ > > ( ) ;
153
- if is_amzn_user {
154
- for opt in OPENAI_MODEL_OPTIONS {
155
- model_options. push ( opt) ;
156
- }
148
+
149
+ // GPT OSS is only accessible in IAD.
150
+ let endpoint = Endpoint :: configured_value ( & os. database ) ;
151
+ if endpoint. region ( ) . as_ref ( ) != "us-east-1" {
152
+ return Ok ( model_options) ;
157
153
}
158
154
155
+ model_options. push ( GPT_OSS_120B ) ;
159
156
Ok ( model_options)
160
157
}
161
158
@@ -169,7 +166,7 @@ pub fn context_window_tokens(model_id: Option<&str>) -> usize {
169
166
170
167
MODEL_OPTIONS
171
168
. iter ( )
172
- . chain ( OPENAI_MODEL_OPTIONS . iter ( ) )
169
+ . chain ( std :: iter:: once ( & GPT_OSS_120B ) )
173
170
. find ( |m| m. model_id == model_id)
174
171
. map_or ( DEFAULT_CONTEXT_WINDOW_LENGTH , |m| m. context_window_tokens )
175
172
}
0 commit comments