# Server with Deployment(uses=TokenStreamingExecutor, port=12345, protocol='grpc') as dep: dep.block() # Client async def main(): client = Client(port=12345, protocol='grpc', asyncio=True) async for doc in client.stream_doc( on='/stream', inputs=PromptDocument(prompt='what is the capital of France ?', max_tokens=10), return_type=ModelOutputDocument, ): print(doc.generated_text)