diff --git a/router/src/server.rs b/router/src/server.rs index 08dd4d0d8..bbd51b935 100644 --- a/router/src/server.rs +++ b/router/src/server.rs @@ -554,6 +554,28 @@ async fn generate_stream_with_callback( }); } + let (adapter_source, adapter_parameters) = extract_adapter_params( + req.0.parameters.adapter_id.clone(), + req.0.parameters.adapter_source.clone(), + req.0.parameters.adapter_parameters.clone(), + ); + + let adapter_id_string = adapter_parameters + .adapter_ids + .iter() + .map(|id| id.as_str()) + // filter out base model adapter id + .filter(|id| *id != BASE_MODEL_ADAPTER_ID) + .collect::>() + .join(","); + + if adapter_id_string.len() > 0 { + headers.insert("x-adapter-ids", adapter_id_string.parse().unwrap()); + headers.insert("x-adapter-source", adapter_source.unwrap().parse().unwrap()); + } + + headers.insert("x-model-id", MODEL_ID.get().unwrap().parse().unwrap()); + let stream = async_stream::stream! { // Inference let mut end_reached = false;