Skip to content

Commit 73dc3be

Browse files
authored
chore: Merge bindings client and client2 functions (#6158)
Signed-off-by: Graham King <grahamk@nvidia.com>
1 parent f46720c commit 73dc3be

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

components/src/dynamo/frontend/vllm_processor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ async def chat_engine_factory(
448448
kv_router_config=self.router_config.kv_router_config,
449449
)
450450
else:
451-
router = await generate_endpoint.client2(self.router_config.router_mode)
451+
router = await generate_endpoint.client(
452+
router_mode=self.router_config.router_mode
453+
)
452454

453455
gen = VllmProcessor(
454456
tokenizer,

lib/bindings/python/rust/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,11 +835,13 @@ impl Endpoint {
835835
})
836836
}
837837

838-
fn client<'p>(&self, py: Python<'p>) -> PyResult<Bound<'p, PyAny>> {
839-
self.client2(py, RouterMode::RoundRobin)
840-
}
841-
842-
fn client2<'p>(&self, py: Python<'p>, router_mode: RouterMode) -> PyResult<Bound<'p, PyAny>> {
838+
#[pyo3(signature = (router_mode = None))]
839+
fn client<'p>(
840+
&self,
841+
py: Python<'p>,
842+
router_mode: Option<RouterMode>,
843+
) -> PyResult<Bound<'p, PyAny>> {
844+
let router_mode = router_mode.unwrap_or(RouterMode::RoundRobin);
843845
let inner = self.inner.clone();
844846
pyo3_async_runtimes::tokio::future_into_py(py, async move {
845847
let client = inner.client().await.map_err(to_pyerr)?;

lib/bindings/python/src/dynamo/_core.pyi

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,11 @@ class Endpoint:
164164
"""
165165
...
166166

167-
async def client(self) -> Client:
167+
async def client(self, router_mode: Optional[RouterMode] = None) -> Client:
168168
"""
169-
Create a `Client` capable of calling served instances of this endpoint using round-robin routing.
170-
"""
171-
...
169+
Create a `Client` capable of calling served instances of this endpoint.
172170
173-
async def client2(self, router_mode: RouterMode) -> Client:
174-
"""
175-
Create a `Client` capable of calling served instances of this endpoint, using a specific
176-
router mode (random, round-robin, kv).
171+
By default this uses round-robin routing when `router_mode` is not provided.
177172
"""
178173
...
179174

0 commit comments

Comments
 (0)