nuclia 4.8.7__tar.gz → 4.8.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 (97) hide show
  1. {nuclia-4.8.7 → nuclia-4.8.8}/CHANGELOG.md +8 -0
  2. {nuclia-4.8.7 → nuclia-4.8.8}/PKG-INFO +1 -1
  3. nuclia-4.8.8/VERSION +1 -0
  4. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/cli/run.py +4 -5
  5. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/nua.py +28 -4
  6. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/nua_responses.py +3 -3
  7. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_search.py +1 -1
  8. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/PKG-INFO +1 -1
  9. {nuclia-4.8.7 → nuclia-4.8.8}/pyproject.toml +1 -0
  10. {nuclia-4.8.7 → nuclia-4.8.8}/requirements.txt +1 -1
  11. nuclia-4.8.7/VERSION +0 -1
  12. {nuclia-4.8.7 → nuclia-4.8.8}/.gitignore +0 -0
  13. {nuclia-4.8.7 → nuclia-4.8.8}/LICENSE +0 -0
  14. {nuclia-4.8.7 → nuclia-4.8.8}/MANIFEST.in +0 -0
  15. {nuclia-4.8.7 → nuclia-4.8.8}/Makefile +0 -0
  16. {nuclia-4.8.7 → nuclia-4.8.8}/README.md +0 -0
  17. {nuclia-4.8.7 → nuclia-4.8.8}/code-requirements.txt +0 -0
  18. {nuclia-4.8.7 → nuclia-4.8.8}/docs/01-README.md +0 -0
  19. {nuclia-4.8.7 → nuclia-4.8.8}/docs/02-auth.md +0 -0
  20. {nuclia-4.8.7 → nuclia-4.8.8}/docs/03-kb.md +0 -0
  21. {nuclia-4.8.7 → nuclia-4.8.8}/docs/04-upload.md +0 -0
  22. {nuclia-4.8.7 → nuclia-4.8.8}/docs/05-search.md +0 -0
  23. {nuclia-4.8.7 → nuclia-4.8.8}/docs/06-read.md +0 -0
  24. {nuclia-4.8.7 → nuclia-4.8.8}/docs/07-nua.md +0 -0
  25. {nuclia-4.8.7 → nuclia-4.8.8}/docs/08-import-export.md +0 -0
  26. {nuclia-4.8.7 → nuclia-4.8.8}/docs/09-kb-backup.md +0 -0
  27. {nuclia-4.8.7 → nuclia-4.8.8}/docs/10-manage.md +0 -0
  28. {nuclia-4.8.7 → nuclia-4.8.8}/docs/11-activity-log.md +0 -0
  29. {nuclia-4.8.7 → nuclia-4.8.8}/docs/12-da-agents.md +0 -0
  30. {nuclia-4.8.7 → nuclia-4.8.8}/docs/13-ai-agents.md +0 -0
  31. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/__init__.py +0 -0
  32. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/cli/__init__.py +0 -0
  33. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/cli/utils.py +0 -0
  34. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/config.py +0 -0
  35. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/data.py +0 -0
  36. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/decorators.py +0 -0
  37. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/exceptions.py +0 -0
  38. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/__init__.py +0 -0
  39. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/conversations.py +0 -0
  40. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/kb.py +0 -0
  41. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/models.py +0 -0
  42. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/nua_chat.py +0 -0
  43. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/lib/utils.py +0 -0
  44. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/py.typed +0 -0
  45. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/__init__.py +0 -0
  46. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/accounts.py +0 -0
  47. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/agent.py +0 -0
  48. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/auth.py +0 -0
  49. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/backup.py +0 -0
  50. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/export_import.py +0 -0
  51. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/kb.py +0 -0
  52. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/kbs.py +0 -0
  53. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/logger.py +0 -0
  54. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/logs.py +0 -0
  55. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/nua.py +0 -0
  56. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/nucliadb.py +0 -0
  57. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/predict.py +0 -0
  58. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/process.py +0 -0
  59. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/remi.py +0 -0
  60. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/resource.py +0 -0
  61. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/search.py +0 -0
  62. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/task.py +0 -0
  63. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/upload.py +0 -0
  64. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/sdk/zones.py +0 -0
  65. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/__init__.py +0 -0
  66. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/assets/conversation.json +0 -0
  67. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/conftest.py +0 -0
  68. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/fixtures.py +0 -0
  69. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_backup.py +0 -0
  70. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_conversation.py +0 -0
  71. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_export_import.py +0 -0
  72. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_graph.py +0 -0
  73. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_labels.py +0 -0
  74. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_logs.py +0 -0
  75. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_remi.py +0 -0
  76. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_resource.py +0 -0
  77. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_kb/test_tasks.py +0 -0
  78. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_manage/__init__.py +0 -0
  79. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_manage/test_account.py +0 -0
  80. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_manage/test_auth.py +0 -0
  81. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_manage/test_kb.py +0 -0
  82. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_nua/__init__.py +0 -0
  83. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_nua/test_agent.py +0 -0
  84. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_nua/test_predict.py +0 -0
  85. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_nucliadb/__init__.py +0 -0
  86. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/test_nucliadb/test_crud.py +0 -0
  87. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/unit/__init__.py +0 -0
  88. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/unit/test_export_import.py +0 -0
  89. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia/tests/unit/test_nua_responses.py +0 -0
  90. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/SOURCES.txt +0 -0
  91. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/dependency_links.txt +0 -0
  92. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/entry_points.txt +0 -0
  93. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/requires.txt +0 -0
  94. {nuclia-4.8.7 → nuclia-4.8.8}/nuclia.egg-info/top_level.txt +0 -0
  95. {nuclia-4.8.7 → nuclia-4.8.8}/setup.cfg +0 -0
  96. {nuclia-4.8.7 → nuclia-4.8.8}/test-requirements.txt +0 -0
  97. {nuclia-4.8.7 → nuclia-4.8.8}/uv.lock +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+
