Skip to content

Commit 83d7b8d

Browse files
committed
sync-enable-endpoint
1 parent fb15e20 commit 83d7b8d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/bindings/python/rust/http.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use pyo3::{exceptions::PyException, prelude::*};
1919

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

22+
pub use dynamo_llm::endpoint_type::EndpointType;
2223
pub use dynamo_llm::http::service::{error as http_error, service_v2};
23-
2424
pub use dynamo_runtime::{
2525
error,
2626
pipeline::{async_trait, AsyncEngine, Data, ManyOut, SingleIn},
@@ -92,6 +92,19 @@ impl HttpService {
9292
Ok(())
9393
})
9494
}
95+
96+
fn enable_endpoint(&self, endpoint_type: String, enabled: bool) -> PyResult<()> {
97+
let endpoint_type: EndpointType = match endpoint_type.as_str() {
98+
"chat" => EndpointType::Chat,
99+
"completion" => EndpointType::Completion,
100+
"embedding" => EndpointType::Embedding,
101+
_ => return Err(to_pyerr("Invalid endpoint type")),
102+
};
103+
104+
self.inner
105+
.sync_enable_model_endpoint(endpoint_type, enabled);
106+
return Ok(());
107+
}
95108
}
96109

97110
/// Python Exception for HTTP errors

lib/llm/src/http/service/service_v2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ impl HttpService {
263263
}
264264

265265
pub async fn enable_model_endpoint(&self, endpoint_type: EndpointType, enable: bool) {
266+
self.sync_enable_model_endpoint(endpoint_type, enable);
267+
}
268+
269+
pub fn sync_enable_model_endpoint(&self, endpoint_type: EndpointType, enable: bool) {
266270
self.state.flags.set(&endpoint_type, enable);
267271
tracing::info!(
268272
"{} endpoints {}",

0 commit comments

Comments
 (0)