Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
sync-enable-endpoint
  • Loading branch information
michaelfeil committed Aug 21, 2025
commit 83d7b8dc891ec182dcbbf1a9585c98f3b7267736
15 changes: 14 additions & 1 deletion lib/bindings/python/rust/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use pyo3::{exceptions::PyException, prelude::*};

use crate::{engine::*, to_pyerr, CancellationToken};

pub use dynamo_llm::endpoint_type::EndpointType;
pub use dynamo_llm::http::service::{error as http_error, service_v2};

pub use dynamo_runtime::{
error,
pipeline::{async_trait, AsyncEngine, Data, ManyOut, SingleIn},
Expand Down Expand Up @@ -92,6 +92,19 @@ impl HttpService {
Ok(())
})
}

fn enable_endpoint(&self, endpoint_type: String, enabled: bool) -> PyResult<()> {
let endpoint_type: EndpointType = match endpoint_type.as_str() {
"chat" => EndpointType::Chat,
"completion" => EndpointType::Completion,
"embedding" => EndpointType::Embedding,
_ => return Err(to_pyerr("Invalid endpoint type")),
};

self.inner
.sync_enable_model_endpoint(endpoint_type, enabled);
return Ok(());
}
}

/// Python Exception for HTTP errors
Expand Down
4 changes: 4 additions & 0 deletions lib/llm/src/http/service/service_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ impl HttpService {
}

pub async fn enable_model_endpoint(&self, endpoint_type: EndpointType, enable: bool) {
self.sync_enable_model_endpoint(endpoint_type, enable);
}

pub fn sync_enable_model_endpoint(&self, endpoint_type: EndpointType, enable: bool) {
Copy link
Contributor

@grahamking grahamking Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you drop the async from enable_model_endpoint instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would span across the codebase. Realized this is in the wrong pr.

self.state.flags.set(&endpoint_type, enable);
tracing::info!(
"{} endpoints {}",
Expand Down
Loading