4
+ ## 4.8.8 (2025-05-14)
5
+
6
+
7
+ - Fix `nuclia version`
8
+ - Fix for Tool validation in ChatModel
9
+ - Fix streaming trying to validate error payload as GenerativeChunk
10
+
3
11
  ## 4.8.7 (2025-05-13)
4
12
 
5
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nuclia
3
- Version: 4.8.7
3
+ Version: 4.8.8
4
4
  Summary: Nuclia Python SDK
5
5
  Author-email: Nuclia <info@nuclia.com>
6
6
  License-Expression: MIT
nuclia-4.8.8/VERSION ADDED
@@ -0,0 +1 @@
1
+ 4.8.8
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  import sys
3
- from pathlib import Path
3
+ from importlib.metadata import version
4
4
 
5
5
  import fire # type: ignore
6
6
  from nucliadb_sdk import exceptions
@@ -9,12 +9,13 @@ from nuclia.data import get_auth
9
9
  from nuclia.exceptions import NeedUserToken, UserTokenExpired
10
10
  from nuclia.lib.utils import serialize
11
11
  from nuclia.sdk.accounts import NucliaAccounts
12
+ from nuclia.sdk.backup import NucliaBackup
12
13
  from nuclia.sdk.kb import NucliaKB
13
14
  from nuclia.sdk.kbs import NucliaKBS
14
- from nuclia.sdk.backup import NucliaBackup
15
15
  from nuclia.sdk.logger import logger
16
16
  from nuclia.sdk.nua import NucliaNUA
17
17
  from nuclia.sdk.zones import NucliaZones
18
+
18
19
  from .utils import CustomFormatter
19
20
 
20
21
 
@@ -30,9 +31,7 @@ class NucliaCLI(object):
30
31
 
31
32
  def version(self):
32
33
  """Print the version of the CLI"""
33
- _dir = Path(__file__).resolve().parent.parent.parent
34
- VERSION = _dir.joinpath("VERSION").open().read().strip()
35
- return VERSION
34
+ return version("nuclia")
36
35
 
37
36
 
38
37
  def run():
@@ -56,6 +56,8 @@ import os
56
56
  from tqdm import tqdm
57
57
  import asyncio
58
58
  from nuclia.lib.utils import build_httpx_client, build_httpx_async_client
59
+ from pydantic import ValidationError
60
+
59
61
 
60
62
  if TYPE_CHECKING:
61
63
  from nucliadb_protos.writer_pb2 import BrokerMessage
