kodexa 7.4.418502378964__tar.gz → 7.4.418571517744__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.
Potentially problematic release.
This version of kodexa might be problematic. Click here for more details.
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/PKG-INFO +1 -1
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/model.py +7 -1
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/objects.py +219 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/persistence.py +61 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/platform/client.py +173 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/pyproject.toml +1 -1
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/LICENSE +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/README.md +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/assistant/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/assistant/assistant.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/connectors/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/connectors/connectors.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/dataclasses/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/dataclasses/templates/llm_data_class.j2 +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/base.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/check_response.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/product.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/product_group.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/product_subscription.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/utils.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/pipeline/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/pipeline/pipeline.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/platform/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/platform/interaction.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/platform/kodexa.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/platform/manifest.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/ast.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/core.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/lexrules.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/lextab.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/lextab.pyi +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/parserules.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/parserules.pyi +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/parsetab.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/selectors/parsetab.pyi +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/spatial/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/spatial/azure_models.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/spatial/bbox_common.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/spatial/table_form_common.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/steps/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/steps/common.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/testing/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/testing/test_components.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/testing/test_utils.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/training/__init__.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/training/train_utils.py +0 -0
- {kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/utils/__init__.py +0 -0
|
@@ -14,7 +14,7 @@ import deepdiff
|
|
|
14
14
|
import msgpack
|
|
15
15
|
from pydantic import BaseModel, ConfigDict, Field
|
|
16
16
|
|
|
17
|
-
from kodexa.model.objects import ContentObject, FeatureSet, DocumentTaxonValidation
|
|
17
|
+
from kodexa.model.objects import ContentObject, FeatureSet, DocumentTaxonValidation, KnowledgeItem
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class Ref:
|
|
@@ -2503,6 +2503,12 @@ class Document(object):
|
|
|
2503
2503
|
def set_steps(self, steps: list[ProcessingStep]):
|
|
2504
2504
|
self._persistence_layer.set_steps(steps)
|
|
2505
2505
|
|
|
2506
|
+
def get_knowledge(self) -> list[KnowledgeItem]:
|
|
2507
|
+
return self._persistence_layer.get_knowledge()
|
|
2508
|
+
|
|
2509
|
+
def set_knowledge(self, knowledge: list[KnowledgeItem]):
|
|
2510
|
+
self._persistence_layer.set_knowledge(knowledge)
|
|
2511
|
+
|
|
2506
2512
|
def replace_exceptions(self, exceptions: List[ContentException]):
|
|
2507
2513
|
self._persistence_layer.replace_exceptions(exceptions)
|
|
2508
2514
|
|
|
@@ -6464,6 +6464,215 @@ class Note(BaseModel):
|
|
|
6464
6464
|
note_properties: Optional[Dict[str, str]] = Field(default_factory=dict, alias="noteProperties")
|
|
6465
6465
|
|
|
6466
6466
|
|
|
6467
|
+
# Knowledge Domain Models
|
|
6468
|
+
|
|
6469
|
+
class KnowledgeSetStatus(str, Enum):
|
|
6470
|
+
"""Status of a KnowledgeSet lifecycle"""
|
|
6471
|
+
PENDING_REVIEW = "PENDING_REVIEW"
|
|
6472
|
+
IN_REVIEW = "IN_REVIEW"
|
|
6473
|
+
ACTIVE = "ACTIVE"
|
|
6474
|
+
ON_HOLD = "ON_HOLD"
|
|
6475
|
+
ARCHIVED = "ARCHIVED"
|
|
6476
|
+
|
|
6477
|
+
|
|
6478
|
+
class KnowledgeFeatureType(BaseModel):
|
|
6479
|
+
"""Defines types of knowledge features"""
|
|
6480
|
+
model_config = ConfigDict(
|
|
6481
|
+
populate_by_name=True,
|
|
6482
|
+
use_enum_values=True,
|
|
6483
|
+
arbitrary_types_allowed=True,
|
|
6484
|
+
protected_namespaces=("model_config",),
|
|
6485
|
+
)
|
|
6486
|
+
|
|
6487
|
+
id: Optional[str] = Field(None, description="Unique identifier")
|
|
6488
|
+
uuid: Optional[str] = None
|
|
6489
|
+
name: str = Field(..., description="Feature type name")
|
|
6490
|
+
slug: str = Field(..., description="URL-safe identifier")
|
|
6491
|
+
description: Optional[str] = Field(None, description="Type description")
|
|
6492
|
+
color: Optional[str] = Field(None, description="UI color code")
|
|
6493
|
+
icon: Optional[str] = Field(None, description="Icon identifier")
|
|
6494
|
+
label_json_path: Optional[str] = Field(None, alias="labelJsonPath", description="JSON path for label extraction")
|
|
6495
|
+
options: Optional[List[Dict[str, Any]]] = Field(default_factory=list, description="Configuration options")
|
|
6496
|
+
organization: Optional[Dict[str, Any]] = Field(None, description="Organization reference")
|
|
6497
|
+
active: bool = Field(True, description="Is feature type active")
|
|
6498
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
|
6499
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
|
6500
|
+
|
|
6501
|
+
|
|
6502
|
+
class KnowledgeFeature(BaseModel):
|
|
6503
|
+
"""Represents a knowledge feature linking items and document families"""
|
|
6504
|
+
model_config = ConfigDict(
|
|
6505
|
+
populate_by_name=True,
|
|
6506
|
+
use_enum_values=True,
|
|
6507
|
+
arbitrary_types_allowed=True,
|
|
6508
|
+
protected_namespaces=("model_config",),
|
|
6509
|
+
)
|
|
6510
|
+
|
|
6511
|
+
id: Optional[str] = Field(None, description="Unique identifier")
|
|
6512
|
+
uuid: Optional[str] = None
|
|
6513
|
+
properties: Dict[str, Any] = Field(default_factory=dict, description="Feature properties (JSON map)")
|
|
6514
|
+
feature_type: Optional[KnowledgeFeatureType] = Field(None, alias="featureType", description="Type of this feature")
|
|
6515
|
+
organization: Optional[Dict[str, Any]] = Field(None, description="Organization reference")
|
|
6516
|
+
active: bool = Field(True, description="Is feature active")
|
|
6517
|
+
search_text: Optional[str] = Field(None, alias="searchText", description="Generated search text from properties")
|
|
6518
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
|
6519
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
|
6520
|
+
|
|
6521
|
+
|
|
6522
|
+
class KnowledgeItemType(BaseModel):
|
|
6523
|
+
"""Defines types of knowledge items"""
|
|
6524
|
+
model_config = ConfigDict(
|
|
6525
|
+
populate_by_name=True,
|
|
6526
|
+
use_enum_values=True,
|
|
6527
|
+
arbitrary_types_allowed=True,
|
|
6528
|
+
protected_namespaces=("model_config",),
|
|
6529
|
+
)
|
|
6530
|
+
|
|
6531
|
+
id: Optional[str] = Field(None, description="Unique identifier")
|
|
6532
|
+
uuid: Optional[str] = None
|
|
6533
|
+
name: str = Field(..., description="Item type name")
|
|
6534
|
+
slug: str = Field(..., description="URL-safe identifier")
|
|
6535
|
+
description: Optional[str] = Field(None, description="Type description")
|
|
6536
|
+
options: Optional[List[Dict[str, Any]]] = Field(default_factory=list, description="Configuration options")
|
|
6537
|
+
organization: Optional[Dict[str, Any]] = Field(None, description="Organization reference")
|
|
6538
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
|
6539
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
|
6540
|
+
|
|
6541
|
+
|
|
6542
|
+
class KnowledgeItem(BaseModel):
|
|
6543
|
+
"""Represents a reusable knowledge unit"""
|
|
6544
|
+
model_config = ConfigDict(
|
|
6545
|
+
populate_by_name=True,
|
|
6546
|
+
use_enum_values=True,
|
|
6547
|
+
arbitrary_types_allowed=True,
|
|
6548
|
+
protected_namespaces=("model_config",),
|
|
6549
|
+
)
|
|
6550
|
+
|
|
6551
|
+
id: Optional[str] = Field(None, description="Unique identifier")
|
|
6552
|
+
uuid: Optional[str] = None
|
|
6553
|
+
title: Optional[str] = Field(None, description="Item title")
|
|
6554
|
+
description: Optional[str] = Field(None, description="Item description")
|
|
6555
|
+
knowledge_item_type: Optional[KnowledgeItemType] = Field(None, alias="knowledgeItemType", description="Type of this item")
|
|
6556
|
+
knowledge_set_id: Optional[str] = Field(None, alias="knowledgeSetId", description="Parent set ID if in a set")
|
|
6557
|
+
properties: Dict[str, Any] = Field(default_factory=dict, description="Item properties (JSON map)")
|
|
6558
|
+
sequence_order: Optional[int] = Field(None, alias="sequenceOrder", description="Order within parent set")
|
|
6559
|
+
active: bool = Field(True, description="Is item active")
|
|
6560
|
+
search_text: Optional[str] = Field(None, alias="searchText", description="Generated search text from title/description")
|
|
6561
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
|
6562
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
|
6563
|
+
|
|
6564
|
+
|
|
6565
|
+
class KnowledgeSet(BaseModel):
|
|
6566
|
+
"""Composite set of knowledge items with feature matching"""
|
|
6567
|
+
model_config = ConfigDict(
|
|
6568
|
+
populate_by_name=True,
|
|
6569
|
+
use_enum_values=True,
|
|
6570
|
+
arbitrary_types_allowed=True,
|
|
6571
|
+
protected_namespaces=("model_config",),
|
|
6572
|
+
)
|
|
6573
|
+
|
|
6574
|
+
id: Optional[str] = Field(None, description="Unique identifier")
|
|
6575
|
+
uuid: Optional[str] = None
|
|
6576
|
+
name: str = Field(..., description="Set name")
|
|
6577
|
+
description: Optional[str] = Field(None, description="Set description")
|
|
6578
|
+
set_type: Optional[str] = Field(None, alias="setType", description="Type classification of the set")
|
|
6579
|
+
knowledge_items: List[KnowledgeItem] = Field(default_factory=list, alias="knowledgeItems", description="Items in this set (ordered by sequenceOrder)")
|
|
6580
|
+
features: List[KnowledgeFeature] = Field(default_factory=list, description="Features associated with this set")
|
|
6581
|
+
organization: Optional[Dict[str, Any]] = Field(None, description="Organization reference")
|
|
6582
|
+
project: Optional[Dict[str, Any]] = Field(None, description="Project reference")
|
|
6583
|
+
status: KnowledgeSetStatus = Field(KnowledgeSetStatus.PENDING_REVIEW, description="Lifecycle status")
|
|
6584
|
+
active: bool = Field(False, description="Is set active")
|
|
6585
|
+
search_text: Optional[str] = Field(None, alias="searchText", description="Generated search text")
|
|
6586
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
|
6587
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
|
6588
|
+
|
|
6589
|
+
|
|
6590
|
+
# Page models for pagination
|
|
6591
|
+
class PageKnowledgeFeatureType(BaseModel):
|
|
6592
|
+
"""Paginated response for KnowledgeFeatureType"""
|
|
6593
|
+
model_config = ConfigDict(
|
|
6594
|
+
populate_by_name=True,
|
|
6595
|
+
use_enum_values=True,
|
|
6596
|
+
arbitrary_types_allowed=True,
|
|
6597
|
+
protected_namespaces=("model_config",),
|
|
6598
|
+
)
|
|
6599
|
+
content: List[KnowledgeFeatureType] = Field(default_factory=list)
|
|
6600
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
|
6601
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
|
6602
|
+
number: Optional[int] = None
|
|
6603
|
+
size: Optional[int] = None
|
|
6604
|
+
first: Optional[bool] = None
|
|
6605
|
+
last: Optional[bool] = None
|
|
6606
|
+
|
|
6607
|
+
|
|
6608
|
+
class PageKnowledgeFeature(BaseModel):
|
|
6609
|
+
"""Paginated response for KnowledgeFeature"""
|
|
6610
|
+
model_config = ConfigDict(
|
|
6611
|
+
populate_by_name=True,
|
|
6612
|
+
use_enum_values=True,
|
|
6613
|
+
arbitrary_types_allowed=True,
|
|
6614
|
+
protected_namespaces=("model_config",),
|
|
6615
|
+
)
|
|
6616
|
+
content: List[KnowledgeFeature] = Field(default_factory=list)
|
|
6617
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
|
6618
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
|
6619
|
+
number: Optional[int] = None
|
|
6620
|
+
size: Optional[int] = None
|
|
6621
|
+
first: Optional[bool] = None
|
|
6622
|
+
last: Optional[bool] = None
|
|
6623
|
+
|
|
6624
|
+
|
|
6625
|
+
class PageKnowledgeItemType(BaseModel):
|
|
6626
|
+
"""Paginated response for KnowledgeItemType"""
|
|
6627
|
+
model_config = ConfigDict(
|
|
6628
|
+
populate_by_name=True,
|
|
6629
|
+
use_enum_values=True,
|
|
6630
|
+
arbitrary_types_allowed=True,
|
|
6631
|
+
protected_namespaces=("model_config",),
|
|
6632
|
+
)
|
|
6633
|
+
content: List[KnowledgeItemType] = Field(default_factory=list)
|
|
6634
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
|
6635
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
|
6636
|
+
number: Optional[int] = None
|
|
6637
|
+
size: Optional[int] = None
|
|
6638
|
+
first: Optional[bool] = None
|
|
6639
|
+
last: Optional[bool] = None
|
|
6640
|
+
|
|
6641
|
+
|
|
6642
|
+
class PageKnowledgeItem(BaseModel):
|
|
6643
|
+
"""Paginated response for KnowledgeItem"""
|
|
6644
|
+
model_config = ConfigDict(
|
|
6645
|
+
populate_by_name=True,
|
|
6646
|
+
use_enum_values=True,
|
|
6647
|
+
arbitrary_types_allowed=True,
|
|
6648
|
+
protected_namespaces=("model_config",),
|
|
6649
|
+
)
|
|
6650
|
+
content: List[KnowledgeItem] = Field(default_factory=list)
|
|
6651
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
|
6652
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
|
6653
|
+
number: Optional[int] = None
|
|
6654
|
+
size: Optional[int] = None
|
|
6655
|
+
first: Optional[bool] = None
|
|
6656
|
+
last: Optional[bool] = None
|
|
6657
|
+
|
|
6658
|
+
|
|
6659
|
+
class PageKnowledgeSet(BaseModel):
|
|
6660
|
+
"""Paginated response for KnowledgeSet"""
|
|
6661
|
+
model_config = ConfigDict(
|
|
6662
|
+
populate_by_name=True,
|
|
6663
|
+
use_enum_values=True,
|
|
6664
|
+
arbitrary_types_allowed=True,
|
|
6665
|
+
protected_namespaces=("model_config",),
|
|
6666
|
+
)
|
|
6667
|
+
content: List[KnowledgeSet] = Field(default_factory=list)
|
|
6668
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
|
6669
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
|
6670
|
+
number: Optional[int] = None
|
|
6671
|
+
size: Optional[int] = None
|
|
6672
|
+
first: Optional[bool] = None
|
|
6673
|
+
last: Optional[bool] = None
|
|
6674
|
+
|
|
6675
|
+
|
|
6467
6676
|
ThrowableProblem.model_rebuild()
|
|
6468
6677
|
Option.model_rebuild()
|
|
6469
6678
|
Taxon.model_rebuild()
|
|
@@ -6523,3 +6732,13 @@ MessageFeedbackResponse.model_rebuild()
|
|
|
6523
6732
|
MessageFeedbackOption.model_rebuild()
|
|
6524
6733
|
Note.model_rebuild()
|
|
6525
6734
|
PageNote.model_rebuild()
|
|
6735
|
+
KnowledgeFeatureType.model_rebuild()
|
|
6736
|
+
KnowledgeFeature.model_rebuild()
|
|
6737
|
+
KnowledgeItemType.model_rebuild()
|
|
6738
|
+
KnowledgeItem.model_rebuild()
|
|
6739
|
+
KnowledgeSet.model_rebuild()
|
|
6740
|
+
PageKnowledgeFeatureType.model_rebuild()
|
|
6741
|
+
PageKnowledgeFeature.model_rebuild()
|
|
6742
|
+
PageKnowledgeItemType.model_rebuild()
|
|
6743
|
+
PageKnowledgeItem.model_rebuild()
|
|
6744
|
+
PageKnowledgeSet.model_rebuild()
|
|
@@ -1369,6 +1369,51 @@ class SqliteDocumentPersistence(object):
|
|
|
1369
1369
|
return [ProcessingStep(**step) for step in unpacked_data]
|
|
1370
1370
|
return []
|
|
1371
1371
|
|
|
1372
|
+
def __ensure_knowledge_table_exists(self):
|
|
1373
|
+
"""
|
|
1374
|
+
Ensure the 'knowledge' table exists in the database.
|
|
1375
|
+
Creates the table if it does not exist.
|
|
1376
|
+
"""
|
|
1377
|
+
self.cursor.execute("""
|
|
1378
|
+
CREATE TABLE IF NOT EXISTS knowledge (
|
|
1379
|
+
obj BLOB
|
|
1380
|
+
)
|
|
1381
|
+
""")
|
|
1382
|
+
|
|
1383
|
+
# Check if the table has any rows, if not, insert an initial empty row
|
|
1384
|
+
result = self.cursor.execute("SELECT COUNT(*) FROM knowledge").fetchone()
|
|
1385
|
+
if result[0] == 0:
|
|
1386
|
+
self.cursor.execute("INSERT INTO knowledge (obj) VALUES (?)", [sqlite3.Binary(msgpack.packb([]))])
|
|
1387
|
+
|
|
1388
|
+
def set_knowledge(self, knowledge: List):
|
|
1389
|
+
"""
|
|
1390
|
+
Sets the knowledge items for the document.
|
|
1391
|
+
|
|
1392
|
+
Args:
|
|
1393
|
+
knowledge (List): A list of KnowledgeItem objects to store.
|
|
1394
|
+
"""
|
|
1395
|
+
from kodexa.model.objects import KnowledgeItem
|
|
1396
|
+
self.__ensure_knowledge_table_exists()
|
|
1397
|
+
serialized_knowledge = [item.model_dump(by_alias=True) for item in knowledge]
|
|
1398
|
+
packed_data = sqlite3.Binary(msgpack.packb(serialized_knowledge))
|
|
1399
|
+
self.cursor.execute("UPDATE knowledge SET obj = ? WHERE rowid = 1", [packed_data])
|
|
1400
|
+
self.connection.commit()
|
|
1401
|
+
|
|
1402
|
+
def get_knowledge(self) -> List:
|
|
1403
|
+
"""
|
|
1404
|
+
Gets the knowledge items associated with this document.
|
|
1405
|
+
|
|
1406
|
+
Returns:
|
|
1407
|
+
List: A list of KnowledgeItem objects.
|
|
1408
|
+
"""
|
|
1409
|
+
from kodexa.model.objects import KnowledgeItem
|
|
1410
|
+
self.__ensure_knowledge_table_exists()
|
|
1411
|
+
result = self.cursor.execute("SELECT obj FROM knowledge WHERE rowid = 1").fetchone()
|
|
1412
|
+
if result and result[0]:
|
|
1413
|
+
unpacked_data = msgpack.unpackb(result[0])
|
|
1414
|
+
return [KnowledgeItem(**item) for item in unpacked_data]
|
|
1415
|
+
return []
|
|
1416
|
+
|
|
1372
1417
|
|
|
1373
1418
|
class SimpleObjectCache(object):
|
|
1374
1419
|
"""
|
|
@@ -1518,6 +1563,22 @@ class PersistenceManager(object):
|
|
|
1518
1563
|
def set_steps(self, steps: list[ProcessingStep]):
|
|
1519
1564
|
self._underlying_persistence.set_steps(steps)
|
|
1520
1565
|
|
|
1566
|
+
def get_knowledge(self) -> list:
|
|
1567
|
+
"""
|
|
1568
|
+
Gets the knowledge items for this document
|
|
1569
|
+
|
|
1570
|
+
:return: list of KnowledgeItem objects
|
|
1571
|
+
"""
|
|
1572
|
+
return self._underlying_persistence.get_knowledge()
|
|
1573
|
+
|
|
1574
|
+
def set_knowledge(self, knowledge: list):
|
|
1575
|
+
"""
|
|
1576
|
+
Sets the knowledge items for this document
|
|
1577
|
+
|
|
1578
|
+
:param knowledge: list of KnowledgeItem objects
|
|
1579
|
+
"""
|
|
1580
|
+
self._underlying_persistence.set_knowledge(knowledge)
|
|
1581
|
+
|
|
1521
1582
|
def set_validations(self, validations: list[DocumentTaxonValidation]):
|
|
1522
1583
|
self._underlying_persistence.set_validations(validations)
|
|
1523
1584
|
|
|
@@ -108,6 +108,17 @@ from kodexa.model.objects import (
|
|
|
108
108
|
PageTaskTag,
|
|
109
109
|
Note,
|
|
110
110
|
PageNote,
|
|
111
|
+
KnowledgeFeatureType,
|
|
112
|
+
KnowledgeFeature,
|
|
113
|
+
KnowledgeItemType,
|
|
114
|
+
KnowledgeItem,
|
|
115
|
+
KnowledgeSet,
|
|
116
|
+
KnowledgeSetStatus,
|
|
117
|
+
PageKnowledgeFeatureType,
|
|
118
|
+
PageKnowledgeFeature,
|
|
119
|
+
PageKnowledgeItemType,
|
|
120
|
+
PageKnowledgeItem,
|
|
121
|
+
PageKnowledgeSet,
|
|
111
122
|
)
|
|
112
123
|
|
|
113
124
|
logger = logging.getLogger()
|
|
@@ -1467,6 +1478,158 @@ class PageNoteEndpoint(PageNote, PageEndpoint):
|
|
|
1467
1478
|
return "notes"
|
|
1468
1479
|
|
|
1469
1480
|
|
|
1481
|
+
# Knowledge Domain Endpoints
|
|
1482
|
+
|
|
1483
|
+
class KnowledgeFeatureTypeEndpoint(EntityEndpoint, KnowledgeFeatureType):
|
|
1484
|
+
"""
|
|
1485
|
+
Represents a knowledge feature type endpoint.
|
|
1486
|
+
"""
|
|
1487
|
+
def get_type(self) -> str:
|
|
1488
|
+
return "knowledge-feature-types"
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
class KnowledgeFeatureTypesEndpoint(EntitiesEndpoint):
|
|
1492
|
+
"""
|
|
1493
|
+
Represents knowledge feature types endpoints.
|
|
1494
|
+
"""
|
|
1495
|
+
def get_type(self) -> str:
|
|
1496
|
+
return "knowledge-feature-types"
|
|
1497
|
+
|
|
1498
|
+
def get_instance_class(self, object_dict=None):
|
|
1499
|
+
return KnowledgeFeatureTypeEndpoint
|
|
1500
|
+
|
|
1501
|
+
def get_page_class(self, object_dict=None):
|
|
1502
|
+
return PageKnowledgeFeatureTypeEndpoint
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
class PageKnowledgeFeatureTypeEndpoint(PageKnowledgeFeatureType, PageEndpoint):
|
|
1506
|
+
"""
|
|
1507
|
+
Represents a page knowledge feature type endpoint.
|
|
1508
|
+
"""
|
|
1509
|
+
def get_type(self) -> Optional[str]:
|
|
1510
|
+
return "knowledge-feature-types"
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
class KnowledgeFeatureEndpoint(EntityEndpoint, KnowledgeFeature):
|
|
1514
|
+
"""
|
|
1515
|
+
Represents a knowledge feature endpoint.
|
|
1516
|
+
"""
|
|
1517
|
+
def get_type(self) -> str:
|
|
1518
|
+
return "knowledge-features"
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
class KnowledgeFeaturesEndpoint(EntitiesEndpoint):
|
|
1522
|
+
"""
|
|
1523
|
+
Represents knowledge features endpoints.
|
|
1524
|
+
"""
|
|
1525
|
+
def get_type(self) -> str:
|
|
1526
|
+
return "knowledge-features"
|
|
1527
|
+
|
|
1528
|
+
def get_instance_class(self, object_dict=None):
|
|
1529
|
+
return KnowledgeFeatureEndpoint
|
|
1530
|
+
|
|
1531
|
+
def get_page_class(self, object_dict=None):
|
|
1532
|
+
return PageKnowledgeFeatureEndpoint
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
class PageKnowledgeFeatureEndpoint(PageKnowledgeFeature, PageEndpoint):
|
|
1536
|
+
"""
|
|
1537
|
+
Represents a page knowledge feature endpoint.
|
|
1538
|
+
"""
|
|
1539
|
+
def get_type(self) -> Optional[str]:
|
|
1540
|
+
return "knowledge-features"
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
class KnowledgeItemTypeEndpoint(EntityEndpoint, KnowledgeItemType):
|
|
1544
|
+
"""
|
|
1545
|
+
Represents a knowledge item type endpoint.
|
|
1546
|
+
"""
|
|
1547
|
+
def get_type(self) -> str:
|
|
1548
|
+
return "knowledge-item-types"
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
class KnowledgeItemTypesEndpoint(EntitiesEndpoint):
|
|
1552
|
+
"""
|
|
1553
|
+
Represents knowledge item types endpoints.
|
|
1554
|
+
"""
|
|
1555
|
+
def get_type(self) -> str:
|
|
1556
|
+
return "knowledge-item-types"
|
|
1557
|
+
|
|
1558
|
+
def get_instance_class(self, object_dict=None):
|
|
1559
|
+
return KnowledgeItemTypeEndpoint
|
|
1560
|
+
|
|
1561
|
+
def get_page_class(self, object_dict=None):
|
|
1562
|
+
return PageKnowledgeItemTypeEndpoint
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
class PageKnowledgeItemTypeEndpoint(PageKnowledgeItemType, PageEndpoint):
|
|
1566
|
+
"""
|
|
1567
|
+
Represents a page knowledge item type endpoint.
|
|
1568
|
+
"""
|
|
1569
|
+
def get_type(self) -> Optional[str]:
|
|
1570
|
+
return "knowledge-item-types"
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
class KnowledgeItemEndpoint(EntityEndpoint, KnowledgeItem):
|
|
1574
|
+
"""
|
|
1575
|
+
Represents a knowledge item endpoint.
|
|
1576
|
+
"""
|
|
1577
|
+
def get_type(self) -> str:
|
|
1578
|
+
return "knowledge-items"
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
class KnowledgeItemsEndpoint(EntitiesEndpoint):
|
|
1582
|
+
"""
|
|
1583
|
+
Represents knowledge items endpoints.
|
|
1584
|
+
"""
|
|
1585
|
+
def get_type(self) -> str:
|
|
1586
|
+
return "knowledge-items"
|
|
1587
|
+
|
|
1588
|
+
def get_instance_class(self, object_dict=None):
|
|
1589
|
+
return KnowledgeItemEndpoint
|
|
1590
|
+
|
|
1591
|
+
def get_page_class(self, object_dict=None):
|
|
1592
|
+
return PageKnowledgeItemEndpoint
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
class PageKnowledgeItemEndpoint(PageKnowledgeItem, PageEndpoint):
|
|
1596
|
+
"""
|
|
1597
|
+
Represents a page knowledge item endpoint.
|
|
1598
|
+
"""
|
|
1599
|
+
def get_type(self) -> Optional[str]:
|
|
1600
|
+
return "knowledge-items"
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
class KnowledgeSetEndpoint(EntityEndpoint, KnowledgeSet):
|
|
1604
|
+
"""
|
|
1605
|
+
Represents a knowledge set endpoint.
|
|
1606
|
+
"""
|
|
1607
|
+
def get_type(self) -> str:
|
|
1608
|
+
return "knowledge-sets"
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
class KnowledgeSetsEndpoint(EntitiesEndpoint):
|
|
1612
|
+
"""
|
|
1613
|
+
Represents knowledge sets endpoints.
|
|
1614
|
+
"""
|
|
1615
|
+
def get_type(self) -> str:
|
|
1616
|
+
return "knowledge-sets"
|
|
1617
|
+
|
|
1618
|
+
def get_instance_class(self, object_dict=None):
|
|
1619
|
+
return KnowledgeSetEndpoint
|
|
1620
|
+
|
|
1621
|
+
def get_page_class(self, object_dict=None):
|
|
1622
|
+
return PageKnowledgeSetEndpoint
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
class PageKnowledgeSetEndpoint(PageKnowledgeSet, PageEndpoint):
|
|
1626
|
+
"""
|
|
1627
|
+
Represents a page knowledge set endpoint.
|
|
1628
|
+
"""
|
|
1629
|
+
def get_type(self) -> Optional[str]:
|
|
1630
|
+
return "knowledge-sets"
|
|
1631
|
+
|
|
1632
|
+
|
|
1470
1633
|
class PageTaskTemplateEndpoint(PageTask, PageEndpoint):
|
|
1471
1634
|
def get_type(self) -> Optional[str]:
|
|
1472
1635
|
return "taskTemplate"
|
|
@@ -6848,6 +7011,11 @@ class KodexaClient:
|
|
|
6848
7011
|
users (UsersEndpoint): An endpoint for users.
|
|
6849
7012
|
workspaces (WorkspacesEndpoint): An endpoint for workspaces.
|
|
6850
7013
|
notes (NotesEndpoint): An endpoint for notes.
|
|
7014
|
+
knowledge_feature_types (KnowledgeFeatureTypesEndpoint): An endpoint for knowledge feature types.
|
|
7015
|
+
knowledge_features (KnowledgeFeaturesEndpoint): An endpoint for knowledge features.
|
|
7016
|
+
knowledge_item_types (KnowledgeItemTypesEndpoint): An endpoint for knowledge item types.
|
|
7017
|
+
knowledge_items (KnowledgeItemsEndpoint): An endpoint for knowledge items.
|
|
7018
|
+
knowledge_sets (KnowledgeSetsEndpoint): An endpoint for knowledge sets.
|
|
6851
7019
|
"""
|
|
6852
7020
|
|
|
6853
7021
|
def __init__(self, url=None, access_token=None, profile=None):
|
|
@@ -6879,6 +7047,11 @@ class KodexaClient:
|
|
|
6879
7047
|
self.workspaces = WorkspacesEndpoint(self)
|
|
6880
7048
|
self.data_exceptions = DataExceptionsEndpoint(self)
|
|
6881
7049
|
self.notes = NotesEndpoint(self)
|
|
7050
|
+
self.knowledge_feature_types = KnowledgeFeatureTypesEndpoint(self)
|
|
7051
|
+
self.knowledge_features = KnowledgeFeaturesEndpoint(self)
|
|
7052
|
+
self.knowledge_item_types = KnowledgeItemTypesEndpoint(self)
|
|
7053
|
+
self.knowledge_items = KnowledgeItemsEndpoint(self)
|
|
7054
|
+
self.knowledge_sets = KnowledgeSetsEndpoint(self)
|
|
6882
7055
|
self.model_costs = ModelCostsEndpoint(self)
|
|
6883
7056
|
|
|
6884
7057
|
@staticmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "kodexa"
|
|
3
|
-
version = "7.4.
|
|
3
|
+
version = "7.4.418571517744"
|
|
4
4
|
description = "Python SDK for the Kodexa Platform"
|
|
5
5
|
authors = ["Austin Redenbaugh <austin@kodexa.com>", "Philip Dodds <philip@kodexa.com>", "Romar Cablao <rcablao@kodexa.com>", "Amadea Paula Dodds <amadeapaula@kodexa.com>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/dataclasses/templates/llm_data_class.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kodexa-7.4.418502378964 → kodexa-7.4.418571517744}/kodexa/model/entities/product_subscription.py
RENAMED
|
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
|