INNER CODE UNIT · Python

lifespan

openchoreo/openchoreo · agents/portal-assistant/src/main.py:41

async def lifespan(_app: FastAPI):
    # Fail-fast config validation: a runtime LLM 401 is a confusing user
    # experience; surface a clear startup error when the API key isn't set.
    if not settings.portal_assistant_llm_api_key:
        raise RuntimeError(
            "PORTAL_ASSISTANT_LLM_API_KEY is not set — refusing to start. "
            "Set the env var (or values.yaml llm.apiKeySecret) and redeploy."
        )
    if not settings.portal_assistant_model_name:
        raise RuntimeError(
            "PORTAL_ASSISTANT_MODEL_NAME is not set — refusing to start. "
            "Set the env var (or values.yaml llm.modelName) and redeploy."
        )

    # Preload prompt templates so a missing/broken Jinja2 file fails the
    # deploy instead of emitting a 500 on the first chat. Includes the
    # OutputTransformerMiddleware templates — without these on disk the
    # first tool result that hits the middleware would 500 mid-stream.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…