sdpy-kit 0.1.7__tar.gz → 0.1.8__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.
Files changed (42) hide show
  1. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/PKG-INFO +1 -1
  2. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/__init__.py +1 -1
  3. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/model_client.py +14 -6
  4. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/.gitignore +0 -0
  5. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/README.md +0 -0
  6. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/__init__.py +0 -0
  7. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/base_service.py +0 -0
  8. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/chat_service.py +0 -0
  9. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/embedding_service.py +0 -0
  10. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/exceptions.py +0 -0
  11. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/failover.py +0 -0
  12. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/image_service.py +0 -0
  13. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/model_builder.py +0 -0
  14. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/pool.py +0 -0
  15. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/profiles.py +0 -0
  16. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/rerank_service.py +0 -0
  17. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/runner.py +0 -0
  18. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/ai/types.py +0 -0
  19. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/common_kit.py +0 -0
  20. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/config/__init__.py +0 -0
  21. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/config/kit_config.py +0 -0
  22. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/config/log_config.py +0 -0
  23. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/__init__.py +0 -0
  24. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/base_db_kit.py +0 -0
  25. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/crud.py +0 -0
  26. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/engine.py +0 -0
  27. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/exceptions.py +0 -0
  28. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/models/__init__.py +0 -0
  29. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/models/base.py +0 -0
  30. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/mysql_kit.py +0 -0
  31. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/pg_kit.py +0 -0
  32. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/query.py +0 -0
  33. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/session.py +0 -0
  34. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/sqlite_kit.py +0 -0
  35. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/db/transaction.py +0 -0
  36. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/doc_kit.py +0 -0
  37. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/file_kit.py +0 -0
  38. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/mcp_kit.py +0 -0
  39. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/mineru_kit.py +0 -0
  40. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/redis_kit.py +0 -0
  41. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/kit/zvec_kit.py +0 -0
  42. {sdpy_kit-0.1.7 → sdpy_kit-0.1.8}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sdpy-kit
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: SDPY Kit——统一数据库访问层(PG/MySQL/SQLite)与 AI/MCP/Redis/文件/文档/向量工具集
5
5
  Author-email: Clark <changhongyuan@126.com>
6
6
  License-Expression: MIT
@@ -23,7 +23,7 @@ Author: Clark Chang
23
23
  数据库访问通过 kit.db 子包提供(基于 SQLModel)。
24
24
  """
25
25
 
26
- __version__ = "0.1.7"
26
+ __version__ = "0.1.8"
27
27
 
28
28
  from kit.db import (
29
29
  MYSQL,
@@ -219,18 +219,26 @@ class ModelClient:
219
219
  json=payload,
220
220
  timeout=None,
221
221
  ) as resp:
222
- resp.raise_for_status()
222
+ if resp.is_error:
223
+ # 错误响应体必须在流上下文内读取;离开后访问 .text 会抛
224
+ # ResponseNotRead 并掩盖真实状态码(0.1.7 缺陷)
225
+ body = (await resp.aread()).decode("utf-8", errors="replace")[:200]
226
+ retry_after = (
227
+ _parse_retry_after(resp.headers.get("Retry-After"))
228
+ if resp.status_code == 429
229
+ else None
230
+ )
231
+ raise AIRequestError(
232
+ f"流式 HTTP 错误 {resp.status_code}: {body}",
233
+ status_code=resp.status_code,
234
+ retry_after=retry_after,
235
+ )
223
236
  async for line in resp.aiter_lines():
224
237
  parsed = await self._parse_sse_line(line)
225
238
  if parsed is not None:
226
239
  yield parsed
227
240
  except httpx.TimeoutException as exc:
228
241
  raise AITimeoutError(f"流式请求超时: {exc}") from exc
229
- except httpx.HTTPStatusError as exc:
230
- raise AIRequestError(
231
- f"流式 HTTP 错误 {exc.response.status_code}: {exc.response.text[:200]}",
232
- status_code=exc.response.status_code,
233
- ) from exc
234
242
  except httpx.HTTPError as exc:
235
243
  raise AIRequestError(f"流式请求失败: {exc}") from exc
236
244
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes