Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
24 changes: 23 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,28 @@ impl HttpService {
Ok(())
})
}

fn enable_endpoint(&self, endpoint_type: String, enabled: bool) -> PyResult<()> {
let endpoint_type = EndpointType::all()
.iter()
.find(|&&ep_type| ep_type.as_str().to_lowercase() == endpoint_type.to_lowercase())
.copied()
.ok_or_else(|| {
let valid_types = EndpointType::all()
.iter()
.map(|&ep_type| ep_type.as_str().to_string())
.collect::<Vec<_>>()
.join(", ");
to_pyerr(format!(
"Invalid endpoint type: '{}'. Valid types are: {}",
endpoint_type, valid_types
))
})?;

self.inner
.sync_enable_model_endpoint(endpoint_type, enabled);
Ok(())
}
Comment thread
grahamking marked this conversation as resolved.
}

/// 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) {
Comment thread
michaelfeil marked this conversation as resolved.
Outdated
self.state.flags.set(&endpoint_type, enable);
tracing::info!(
"{} endpoints {}",
Expand Down
Loading