Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions components/frontend/src/dynamo/frontend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def parse_args():
parser.add_argument(
"--kv-cache-block-size", type=int, help="KV cache block size (u32)."
)
parser.add_argument(
"--http-host",
type=str,
default=os.environ.get("DYN_HTTP_HOST", "0.0.0.0"),
help="HTTP host for the engine (str). Can be set via DYN_HTTP_HOST env var.",
)
parser.add_argument(
"--http-port",
type=int,
Expand Down Expand Up @@ -209,6 +215,7 @@ async def async_main():
kv_router_config = None

kwargs = {
"http_host": flags.http_host,
"http_port": flags.http_port,
"kv_cache_block_size": flags.kv_cache_block_size,
"router_config": RouterConfig(
Expand Down
6 changes: 5 additions & 1 deletion lib/bindings/python/rust/llm/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub(crate) struct EntrypointArgs {
template_file: Option<PathBuf>,
router_config: Option<RouterConfig>,
kv_cache_block_size: Option<u32>,
http_host: Option<String>,
http_port: u16,
tls_cert_path: Option<PathBuf>,
tls_key_path: Option<PathBuf>,
Expand All @@ -112,7 +113,7 @@ pub(crate) struct EntrypointArgs {
impl EntrypointArgs {
#[allow(clippy::too_many_arguments)]
#[new]
#[pyo3(signature = (engine_type, model_path=None, model_name=None, model_config=None, endpoint_id=None, context_length=None, template_file=None, router_config=None, kv_cache_block_size=None, http_port=None, tls_cert_path=None, tls_key_path=None, extra_engine_args=None))]
#[pyo3(signature = (engine_type, model_path=None, model_name=None, model_config=None, endpoint_id=None, context_length=None, template_file=None, router_config=None, kv_cache_block_size=None, http_host=None, http_port=None, tls_cert_path=None, tls_key_path=None, extra_engine_args=None))]
pub fn new(
engine_type: EngineType,
model_path: Option<PathBuf>,
Expand All @@ -123,6 +124,7 @@ impl EntrypointArgs {
template_file: Option<PathBuf>,
router_config: Option<RouterConfig>,
kv_cache_block_size: Option<u32>,
http_host: Option<String>,
http_port: Option<u16>,
tls_cert_path: Option<PathBuf>,
tls_key_path: Option<PathBuf>,
Expand Down Expand Up @@ -153,6 +155,7 @@ impl EntrypointArgs {
template_file,
router_config,
kv_cache_block_size,
http_host,
http_port: http_port.unwrap_or(DEFAULT_HTTP_PORT),
tls_cert_path,
tls_key_path,
Expand Down Expand Up @@ -184,6 +187,7 @@ pub fn make_engine<'p>(
.request_template(args.template_file.clone())
.kv_cache_block_size(args.kv_cache_block_size)
.router_config(args.router_config.clone().map(|rc| rc.into()))
.http_host(args.http_host.clone())
.http_port(args.http_port)
.tls_cert_path(args.tls_cert_path.clone())
.tls_key_path(args.tls_key_path.clone())
Expand Down
3 changes: 3 additions & 0 deletions lib/llm/src/entrypoint/input/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pub async fn run(runtime: Runtime, engine_config: EngineConfig) -> anyhow::Resul
);
}
};
if let Some(http_host) = local_model.http_host() {
http_service_builder = http_service_builder.host(http_host);
}
http_service_builder =
http_service_builder.with_request_template(engine_config.local_model().request_template());

Expand Down
14 changes: 14 additions & 0 deletions lib/llm/src/local_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct LocalModelBuilder {
template_file: Option<PathBuf>,
router_config: Option<RouterConfig>,
kv_cache_block_size: u32,
http_host: Option<String>,
http_port: u16,
tls_cert_path: Option<PathBuf>,
tls_key_path: Option<PathBuf>,
Expand All @@ -64,6 +65,7 @@ impl Default for LocalModelBuilder {
fn default() -> Self {
LocalModelBuilder {
kv_cache_block_size: DEFAULT_KV_CACHE_BLOCK_SIZE,
http_host: Default::default(),
http_port: DEFAULT_HTTP_PORT,
tls_cert_path: Default::default(),
tls_key_path: Default::default(),
Expand Down Expand Up @@ -115,6 +117,11 @@ impl LocalModelBuilder {
self
}

pub fn http_host(&mut self, host: Option<String>) -> &mut Self {
self.http_host = host;
self
}

pub fn http_port(&mut self, port: u16) -> &mut Self {
self.http_port = port;
self
Expand Down Expand Up @@ -200,6 +207,7 @@ impl LocalModelBuilder {
full_path: PathBuf::new(),
endpoint_id,
template,
http_host: self.http_host.take(),
http_port: self.http_port,
tls_cert_path: self.tls_cert_path.take(),
tls_key_path: self.tls_key_path.take(),
Expand Down Expand Up @@ -275,6 +283,7 @@ impl LocalModelBuilder {
full_path,
endpoint_id,
template,
http_host: self.http_host.take(),
http_port: self.http_port,
tls_cert_path: self.tls_cert_path.take(),
tls_key_path: self.tls_key_path.take(),
Expand All @@ -290,6 +299,7 @@ pub struct LocalModel {
card: ModelDeploymentCard,
endpoint_id: EndpointId,
template: Option<RequestTemplate>,
http_host: Option<String>,
http_port: u16,
tls_cert_path: Option<PathBuf>,
tls_key_path: Option<PathBuf>,
Expand Down Expand Up @@ -321,6 +331,10 @@ impl LocalModel {
self.template.clone()
}

pub fn http_host(&self) -> Option<String> {
self.http_host.clone()
}

pub fn http_port(&self) -> u16 {
self.http_port
}
Expand Down
Loading