nuclia 4.8.5__py3-none-any.whl → 4.8.7__py3-none-any.whl
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.
- nuclia/lib/nua.py +6 -0
- nuclia/lib/nua_responses.py +16 -1
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/METADATA +2 -2
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/RECORD +8 -8
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/WHEEL +1 -1
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/entry_points.txt +0 -0
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/licenses/LICENSE +0 -0
- {nuclia-4.8.5.dist-info → nuclia-4.8.7.dist-info}/top_level.txt +0 -0
nuclia/lib/nua.py
CHANGED
@@ -26,6 +26,7 @@ from nuclia_models.predict.generative_responses import (
|
|
26
26
|
CitationsGenerativeResponse,
|
27
27
|
MetaGenerativeResponse,
|
28
28
|
StatusGenerativeResponse,
|
29
|
+
ToolsGenerativeResponse,
|
29
30
|
)
|
30
31
|
from nuclia.lib.nua_responses import (
|
31
32
|
ChatModel,
|
@@ -233,6 +234,8 @@ class NuaClient:
|
|
233
234
|
result.citations = chunk.chunk.citations
|
234
235
|
elif isinstance(chunk.chunk, StatusGenerativeResponse):
|
235
236
|
result.code = chunk.chunk.code
|
237
|
+
elif isinstance(chunk.chunk, ToolsGenerativeResponse):
|
238
|
+
result.tools = chunk.chunk.tools
|
236
239
|
return result
|
237
240
|
|
238
241
|
def generate_stream(
|
@@ -564,6 +567,9 @@ class AsyncNuaClient:
|
|
564
567
|
result.citations = chunk.chunk.citations
|
565
568
|
elif isinstance(chunk.chunk, StatusGenerativeResponse):
|
566
569
|
result.code = chunk.chunk.code
|
570
|
+
elif isinstance(chunk.chunk, ToolsGenerativeResponse):
|
571
|
+
result.tools = chunk.chunk.tools
|
572
|
+
|
567
573
|
return result
|
568
574
|
|
569
575
|
async def generate_stream(
|
nuclia/lib/nua_responses.py
CHANGED
@@ -72,6 +72,14 @@ class Image(BaseModel):
|
|
72
72
|
b64encoded: str
|
73
73
|
|
74
74
|
|
75
|
+
class Tool(BaseModel):
|
76
|
+
name: str
|
77
|
+
description: str
|
78
|
+
parameters: Dict[str, Any] = Field(
|
79
|
+
default_factory=dict, description="Schema of the tool"
|
80
|
+
)
|
81
|
+
|
82
|
+
|
75
83
|
class ChatModel(BaseModel):
|
76
84
|
question: str
|
77
85
|
retrieval: bool = True
|
@@ -81,7 +89,7 @@ class ChatModel(BaseModel):
|
|
81
89
|
context: List[Message] = []
|
82
90
|
query_context: Union[List[str], Dict[str, str]] = {}
|
83
91
|
query_context_order: Dict[str, int] = {}
|
84
|
-
truncate: Optional[bool] =
|
92
|
+
truncate: Optional[bool] = True
|
85
93
|
user_prompt: Optional[UserPrompt] = None
|
86
94
|
citations: Optional[bool] = False
|
87
95
|
citation_threshold: Optional[float] = Field(
|
@@ -102,6 +110,9 @@ class ChatModel(BaseModel):
|
|
102
110
|
default=False,
|
103
111
|
description="Whether to reorder the query context based on a reranker. This option will also make it so the first response will contain the scores given for each context piece.",
|
104
112
|
)
|
113
|
+
tools: List[Tool] = Field(
|
114
|
+
default_factory=list, description="List of tools to choose"
|
115
|
+
)
|
105
116
|
|
106
117
|
@model_validator(mode="after")
|
107
118
|
def validate_model(self) -> Self:
|
@@ -109,6 +120,10 @@ class ChatModel(BaseModel):
|
|
109
120
|
raise ValueError("Can not setup markdown and JSON Schema at the same time")
|
110
121
|
if self.citations is True and self.json_schema is not None:
|
111
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:
|
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")
|
112
127
|
return self
|
113
128
|
|
114
129
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nuclia
|
3
|
-
Version: 4.8.
|
3
|
+
Version: 4.8.7
|
4
4
|
Summary: Nuclia Python SDK
|
5
5
|
Author-email: Nuclia <info@nuclia.com>
|
6
6
|
License-Expression: MIT
|
@@ -26,7 +26,7 @@ Requires-Dist: httpcore>=1.0.0
|
|
26
26
|
Requires-Dist: prompt_toolkit
|
27
27
|
Requires-Dist: nucliadb_sdk<7,>=6.4
|
28
28
|
Requires-Dist: nucliadb_models<7,>=6.4
|
29
|
-
Requires-Dist: nuclia-models>=0.
|
29
|
+
Requires-Dist: nuclia-models>=0.38.1
|
30
30
|
Requires-Dist: tqdm
|
31
31
|
Requires-Dist: aiofiles
|
32
32
|
Requires-Dist: backoff
|
@@ -11,9 +11,9 @@ nuclia/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
nuclia/lib/conversations.py,sha256=M6qhL9NPEKroYF767S-Q2XWokRrjX02kpYTzRvZKwUE,149
|
12
12
|
nuclia/lib/kb.py,sha256=98zpJ8Dp4rQYMNKm4nhpOms3PY-PFOd8acNgDmBud-o,31819
|
13
13
|
nuclia/lib/models.py,sha256=lO3TZa4jTQ6C8ptGO1oX-5pxDgv8ocO13z7j5jXOC0Y,1554
|
14
|
-
nuclia/lib/nua.py,sha256=
|
14
|
+
nuclia/lib/nua.py,sha256=Y8W0sJWnJqNLQ8y8fPbcJAV-6UtbE1FearHs68qwZQA,25888
|
15
15
|
nuclia/lib/nua_chat.py,sha256=ApL1Y1FWvAVUt-Y9a_8TUSJIhg8-UmBSy8TlDPn6tD8,3874
|
16
|
-
nuclia/lib/nua_responses.py,sha256=
|
16
|
+
nuclia/lib/nua_responses.py,sha256=zji-T-ipYRPo-e1U163Nn_saIiYJYNW3PfjTSL2fQXg,12726
|
17
17
|
nuclia/lib/utils.py,sha256=XAVRRICPem-qOIEcssqDuv-vqD-9PICk6Iuj6DK5GKk,4808
|
18
18
|
nuclia/sdk/__init__.py,sha256=-nAw8i53XBdmbfTa1FJZ0FNRMNakimDVpD6W4OdES-c,1374
|
19
19
|
nuclia/sdk/accounts.py,sha256=7XQ3K9_jlSuk2Cez868FtazZ05xSGab6h3Mt1qMMwIE,647
|
@@ -61,9 +61,9 @@ nuclia/tests/test_nucliadb/test_crud.py,sha256=GuY76HRvt2DFaNgioKm5n0Aco1HnG7zzV
|
|
61
61
|
nuclia/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
nuclia/tests/unit/test_export_import.py,sha256=xo_wVbjUnNlVV65ZGH7LtZ38qy39EkJp2hjOuTHC1nU,980
|
63
63
|
nuclia/tests/unit/test_nua_responses.py,sha256=t_hIdVztTi27RWvpfTJUYcCL0lpKdZFegZIwLdaPNh8,319
|
64
|
-
nuclia-4.8.
|
65
|
-
nuclia-4.8.
|
66
|
-
nuclia-4.8.
|
67
|
-
nuclia-4.8.
|
68
|
-
nuclia-4.8.
|
69
|
-
nuclia-4.8.
|
64
|
+
nuclia-4.8.7.dist-info/licenses/LICENSE,sha256=Ops2LTti_HJtpmWcanuUTdTY3vKDR1myJ0gmGBKC0FA,1063
|
65
|
+
nuclia-4.8.7.dist-info/METADATA,sha256=L_ftUZ5c8tQ5NA4gpDuNzKTkn8Id_XfSxjEk1pleolU,2337
|
66
|
+
nuclia-4.8.7.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
67
|
+
nuclia-4.8.7.dist-info/entry_points.txt,sha256=iZHOyXPNS54r3eQmdi5So20xO1gudI9K2oP4sQsCJRw,46
|
68
|
+
nuclia-4.8.7.dist-info/top_level.txt,sha256=cqn_EitXOoXOSUvZnd4q6QGrhm04pg8tLAZtem-Zfdo,7
|
69
|
+
nuclia-4.8.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|