kodexa 7.4.416789395760__py3-none-any.whl → 7.4.416803490107__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.
kodexa/model/objects.py CHANGED
@@ -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
 
kodexa/platform/client.py CHANGED
@@ -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,
@@ -6761,6 +6762,38 @@ class ExtractionEngineEndpoint:
6761
6762
  return response.text
6762
6763
 
6763
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
+
6764
6797
  class KodexaClient:
6765
6798
  """
6766
6799
  A class to represent a Kodexa client.
@@ -6816,6 +6849,7 @@ class KodexaClient:
6816
6849
  self.workspaces = WorkspacesEndpoint(self)
6817
6850
  self.data_exceptions = DataExceptionsEndpoint(self)
6818
6851
  self.notes = NotesEndpoint(self)
6852
+ self.model_costs = ModelCostsEndpoint(self)
6819
6853
 
6820
6854
  @staticmethod
6821
6855
  def login(url, token):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kodexa
3
- Version: 7.4.416789395760
3
+ Version: 7.4.416803490107
4
4
  Summary: Python SDK for the Kodexa Platform
5
5
  Author: Austin Redenbaugh
6
6
  Author-email: austin@kodexa.com
@@ -13,13 +13,13 @@ kodexa/model/entities/product.py,sha256=StUhTEeLXmc05cj6XnZppQfeJsqCPbX1jdhsysHH
13
13
  kodexa/model/entities/product_group.py,sha256=540fRGyUf34h1BzAN1DiWu6rGgvaj3xDFhZ2k-RvSFY,3617
14
14
  kodexa/model/entities/product_subscription.py,sha256=UcmWR-qgLfdV7VCtJNwzgkanoS8nBSL6ngVuxQUK1M8,3810
15
15
  kodexa/model/model.py,sha256=o93SDgw8mj28LWbwJB78PF_Oim8qeCTH1a9x_GDc7yg,120895
16
- kodexa/model/objects.py,sha256=ohdZxUztBujnEK9Vn7t8xnO_YFZPuLEUqB_jOMsK4fY,204018
16
+ kodexa/model/objects.py,sha256=dcnsvijSDFEHghfib1Cx4xOtLMQe0It8GbLxZ_Pd1ic,204947
17
17
  kodexa/model/persistence.py,sha256=jUgQ8xwsAFIoZ_bEynxCDEWhUII42eN0e0Mum0dkQPg,72043
18
18
  kodexa/model/utils.py,sha256=YEG3f8YzBil06D0P3_dfx2S9GnHREzyrjnlWwQ7oPlU,3038
19
19
  kodexa/pipeline/__init__.py,sha256=sA7f5D6qkdMrpp2xTIeefnrUBI6xxEEWostvxfX_1Cs,236
20
20
  kodexa/pipeline/pipeline.py,sha256=zyNEpA7KlGhPs_l-vgV6m-OCb16dbxQhl8QezeylugA,25540
21
21
  kodexa/platform/__init__.py,sha256=1O3oiWMg292NPL_NacKDnK1T3_R6cMorrPRue_9e-O4,216
22
- kodexa/platform/client.py,sha256=hfSD87kbtLXf3oho_MULQbnaQGJYmxqISjfAc_MJkjY,237773
22
+ kodexa/platform/client.py,sha256=e1siGyF3Pwa9VDLBUjudErVL18FYF6VyUjKFBytCEkE,238862
23
23
  kodexa/platform/interaction.py,sha256=6zpcwXKNZstUGNS6m4JsoRXAqCZPJHWI-ZN3co8nnF0,1055
24
24
  kodexa/platform/kodexa.py,sha256=2s7Ez7_o-ywpNwbTRhtOUaQKtB9hKsDC_oJHaskXw-I,35315
25
25
  kodexa/platform/manifest.py,sha256=ThjQOk0xbP0qACcpS8NM6-zQL_Emd_bv4QAW2FpbUWk,19454
@@ -45,7 +45,7 @@ kodexa/testing/test_utils.py,sha256=v44p__gE7ia67W7WeHN2HBFCWSCUrCZt7G4xBNCmwf8,
45
45
  kodexa/training/__init__.py,sha256=xs2L62YpRkIRfslQwtQZ5Yxjhm7sLzX2TrVX6EuBnZQ,52
46
46
  kodexa/training/train_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  kodexa/utils/__init__.py,sha256=Pnim1o9_db5YEnNvDTxpM7HG-qTlL6n8JwFwOafU9wo,5928
48
- kodexa-7.4.416789395760.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
49
- kodexa-7.4.416789395760.dist-info/METADATA,sha256=uv7xYEa5omirE0VBlMzM6Nd5i_fIpQmQvUPaMxBBX88,2916
50
- kodexa-7.4.416789395760.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
51
- kodexa-7.4.416789395760.dist-info/RECORD,,
48
+ kodexa-7.4.416803490107.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
49
+ kodexa-7.4.416803490107.dist-info/METADATA,sha256=VozbjXwyzKTXhGBmZmj8phXX07m81WzxIO1aN6St7Ss,2916
50
+ kodexa-7.4.416803490107.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
51
+ kodexa-7.4.416803490107.dist-info/RECORD,,