nucliadb-models 6.2.1.post3316__py3-none-any.whl → 6.2.1.post3326__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.
- nucliadb_models/agents/ingestion.py +96 -0
- {nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/METADATA +1 -1
- {nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/RECORD +5 -4
- {nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/WHEEL +0 -0
- {nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Copyright (C) 2021 Bosutech XXI S.L.
|
|
2
|
+
#
|
|
3
|
+
# nucliadb is offered under the AGPL v3.0 and as commercial software.
|
|
4
|
+
# For commercial licensing, contact us at info@nuclia.com.
|
|
5
|
+
#
|
|
6
|
+
# AGPL:
|
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU Affero General Public License as
|
|
9
|
+
# published by the Free Software Foundation, either version 3 of the
|
|
10
|
+
# License, or (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU Affero General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
#
|
|
20
|
+
from enum import Enum
|
|
21
|
+
from typing import Optional
|
|
22
|
+
|
|
23
|
+
from pydantic import BaseModel, Field
|
|
24
|
+
|
|
25
|
+
from nucliadb_models.common import QuestionAnswers
|
|
26
|
+
from nucliadb_models.extracted import FieldMetadata
|
|
27
|
+
from nucliadb_models.text import FieldText
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AgentType(Enum):
|
|
31
|
+
graph = "graph"
|
|
32
|
+
label = "label"
|
|
33
|
+
ask = "ask"
|
|
34
|
+
qa = "qa"
|
|
35
|
+
extract = "extract"
|
|
36
|
+
prompt_guard = "prompt_guard"
|
|
37
|
+
llama_guard = "llama_guard"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class AgentsFilter(BaseModel):
|
|
41
|
+
type: AgentType
|
|
42
|
+
task_names: list[str] = Field(
|
|
43
|
+
default_factory=list,
|
|
44
|
+
description="list of task names. If None or empty, all tasks for that operation are applied.",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ResourceAgentsRequest(BaseModel):
|
|
49
|
+
filters: Optional[list[AgentsFilter]] = Field(
|
|
50
|
+
default=None,
|
|
51
|
+
description="Filters to apply to the agents. If None, all curently configured agents are applied.",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class NewTextField(BaseModel):
|
|
56
|
+
text_field: FieldText
|
|
57
|
+
destination: str
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class AppliedDataAugmentation(BaseModel):
|
|
61
|
+
qas: Optional[QuestionAnswers] = Field(
|
|
62
|
+
default=None,
|
|
63
|
+
description="Question and answers generated by the Question Answers agent",
|
|
64
|
+
)
|
|
65
|
+
new_text_fields: list[NewTextField] = Field(
|
|
66
|
+
default_factory=list,
|
|
67
|
+
description="New text fields. Only generated by the Generator agent as of now.",
|
|
68
|
+
)
|
|
69
|
+
changed: bool = Field(
|
|
70
|
+
default=True,
|
|
71
|
+
description="Indicates if the FieldMetadata was changed by the agents",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class AugmentedField(BaseModel):
|
|
76
|
+
metadata: FieldMetadata = Field(
|
|
77
|
+
...,
|
|
78
|
+
title="The updated metadata of the field",
|
|
79
|
+
)
|
|
80
|
+
applied_data_augmentation: AppliedDataAugmentation = Field(
|
|
81
|
+
..., title="The results of the Applied Data Augmentation"
|
|
82
|
+
)
|
|
83
|
+
input_nuclia_tokens: float = Field(
|
|
84
|
+
..., title="The number of input Nuclia tokens consumed for the field"
|
|
85
|
+
)
|
|
86
|
+
output_nuclia_tokens: float = Field(
|
|
87
|
+
..., title="The number of output Nuclia tokens consumed for the field"
|
|
88
|
+
)
|
|
89
|
+
time: float = Field(..., title="The time taken to execute the Data Augmentation agents to the field")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ResourceAgentsResponse(BaseModel):
|
|
93
|
+
results: dict[str, AugmentedField] = Field(
|
|
94
|
+
...,
|
|
95
|
+
title="Pairs of augmented FieldMetadata and Data Augmentation results by field id",
|
|
96
|
+
)
|
{nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/RECORD
RENAMED
|
@@ -24,10 +24,11 @@ nucliadb_models/utils.py,sha256=ndsLMxu9XWvJcCTT-1THJasr3EfZVAx2JtxmcU6F7mA,2651
|
|
|
24
24
|
nucliadb_models/vectors.py,sha256=hDrvUag4WpmQkM8rN5v868IlKSNpVc9OEddJxaxuYws,748
|
|
25
25
|
nucliadb_models/vectorsets.py,sha256=avxwO9JPX2k5sCniuNhh2MSsP7aRNvf1eB1-h3-Ju1o,1040
|
|
26
26
|
nucliadb_models/writer.py,sha256=OLtCGmicpVf56pXi2_myTAvStpnaBKKOVNtZzHkKKtw,8472
|
|
27
|
+
nucliadb_models/agents/ingestion.py,sha256=mV7gV6VpYg4VNpc59K3275TMUJZbUzeUnp3SZzO5uxY,3137
|
|
27
28
|
nucliadb_models/internal/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
28
29
|
nucliadb_models/internal/predict.py,sha256=5rgUPrH_98gerySOZ-TR2PX_qzCGF1_8VxyOu3bGhis,2281
|
|
29
30
|
nucliadb_models/internal/shards.py,sha256=uZLsMkYWrJDHq3xy_w7snSeV2X3aDBuht9GC_MG3sKc,1976
|
|
30
|
-
nucliadb_models-6.2.1.
|
|
31
|
-
nucliadb_models-6.2.1.
|
|
32
|
-
nucliadb_models-6.2.1.
|
|
33
|
-
nucliadb_models-6.2.1.
|
|
31
|
+
nucliadb_models-6.2.1.post3326.dist-info/METADATA,sha256=YXTdL1guOZOWK__8lJQ5cph3mCbBJ3c0B4MyeVbZM20,759
|
|
32
|
+
nucliadb_models-6.2.1.post3326.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
33
|
+
nucliadb_models-6.2.1.post3326.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
|
|
34
|
+
nucliadb_models-6.2.1.post3326.dist-info/RECORD,,
|
|
File without changes
|
{nucliadb_models-6.2.1.post3316.dist-info → nucliadb_models-6.2.1.post3326.dist-info}/top_level.txt
RENAMED
|
File without changes
|