Skip to content

Commit 517fb99

Browse files
authored
dont fail on error response (#1079)
1 parent d568e1e commit 517fb99

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/modelgauge/suts/together_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,19 +310,20 @@ def _spin_up_endpoint(self):
310310
self._spin_up_endpoint()
311311
elif self.endpoint_status == "STOPPED" or self.endpoint_status == "ERROR":
312312
# Start endpoint.
313+
logger.warning(
314+
f"Together endpoint for {self.model} is not ready. Status: {self.endpoint_status}. Spinning up..."
315+
)
313316
headers = {"accept": "application/json", "authorization": f"Bearer {self.api_key}"}
314317
payload = {"state": "STARTED"}
315318
response = _retrying_request(f"{self._ENDPOINTS_URL}/{self.endpoint_id}", headers, payload, "PATCH")
316-
self.endpoint_status = response.json()["state"]
319+
if "state" in response.json():
320+
self.endpoint_status = response.json()["state"]
317321
if self.endpoint_status != "STARTED":
318322
# Try again.
319323
self._spin_up_endpoint()
320324

321325
def evaluate(self, request: TogetherChatRequest) -> TogetherChatResponse:
322326
if self.endpoint_status != "STARTED":
323-
logger.warning(
324-
f"Together endpoint for {self.model} is not ready. Status: {self.endpoint_status}. Spinning up..."
325-
)
326327
self._spin_up_endpoint()
327328
try:
328329
return super().evaluate(request)

0 commit comments

Comments
 (0)