Skip to content

Commit 6336eea

Browse files
fix: Remove constant gpt-2 token_id upper bound check (#3760)
Co-authored-by: Ryan McCormick <[email protected]>
1 parent f7244d1 commit 6336eea

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

lib/llm/src/protocols/openai/validate.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ pub const MAX_TOOLS: usize = 128;
8585
// Metadata validation constants removed - we are no longer restricting the metadata field char limits
8686
/// Maximum allowed length for function names
8787
pub const MAX_FUNCTION_NAME_LENGTH: usize = 64;
88-
/// Maximum allowed value for Prompt IntegerArray elements
89-
pub const MAX_PROMPT_TOKEN_ID: u32 = 50256;
9088
/// Minimum allowed value for `repetition_penalty`
9189
pub const MIN_REPETITION_PENALTY: f32 = 0.0;
9290
/// Maximum allowed value for `repetition_penalty`
@@ -440,16 +438,6 @@ pub fn validate_prompt(prompt: &dynamo_async_openai::types::Prompt) -> Result<()
440438
if arr.is_empty() {
441439
anyhow::bail!("Prompt integer array cannot be empty");
442440
}
443-
for (i, &token_id) in arr.iter().enumerate() {
444-
if token_id > MAX_PROMPT_TOKEN_ID {
445-
anyhow::bail!(
446-
"Token ID at index {} must be between 0 and {}, got {}",
447-
i,
448-
MAX_PROMPT_TOKEN_ID,
449-
token_id
450-
);
451-
}
452-
}
453441
}
454442
dynamo_async_openai::types::Prompt::ArrayOfIntegerArray(arr) => {
455443
if arr.is_empty() {
@@ -459,17 +447,6 @@ pub fn validate_prompt(prompt: &dynamo_async_openai::types::Prompt) -> Result<()
459447
if inner_arr.is_empty() {
460448
anyhow::bail!("Prompt integer array at index {} cannot be empty", i);
461449
}
462-
for (j, &token_id) in inner_arr.iter().enumerate() {
463-
if token_id > MAX_PROMPT_TOKEN_ID {
464-
anyhow::bail!(
465-
"Token ID at index [{}][{}] must be between 0 and {}, got {}",
466-
i,
467-
j,
468-
MAX_PROMPT_TOKEN_ID,
469-
token_id
470-
);
471-
}
472-
}
473450
}
474451
}
475452
}

0 commit comments

Comments
 (0)