fere-sdk 0.1.0.dev6__tar.gz → 0.1.0.dev9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,5 +14,8 @@ tmp/*
14
14
  !tmp/.gitkeep
15
15
  coverage.xml
16
16
 
17
+ # triage-rum session state (contains stack traces / error data)
18
+ .claude/skills/triage-rum/triage-session.json
19
+
17
20
  # Eval output
18
21
  compare_results.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fere-sdk
3
- Version: 0.1.0.dev6
3
+ Version: 0.1.0.dev9
4
4
  Summary: Python SDK for the FereAI Gateway API
5
5
  Author-email: Fere AI <info@fere.ai>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fere-sdk"
3
- version = "0.1.0.dev6"
3
+ version = "0.1.0.dev9"
4
4
  description = "Python SDK for the FereAI Gateway API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import logging
6
7
  from collections.abc import AsyncIterator
7
8
  from typing import Any
8
9
 
@@ -22,6 +23,8 @@ from .models import (
22
23
  WithdrawRequest,
23
24
  )
24
25
 
26
+ logger = logging.getLogger(__name__)
27
+
25
28
  DEFAULT_BASE_URL = "https://api.fereai.xyz"
26
29
 
27
30
 
@@ -163,7 +166,14 @@ class FereAPI:
163
166
  if line.startswith("event:"):
164
167
  event_type = line[6:].strip()
165
168
  elif line.startswith("data:"):
166
- data = json.loads(line[5:].strip())
169
+ raw = line[5:].strip()
170
+ if not raw:
171
+ continue
172
+ try:
173
+ data = json.loads(raw)
174
+ except (json.JSONDecodeError, ValueError):
175
+ logger.debug("Unparseable SSE data: %r", raw)
176
+ continue
167
177
  yield ChatEvent(event=event_type, data=data)
168
178
 
169
179
  async def get_threads(self, skip: int = 0, limit: int = 10) -> list[dict]:
@@ -359,7 +369,14 @@ class FereAPI:
359
369
  if line.startswith("event:"):
360
370
  event_type = line[6:].strip()
361
371
  elif line.startswith("data:"):
362
- data = json.loads(line[5:].strip())
372
+ raw = line[5:].strip()
373
+ if not raw:
374
+ continue
375
+ try:
376
+ data = json.loads(raw)
377
+ except (json.JSONDecodeError, ValueError):
378
+ logger.debug("Unparseable SSE data: %r", raw)
379
+ continue
363
380
  yield ChatEvent(event=event_type, data=data)
364
381
 
365
382
  # ----------------------------------------------------------
File without changes