INNER CODE UNIT · Python
get_health
awslabs/awsome-distributed-ai · architectures/sagemaker-hyperpod-eks/nvidia-cloud-functions/nvcf/sample-function/server.py:43
def get_health() -> HealthCheck:
return HealthCheck(status="OK")
# ---------------------------------------------------------------------------
# Inference endpoint (called by NVCF during function invocation)
# ---------------------------------------------------------------------------
@app.post("/echo", summary="Echo inference endpoint")
async def echo(request: EchoRequest):
"""
Echo the message back. Supports optional delay, repetition, and streaming.
"""
if request.stream:
def stream_text():
for _ in range(request.repeats):
time.sleep(request.delay)
yield f"data: {request.message}\n\n"