MCPcopy
hub / github.com/mudler/LocalAI / PredictStream

Method PredictStream

backend/python/vllm/backend.py:329–345  ·  view source on GitHub ↗

Generates text based on the given prompt and sampling parameters, and streams the results. Args: request: The predict stream request. context: The gRPC context. Returns: backend_pb2.Result: The predict stream result.

(self, request, context)

Source from the content-addressed store, hash-verified

327 return backend_pb2.EmbeddingResult(embeddings=outputs[0].outputs.embedding)
328
329 async def PredictStream(self, request, context):
330 """
331 Generates text based on the given prompt and sampling parameters, and streams the results.
332
333 Args:
334 request: The predict stream request.
335 context: The gRPC context.
336
337 Returns:
338 backend_pb2.Result: The predict stream result.
339 """
340 iterations = self._predict(request, context, streaming=True)
341 try:
342 async for iteration in iterations:
343 yield iteration
344 finally:
345 await iterations.aclose()
346
347 async def TokenizeString(self, request, context):
348 if not hasattr(self, 'tokenizer') or self.tokenizer is None:

Callers

nothing calls this directly

Calls 1

_predictMethod · 0.95

Tested by

no test coverage detected