add more changes

This commit is contained in:
Adil Hafeez 2025-03-18 15:58:27 -07:00
parent 6d357364a3
commit b73ff5bc5b
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
7 changed files with 54 additions and 39 deletions

View file

@ -177,7 +177,6 @@ impl Display for LlmProvider {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Endpoint {
pub endpoint: Option<String>,
pub agent_orchestrator: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]

View file

@ -37,20 +37,19 @@ impl HttpContext for StreamContext {
if overrides.use_agent_orchestrator.unwrap_or_default() {
// get endpoint that has agent_orchestrator set to true
if let Some(endpoints) = self.endpoints.as_ref() {
let agent_orchestrator = endpoints
.iter()
.find(|(_, endpoint)| endpoint.agent_orchestrator.unwrap_or_default())
.map(|(name, _)| name.clone());
if let Some(agent_orchestrator_name) = agent_orchestrator {
debug!(
"Setting ARCH_PROVIDER_HINT_HEADER to {}",
agent_orchestrator_name
if endpoints.len() == 1 {
let (name, _) = endpoints.iter().next().unwrap();
debug!("Setting ARCH_PROVIDER_HINT_HEADER to {}", name);
self.set_http_request_header(ARCH_ROUTING_HEADER, Some(&name));
} else {
warn!("Need single endpoint when use_agent_orchestrator is set");
self.send_server_error(
ServerError::LogicError(
"Need single endpoint when use_agent_orchestrator is set".to_string(),
),
None,
);
self.set_http_request_header(
ARCH_ROUTING_HEADER,
Some(&agent_orchestrator_name),
);
};
}
}
}
}