Skip to content

Commit

Permalink
Includes unique model_id condition and error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Flavia Beo <[email protected]>
  • Loading branch information
flaviabeo committed Aug 14, 2024
1 parent c525364 commit 82bfc44
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions fmaas-router/src/rpc/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,20 @@ impl InfoService for InfoServicer {
request: Request<ModelInfoRequest>,
) -> Result<Response<ModelInfoResponse>, Status> {
let model_id = extract_model_id(&request)?;
let mir: &ModelInfoRequest = request.get_ref();
let mut mir: ModelInfoRequest = request.get_ref().to_owned();
if mir.model_ids.is_empty() {
return Ok(Response::new(ModelInfoResponse::default()));
mir.model_ids.push(model_id.to_string());
}
if mir.model_ids.len() > 1 || model_id != mir.model_ids[0] {
// This model info endpoint is being added so that
// users of the embedding service can obtain more information
// about that particular service.
// Calls to model info should follow the same pattern of other calls
// like TokenizationTaskRequest where the destination model
// is uniquely specified by the mm-model-id metadata field.
return Err(Status::unimplemented(
"Architectural assumption violated: model_ids must be empty or have the same id as mm-model-id metadata as only element"
))
}
debug!(
"Routing get models info request for Model ID {}",
Expand All @@ -73,4 +84,4 @@ impl InfoService for InfoServicer {
) -> Result<Response<RuntimeInfoResponse>, Status> {
Err(Status::unimplemented("not implemented"))
}
}
}

0 comments on commit 82bfc44

Please sign in to comment.