MCPcopy Index your code
hub / github.com/mudler/LocalAI / test_tokenize_string

Method test_tokenize_string

backend/python/vllm/test.py:223–240  ·  view source on GitHub ↗

Tests the TokenizeString RPC returns valid tokens.

(self)

Source from the content-addressed store, hash-verified

221 self.assertIs(servicer._apply_engine_args(base, None), base)
222
223 def test_tokenize_string(self):
224 """
225 Tests the TokenizeString RPC returns valid tokens.
226 """
227 try:
228 self.setUp()
229 with grpc.insecure_channel("localhost:50051") as channel:
230 stub = backend_pb2_grpc.BackendStub(channel)
231 response = stub.LoadModel(backend_pb2.ModelOptions(Model="facebook/opt-125m"))
232 self.assertTrue(response.success)
233 resp = stub.TokenizeString(backend_pb2.PredictOptions(Prompt="Hello world"))
234 self.assertGreater(resp.length, 0)
235 self.assertEqual(len(resp.tokens), resp.length)
236 except Exception as err:
237 print(err)
238 self.fail("TokenizeString service failed")
239 finally:
240 self.tearDown()
241
242 def test_free(self):
243 """

Callers

nothing calls this directly

Calls 4

setUpMethod · 0.95
tearDownMethod · 0.95
LoadModelMethod · 0.65
TokenizeStringMethod · 0.65

Tested by

no test coverage detected