kodexa 7.4.416648957029__tar.gz → 7.4.416803490107__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.
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/PKG-INFO +1 -1
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/objects.py +22 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/platform/client.py +40 -4
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/pyproject.toml +1 -1
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/LICENSE +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/README.md +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/assistant/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/assistant/assistant.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/connectors/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/connectors/connectors.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/dataclasses/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/dataclasses/templates/llm_data_class.j2 +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/base.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/entities/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/entities/check_response.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/entities/product.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/entities/product_group.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/entities/product_subscription.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/model.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/persistence.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/model/utils.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/pipeline/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/pipeline/pipeline.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/platform/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/platform/interaction.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/platform/kodexa.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/platform/manifest.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/ast.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/core.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/lexrules.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/lextab.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/lextab.pyi +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/parserules.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/parserules.pyi +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/parsetab.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/selectors/parsetab.pyi +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/spatial/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/spatial/azure_models.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/spatial/bbox_common.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/spatial/table_form_common.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/steps/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/steps/common.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/testing/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/testing/test_components.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/testing/test_utils.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/training/__init__.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/training/train_utils.py +0 -0
- {kodexa-7.4.416648957029 → kodexa-7.4.416803490107}/kodexa/utils/__init__.py +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
from decimal import Decimal
|
3
4
|
from enum import Enum
|
4
5
|
from typing import Optional, List, Dict, Any, Set
|
5
6
|
from typing import Union
|
@@ -4873,6 +4874,27 @@ class ModelUsage(BaseModel):
|
|
4873
4874
|
interactions: Optional[List[ModelInteraction]] = None
|
4874
4875
|
|
4875
4876
|
|
4877
|
+
class AggregatedModelCost(BaseModel):
|
4878
|
+
"""
|
4879
|
+
Represents an aggregated view of model costs grouped by modelId.
|
4880
|
+
This class holds the sum of various token counts and other metrics.
|
4881
|
+
"""
|
4882
|
+
model_config = ConfigDict(
|
4883
|
+
populate_by_name=True,
|
4884
|
+
use_enum_values=True,
|
4885
|
+
arbitrary_types_allowed=True,
|
4886
|
+
protected_namespaces=("model_config",),
|
4887
|
+
)
|
4888
|
+
|
4889
|
+
model_id: Optional[str] = Field(None, alias="modelId")
|
4890
|
+
total_input_tokens: Optional[int] = Field(None, alias="totalInputTokens")
|
4891
|
+
total_output_tokens: Optional[int] = Field(None, alias="totalOutputTokens")
|
4892
|
+
total_thinking_tokens: Optional[int] = Field(None, alias="totalThinkingTokens")
|
4893
|
+
total_cached_tokens: Optional[int] = Field(None, alias="totalCachedTokens")
|
4894
|
+
total_duration: Optional[int] = Field(None, alias="totalDuration")
|
4895
|
+
total_cost: Optional[Decimal] = Field(None, alias="totalCost")
|
4896
|
+
|
4897
|
+
|
4876
4898
|
class ExecutionEvent(BaseModel):
|
4877
4899
|
"""
|
4878
4900
|
|
@@ -25,6 +25,7 @@ from pydantic_yaml import to_yaml_str
|
|
25
25
|
from kodexa.model import Document
|
26
26
|
from kodexa.model.model import Ref
|
27
27
|
from kodexa.model.objects import (
|
28
|
+
AggregatedModelCost,
|
28
29
|
PageUser,
|
29
30
|
PageMembership,
|
30
31
|
PageExecution,
|
@@ -5934,7 +5935,7 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5934
5935
|
get_response.json()
|
5935
5936
|
).set_client(self.client)
|
5936
5937
|
|
5937
|
-
def stream_filter(self, filter_string: str = "", sort=None, limit=None, page_size=5):
|
5938
|
+
def stream_filter(self, filter_string: str = "", sort=None, limit=None, page_size=5, starting_offset: int = 0):
|
5938
5939
|
"""
|
5939
5940
|
Stream the filter for the document family.
|
5940
5941
|
|
@@ -5943,11 +5944,12 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5943
5944
|
sort (str, optional): Sorting order of the query. Defaults to None.
|
5944
5945
|
limit (int, optional): The maximum number of items to return. Defaults to None.
|
5945
5946
|
page_size (int, optional): The pagination size for the streaming
|
5947
|
+
starting_offset (int, optional): The starting offset for the streaming
|
5946
5948
|
|
5947
5949
|
Returns:
|
5948
5950
|
generator: A generator of the document families.
|
5949
5951
|
"""
|
5950
|
-
page = 1
|
5952
|
+
page = starting_offset // page_size + 1
|
5951
5953
|
count = 0
|
5952
5954
|
if not sort:
|
5953
5955
|
sort = "id"
|
@@ -5968,7 +5970,7 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5968
5970
|
page += 1
|
5969
5971
|
|
5970
5972
|
def filter(
|
5971
|
-
self, filter_string: str = "", page: int = 1, page_size: int = 100, sort=None
|
5973
|
+
self, filter_string: str = "", page: int = 1, page_size: int = 100, sort=None, starting_offset: int = 0
|
5972
5974
|
) -> PageDocumentFamilyEndpoint:
|
5973
5975
|
"""
|
5974
5976
|
Filter the document family.
|
@@ -5978,10 +5980,11 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5978
5980
|
page (int, optional): The page number to get. Defaults to 1.
|
5979
5981
|
page_size (int, optional): The number of items per page. Defaults to 100.
|
5980
5982
|
sort (str, optional): Sorting order of the query. Defaults to None.
|
5981
|
-
|
5983
|
+
starting_offset (int, optional): The starting offset for the filter (offset is 0-indexed, and over-rides the page parameter)
|
5982
5984
|
Returns:
|
5983
5985
|
PageDocumentFamilyEndpoint: The page of document families.
|
5984
5986
|
"""
|
5987
|
+
page = starting_offset // page_size + 1
|
5985
5988
|
params = {"page": page, "pageSize": page_size, "filter": filter_string}
|
5986
5989
|
|
5987
5990
|
if sort is not None:
|
@@ -6759,6 +6762,38 @@ class ExtractionEngineEndpoint:
|
|
6759
6762
|
return response.text
|
6760
6763
|
|
6761
6764
|
|
6765
|
+
class ModelCostsEndpoint:
|
6766
|
+
"""
|
6767
|
+
Provides endpoint access to the model costs.
|
6768
|
+
|
6769
|
+
Attributes:
|
6770
|
+
client (KodexaClient): The client to interact with the model costs.
|
6771
|
+
"""
|
6772
|
+
|
6773
|
+
def __init__(self, client: "KodexaClient"):
|
6774
|
+
self.client = client
|
6775
|
+
|
6776
|
+
def get_model_costs(self, filters: Optional[List[str]] = None) -> List[AggregatedModelCost]:
|
6777
|
+
"""
|
6778
|
+
Get aggregated model costs filtered by the provided query context.
|
6779
|
+
This endpoint aggregates the model costs by modelId.
|
6780
|
+
|
6781
|
+
Args:
|
6782
|
+
filters (Optional[List[str]]): The filters to apply to the model costs.
|
6783
|
+
|
6784
|
+
Returns:
|
6785
|
+
List[AggregatedModelCost]: A list of aggregated model costs.
|
6786
|
+
"""
|
6787
|
+
params = {}
|
6788
|
+
if filters is not None:
|
6789
|
+
params["filter"] = filters
|
6790
|
+
|
6791
|
+
response = self.client.get("/api/modelCosts", params=params)
|
6792
|
+
return [
|
6793
|
+
AggregatedModelCost.model_validate(item)
|
6794
|
+
for item in response.json()
|
6795
|
+
]
|
6796
|
+
|
6762
6797
|
class KodexaClient:
|
6763
6798
|
"""
|
6764
6799
|
A class to represent a Kodexa client.
|
@@ -6814,6 +6849,7 @@ class KodexaClient:
|
|
6814
6849
|
self.workspaces = WorkspacesEndpoint(self)
|
6815
6850
|
self.data_exceptions = DataExceptionsEndpoint(self)
|
6816
6851
|
self.notes = NotesEndpoint(self)
|
6852
|
+
self.model_costs = ModelCostsEndpoint(self)
|
6817
6853
|
|
6818
6854
|
@staticmethod
|
6819
6855
|
def login(url, token):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "kodexa"
|
3
|
-
version = "7.4.
|
3
|
+
version = "7.4.416803490107"
|
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.416648957029 → kodexa-7.4.416803490107}/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.416648957029 → kodexa-7.4.416803490107}/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
|
File without changes
|
File without changes
|