Skip to content

Commit c37751f

Browse files
fix: add gpt-oss for all users (#2500)
1 parent 9470d66 commit c37751f

File tree

1 file changed

+11
-14
lines changed
  • crates/chat-cli/src/cli/chat/cli

1 file changed

+11
-14
lines changed

crates/chat-cli/src/cli/chat/cli/model.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crossterm::{
99
};
1010
use dialoguer::Select;
1111

12-
use crate::auth::AuthError;
12+
use crate::api_client::Endpoint;
1313
use crate::auth::builder_id::{
1414
BuilderIdToken,
1515
TokenType,
@@ -43,11 +43,11 @@ const MODEL_OPTIONS: [ModelOption; 2] = [
4343
},
4444
];
4545

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",
4848
model_id: "OPENAI_GPT_OSS_120B_1_0",
4949
context_window_tokens: 128_000,
50-
}];
50+
};
5151

5252
#[deny(missing_docs)]
5353
#[derive(Debug, PartialEq, Args)]
@@ -144,18 +144,15 @@ pub async fn default_model_id(os: &Os) -> &'static str {
144144

145145
/// Returns the available models for use.
146146
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-
152147
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);
157153
}
158154

155+
model_options.push(GPT_OSS_120B);
159156
Ok(model_options)
160157
}
161158

@@ -169,7 +166,7 @@ pub fn context_window_tokens(model_id: Option<&str>) -> usize {
169166

170167
MODEL_OPTIONS
171168
.iter()
172-
.chain(OPENAI_MODEL_OPTIONS.iter())
169+
.chain(std::iter::once(&GPT_OSS_120B))
173170
.find(|m| m.model_id == model_id)
174171
.map_or(DEFAULT_CONTEXT_WINDOW_LENGTH, |m| m.context_window_tokens)
175172
}

0 commit comments

Comments
 (0)