remove unnecessary clones from code (#682)

This commit is contained in:
Adil Hafeez 2026-01-08 15:11:05 -08:00 committed by GitHub
parent 40b9780774
commit 11fb4cd633
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 35 additions and 40 deletions

View file

@ -97,13 +97,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let router_service: Arc<RouterService> = Arc::new(RouterService::new(
arch_config.model_providers.clone(),
llm_provider_url.clone() + CHAT_COMPLETIONS_PATH,
routing_model_name.clone(),
routing_llm_provider.clone(),
format!("{llm_provider_url}{CHAT_COMPLETIONS_PATH}"),
routing_model_name,
routing_llm_provider,
));
let orchestrator_service: Arc<OrchestratorService> = Arc::new(OrchestratorService::new(
llm_provider_url.clone() + CHAT_COMPLETIONS_PATH,
format!("{llm_provider_url}{CHAT_COMPLETIONS_PATH}"),
PLANO_ORCHESTRATOR_MODEL_NAME.to_string(),
));

View file

@ -61,7 +61,7 @@ impl RouterService {
let router_model = Arc::new(router_model_v1::RouterModelV1::new(
llm_routes,
routing_model_name.clone(),
routing_model_name,
router_model_v1::MAX_TOKEN_LEN,
));

View file

@ -666,8 +666,7 @@ If no routes are needed, return an empty list for `route`.
>(orchestrations_str)
.unwrap();
let orchestration_model = "test-model".to_string();
let orchestrator =
OrchestratorModelV1::new(agent_orchestrations, orchestration_model.clone(), 235);
let orchestrator = OrchestratorModelV1::new(agent_orchestrations, orchestration_model, 235);
let conversation_str = r#"
[
@ -739,8 +738,7 @@ If no routes are needed, return an empty list for `route`.
.unwrap();
let orchestration_model = "test-model".to_string();
let orchestrator =
OrchestratorModelV1::new(agent_orchestrations, orchestration_model.clone(), 200);
let orchestrator = OrchestratorModelV1::new(agent_orchestrations, orchestration_model, 200);
let conversation_str = r#"
[
@ -819,8 +817,7 @@ If no routes are needed, return an empty list for `route`.
>(orchestrations_str)
.unwrap();
let orchestration_model = "test-model".to_string();
let orchestrator =
OrchestratorModelV1::new(agent_orchestrations, orchestration_model.clone(), 230);
let orchestrator = OrchestratorModelV1::new(agent_orchestrations, orchestration_model, 230);
let conversation_str = r#"
[

View file

@ -322,7 +322,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), usize::MAX);
let router = RouterModelV1::new(llm_routes, routing_model, usize::MAX);
let conversation_str = r#"
[
@ -380,7 +380,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), usize::MAX);
let router = RouterModelV1::new(llm_routes, routing_model, usize::MAX);
let conversation_str = r#"
[
@ -446,7 +446,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), 235);
let router = RouterModelV1::new(llm_routes, routing_model, 235);
let conversation_str = r#"
[
@ -507,7 +507,7 @@ Based on your analysis, provide your response in the following JSON formats if y
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), 200);
let router = RouterModelV1::new(llm_routes, routing_model, 200);
let conversation_str = r#"
[
@ -567,7 +567,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), 230);
let router = RouterModelV1::new(llm_routes, routing_model, 230);
let conversation_str = r#"
[
@ -634,7 +634,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), usize::MAX);
let router = RouterModelV1::new(llm_routes, routing_model, usize::MAX);
let conversation_str = r#"
[
@ -703,7 +703,7 @@ Based on your analysis, provide your response in the following JSON formats if y
let llm_routes =
serde_json::from_str::<HashMap<String, Vec<RoutingPreference>>>(routes_str).unwrap();
let routing_model = "test-model".to_string();
let router = RouterModelV1::new(llm_routes, routing_model.clone(), usize::MAX);
let router = RouterModelV1::new(llm_routes, routing_model, usize::MAX);
let conversation_str = r#"
[