diff --git a/segmind/__init__.py b/segmind/__init__.py index c6c9bd6..09ed4ca 100644 --- a/segmind/__init__.py +++ b/segmind/__init__.py @@ -38,7 +38,7 @@ InferenceTimeout, ) -__version__ = "1.0.0" +__version__ = "1.0.1" # Default client (lazily initialized) _default_client: Optional[SegmindClient] = None diff --git a/segmind/client.py b/segmind/client.py index 77a4ced..e51904c 100644 --- a/segmind/client.py +++ b/segmind/client.py @@ -46,7 +46,12 @@ def _build_client(self) -> httpx.Client: headers = { # "Content-Type": "application/json", "User-Agent": "segmind-python-sdk/0.1.0", - "X-Initiator": "segmind-python-sdk/0.1.0", + # SEG-319: identifies SDK traffic in spotdb. Heimdall passes + # X-Initiator through verbatim on sync (-> "SDK-PY") and suffixes + # "-V2" on the v2-async path (-> "SDK-PY-V2"). Must match the + # InitiatorType enum in spot-backend or it's coerced to OTHERS. + # Version detail stays in User-Agent above. + "X-Initiator": "SDK-PY", } if self.api_key: headers["x-api-key"] = self.api_key diff --git a/tests/test_client.py b/tests/test_client.py index 9ff68f8..5894e8d 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -36,7 +36,9 @@ def test_http_client_headers(self, mock_api_key): assert http_client.headers["x-api-key"] == mock_api_key assert http_client.headers["User-Agent"] == "segmind-python-sdk/0.1.0" - assert http_client.headers["X-Initiator"] == "segmind-python-sdk/0.1.0" + # SEG-319: stable initiator token so spotdb can attribute SDK traffic + # (heimdall suffixes -V2 on the v2-async path -> "SDK-PY-V2"). + assert http_client.headers["X-Initiator"] == "SDK-PY" def test_http_client_headers_without_api_key(self): @@ -46,7 +48,7 @@ def test_http_client_headers_without_api_key(self): assert "x-api-key" not in http_client.headers assert http_client.headers["User-Agent"] == "segmind-python-sdk/0.1.0" - assert http_client.headers["X-Initiator"] == "segmind-python-sdk/0.1.0" + assert http_client.headers["X-Initiator"] == "SDK-PY" def test_http_client_timeout_configuration(self, mock_api_key):