Bound foundation compile latency
This commit is contained in:
parent
661cfbad9f
commit
0a830347dc
1 changed files with 19 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ const REQUEST_EXPIRY: Duration = Duration::from_secs(150);
|
|||
const FAST_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(120);
|
||||
const BALANCED_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(180);
|
||||
const CAPABLE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(300);
|
||||
const WORLD_COMPILE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(600);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CodexConnectorModelPort {
|
||||
|
|
@ -214,9 +215,10 @@ impl ModelPort for CodexConnectorModelPort {
|
|||
}
|
||||
|
||||
fn attempt_timeout(&self, request: &ModelStageRequest) -> Duration {
|
||||
match request.model.as_str() {
|
||||
MODEL_BALANCED => BALANCED_ATTEMPT_TIMEOUT,
|
||||
MODEL_CAPABLE => CAPABLE_ATTEMPT_TIMEOUT,
|
||||
match (request.stage.as_str(), request.model.as_str()) {
|
||||
("world_compile", MODEL_CAPABLE) => WORLD_COMPILE_ATTEMPT_TIMEOUT,
|
||||
(_, MODEL_BALANCED) => BALANCED_ATTEMPT_TIMEOUT,
|
||||
(_, MODEL_CAPABLE) => CAPABLE_ATTEMPT_TIMEOUT,
|
||||
_ => FAST_ATTEMPT_TIMEOUT,
|
||||
}
|
||||
}
|
||||
|
|
@ -983,7 +985,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn attempt_deadline_tracks_the_logical_model_class_not_the_stage_name() -> Result<()> {
|
||||
fn foundation_compile_gets_a_bounded_stage_specific_deadline() -> Result<()> {
|
||||
let port = CodexConnectorModelPort::new(
|
||||
"127.0.0.1:4103".parse()?,
|
||||
"bounded-test-key".to_string(),
|
||||
|
|
@ -1003,6 +1005,19 @@ mod tests {
|
|||
temperature: None,
|
||||
max_output_tokens: None,
|
||||
};
|
||||
assert_eq!(
|
||||
port.attempt_timeout(&request),
|
||||
WORLD_COMPILE_ATTEMPT_TIMEOUT
|
||||
);
|
||||
|
||||
request.model = MODEL_BALANCED.to_string();
|
||||
assert_eq!(port.attempt_timeout(&request), BALANCED_ATTEMPT_TIMEOUT);
|
||||
|
||||
request.model = MODEL_FAST.to_string();
|
||||
assert_eq!(port.attempt_timeout(&request), FAST_ATTEMPT_TIMEOUT);
|
||||
|
||||
request.stage = "agency_compile".to_string();
|
||||
request.model = MODEL_CAPABLE.to_string();
|
||||
assert_eq!(port.attempt_timeout(&request), CAPABLE_ATTEMPT_TIMEOUT);
|
||||
|
||||
request.stage = "destination_civic_reconciliation".to_string();
|
||||
|
|
|
|||
Loading…
Reference in a new issue