setup context manger for SignalClient and LLMClient

This commit is contained in:
2026-03-09 11:39:02 -04:00
parent f762f12bd2
commit c73aa5c98a
3 changed files with 23 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ from __future__ import annotations
import base64
import logging
from typing import Any
from typing import Any, Self
import httpx
@@ -66,6 +66,14 @@ class LLMClient:
response.raise_for_status()
return [m["name"] for m in response.json().get("models", [])]
def __enter__(self) -> Self:
"""Enter the context manager."""
return self
def __exit__(self, *args: object) -> None:
"""Close the HTTP client on exit."""
self.close()
def close(self) -> None:
"""Close the HTTP client."""
self._client.close()