"""Live smoke test against the real LiteLLM proxy. Skips unless NISSE_LLM_BASE_URL, NISSE_LLM_TOKEN, and NISSE_ROLE_EXECUTOR are present (from the environment or the repo-root .env) — CI stays credential-free by choice; this runs from the operator's machine. """ import os from pathlib import Path import pytest from nisse_dev.canonical import AssistantText, StoredEvent, UserMessage from nisse_dev.envfile import load_env_file from nisse_dev.llm import LiteLLMClient load_env_file(Path(__file__).resolve().parents[2] / ".env") REQUIRED = ("NISSE_LLM_BASE_URL", "NISSE_LLM_TOKEN", "NISSE_ROLE_EXECUTOR") pytestmark = [ pytest.mark.integration, pytest.mark.skipif( not all(os.environ.get(var) for var in REQUIRED), reason=f"live LLM config absent; set {', '.join(REQUIRED)}", ), ] def test_executor_model_completes_via_litellm() -> None: client = LiteLLMClient.from_env() events = [ StoredEvent( id=1, ts="t", event=UserMessage( text="Reply with exactly one word: pong", source="smoke-test" ), ) ] result = client.complete( events, tools=None, model=os.environ["NISSE_ROLE_EXECUTOR"] ) texts = [e.text for e in result if isinstance(e, AssistantText)] assert texts, f"no assistant text in {result!r}" assert "pong" in texts[0].lower()