trim conversation if it exceed max limit of what router model can handle (#488)

This commit is contained in:
Adil Hafeez 2025-05-27 20:28:22 -07:00 committed by GitHub
parent 79cbcb5fe1
commit d29eba4102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 393 additions and 83 deletions

View file

@ -9,6 +9,8 @@ use hyper::header;
use thiserror::Error;
use tracing::{debug, info, warn};
use crate::router::router_model_v1::{self};
use super::router_model::RouterModel;
pub struct RouterService {
@ -63,9 +65,10 @@ impl RouterService {
llm_providers_with_usage_yaml.replace("\n", "\\n")
);
let router_model = Arc::new(super::router_model_v1::RouterModelV1::new(
let router_model = Arc::new(router_model_v1::RouterModelV1::new(
llm_providers_with_usage_yaml.clone(),
routing_model_name.clone(),
router_model_v1::MAX_TOKEN_LEN,
));
RouterService {