@@ -147,8 +149,19 @@ class NuaClient:
147
149
  json=payload,
148
150
  timeout=timeout,
149
151
  ) as response:
150
- for json_body in response.iter_lines():
151
- yield GenerativeChunk.model_validate_json(json_body) # type: ignore
152
+ if response.headers.get("content-type") == "application/x-ndjson":
153
+ for json_body in response.iter_lines():
154
+ try:
155
+ yield GenerativeChunk.model_validate_json(json_body) # type: ignore
156
+ except ValidationError as e:
157
+ raise RuntimeError(f"Invalid stream chunk: {json_body}") from e
158
+
159
+ else:
160
+ # Read the full error body and raise an appropriate exception
161
+ error_content = response.content
162
+ raise RuntimeError(
163
+ f"Stream request failed with status {response.status_code}: {error_content.decode('utf-8')}"
164
+ )
152
165
 
153
166
  def add_config_predict(self, kbid: str, config: LearningConfigurationCreation):
154
167
  endpoint = f"{self.url}{CONFIG}/{kbid}"
@@ -456,8 +469,19 @@ class AsyncNuaClient:
456
469
  json=payload,
457
470
  timeout=timeout,
458
471
  ) as response:
459
- async for json_body in response.aiter_lines():
460
- yield GenerativeChunk.model_validate_json(json_body) # type: ignore
472
+ if response.headers.get("content-type") == "application/x-ndjson":
473
+ async for json_body in response.aiter_lines():
474
+ try:
475
+ yield GenerativeChunk.model_validate_json(json_body) # type: ignore
476
+ except ValidationError as e:
477
+ raise RuntimeError(f"Invalid stream chunk: {json_body}") from e
478
+
479
+ else:
480
+ # Read the full error body and raise an appropriate exception
481
+ error_content = await response.aread()
482
+ raise RuntimeError(
483
+ f"Stream request failed with status {response.status_code}: {error_content.decode('utf-8')}"
484
+ )
461
485
 
462
486
  async def add_config_predict(
463
487
  self, kbid: str, config: LearningConfigurationCreation
@@ -120,10 +120,10 @@ class ChatModel(BaseModel):
120
120
  raise ValueError("Can not setup markdown and JSON Schema at the same time")
121
121
  if self.citations is True and self.json_schema is not None:
122
122
  raise ValueError("Can not setup citations and JSON Schema at the same time")
123
- if self.citations is True and self.tools is not None:
123
+ if self.citations is True and len(self.tools) > 0:
124
124
  raise ValueError("Can not setup citations and Tools at the same time")
125
- if self.tools is True and self.json_schema is not None:
126
- raise ValueError("Can not setup tools and JSON Schema at the same time")
125
+ if len(self.tools) > 0 and self.json_schema is not None:
126
+ raise ValueError("Can not setup Tools and JSON Schema at the same time")
127
127
  return self
128
128
 
129
129
 
@@ -69,7 +69,7 @@ def test_search(testing_config):
69
69
  def test_catalog(testing_config):
70
70
  search = NucliaSearch()
71
71
  results = search.catalog()
72
- assert len(results.resources.keys()) == 2
72
+ assert len(results.resources.keys()) >= 2
73
73
 
74
74
 
75
75
  def test_search_object(testing_config):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nuclia
3
- Version: 4.8.7
3
+ Version: 4.8.8
4
4
  Summary: Nuclia Python SDK
5
5
  Author-email: Nuclia <info@nuclia.com>
6
6
  License-Expression: MIT
@@ -54,3 +54,4 @@ version = { file = "VERSION" }
54
54
 
55
55
  [tool.pytest.ini_options]
56
56
  asyncio_mode = "auto"
57
+
@@ -8,7 +8,7 @@ prompt_toolkit
8
8
  nucliadb_sdk>=6.4,<7
9
9
  nucliadb_models>=6.4,<7
10
10
  nucliadb_protos>=6.4,<7
11
- nuclia-models>=0.32.0
11
+ nuclia-models>=0.39.0
12
12
  tqdm
13
13
  aiofiles
14
14
  backoff
nuclia-4.8.7/VERSION DELETED
@@ -1 +0,0 @@
1
- 4.8.7
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
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