@@ -356,7 +356,7 @@ def test_server_terminate():
356
356
mock_manager .shutdown .assert_called ()
357
357
358
358
359
- class IndentityAPI (ls .examples .SimpleLitAPI ):
359
+ class IdentityAPI (ls .examples .SimpleLitAPI ):
360
360
def predict (self , x , context ):
361
361
context ["input" ] = x
362
362
return self .model (x )
@@ -366,7 +366,7 @@ def encode_response(self, output, context):
366
366
return {"output" : input }
367
367
368
368
369
- class IndentityBatchedAPI (ls .examples .SimpleBatchedAPI ):
369
+ class IdentityBatchedAPI (ls .examples .SimpleBatchedAPI ):
370
370
def predict (self , x_batch , context ):
371
371
for c , x in zip (context , x_batch ):
372
372
c ["input" ] = x
@@ -377,7 +377,7 @@ def encode_response(self, output, context):
377
377
return {"output" : input }
378
378
379
379
380
- class IndentityBatchedStreamingAPI (ls .examples .SimpleBatchedAPI ):
380
+ class IdentityBatchedStreamingAPI (ls .examples .SimpleBatchedAPI ):
381
381
def predict (self , x_batch , context ):
382
382
for c , x in zip (context , x_batch ):
383
383
c ["input" ] = x
@@ -407,22 +407,22 @@ def dummy_load_and_raise(resp):
407
407
mocked_load_and_raise .side_effect = dummy_load_and_raise
408
408
409
409
# Test context injection with single loop
410
- api = IndentityAPI ()
410
+ api = IdentityAPI ()
411
411
server = LitServer (api )
412
412
with wrap_litserve_start (server ) as server :
413
413
async with LifespanManager (server .app ) as manager , AsyncClient (app = manager .app , base_url = "http://test" ) as ac :
414
414
resp = await ac .post ("/predict" , json = {"input" : 5.0 }, timeout = 10 )
415
415
assert resp .json ()["output" ] == 5.0 , "output from Identity server must be same as input"
416
416
417
417
# Test context injection with batched loop
418
- server = LitServer (IndentityBatchedAPI (), max_batch_size = 2 , batch_timeout = 0.01 )
418
+ server = LitServer (IdentityBatchedAPI (), max_batch_size = 2 , batch_timeout = 0.01 )
419
419
with wrap_litserve_start (server ) as server :
420
420
async with LifespanManager (server .app ) as manager , AsyncClient (app = manager .app , base_url = "http://test" ) as ac :
421
421
resp = await ac .post ("/predict" , json = {"input" : 5.0 }, timeout = 10 )
422
422
assert resp .json ()["output" ] == 5.0 , "output from Identity server must be same as input"
423
423
424
424
# Test context injection with batched streaming loop
425
- server = LitServer (IndentityBatchedStreamingAPI (), max_batch_size = 2 , batch_timeout = 0.01 , stream = True )
425
+ server = LitServer (IdentityBatchedStreamingAPI (), max_batch_size = 2 , batch_timeout = 0.01 , stream = True )
426
426
with wrap_litserve_start (server ) as server :
427
427
async with LifespanManager (server .app ) as manager , AsyncClient (app = manager .app , base_url = "http://test" ) as ac :
428
428
resp = await ac .post ("/predict" , json = {"input" : 5.0 }, timeout = 10 )
0 commit comments