qwak-core 0.4.403__py3-none-any.whl → 0.4.405__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.
qwak/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Top-level package for qwak-core."""
2
2
 
3
3
  __author__ = "Qwak.ai"
4
- __version__ = "0.4.403"
4
+ __version__ = "0.4.405"
5
5
 
6
6
  from qwak.inner.di_configuration import wire_dependencies
7
7
  from qwak.model.experiment_tracking import log_metric, log_param
@@ -16,8 +16,6 @@
16
16
  from dataclasses import dataclass
17
17
  from typing import List, Optional
18
18
 
19
- from typing_extensions import Literal
20
-
21
19
  from qwak.llmops.generation.base import ModelResponse
22
20
  from .chat_completion_message import ChatCompletionMessage
23
21
  from .chat_completion_token_logprob import ChatCompletionTokenLogprob
@@ -34,9 +32,7 @@ class ChoiceLogprobs:
34
32
 
35
33
  @dataclass
36
34
  class Choice:
37
- finish_reason: Literal[
38
- "stop", "length", "tool_calls", "content_filter", "function_call"
39
- ]
35
+ finish_reason: str
40
36
  """The reason the model stopped generating tokens.
41
37
 
42
38
  This will be `stop` if the model hit a natural stop point or a provided stop
@@ -55,6 +51,21 @@ class Choice:
55
51
  logprobs: Optional[ChoiceLogprobs] = None
56
52
  """Log probability information for the choice."""
57
53
 
54
+ def __post_init__(self):
55
+ """Validates that finish_reason is one of the allowed values."""
56
+ allowed_reasons = {
57
+ "stop",
58
+ "length",
59
+ "tool_calls",
60
+ "content_filter",
61
+ "function_call",
62
+ }
63
+ if self.finish_reason not in allowed_reasons:
64
+ raise ValueError(
65
+ f"Invalid finish_reason: '{self.finish_reason}'. "
66
+ f"Must be one of {allowed_reasons}"
67
+ )
68
+
58
69
 
59
70
  @dataclass
60
71
  class ChatCompletion(ModelResponse):
@@ -73,7 +84,7 @@ class ChatCompletion(ModelResponse):
73
84
  model: str
74
85
  """The model used for the chat completion."""
75
86
 
76
- object: Literal["chat.completion"]
87
+ object: str
77
88
  """The object type, which is always `chat.completion`."""
78
89
 
79
90
  system_fingerprint: Optional[str] = None
@@ -85,3 +96,10 @@ class ChatCompletion(ModelResponse):
85
96
 
86
97
  usage: Optional[CompletionUsage] = None
87
98
  """Usage statistics for the completion request."""
99
+
100
+ def __post_init__(self):
101
+ """Validates that the object type is correct."""
102
+ if self.object != "chat.completion":
103
+ raise ValueError(
104
+ f"Invalid object type: '{self.object}'. Must be 'chat.completion'"
105
+ )
@@ -16,8 +16,6 @@
16
16
  from dataclasses import dataclass
17
17
  from typing import List, Optional
18
18
 
19
- from typing_extensions import Literal
20
-
21
19
  from qwak.llmops.generation.base import ModelResponse
22
20
  from .chat_completion_token_logprob import ChatCompletionTokenLogprob
23
21
 
@@ -69,9 +67,16 @@ class ChoiceDeltaToolCall:
69
67
 
70
68
  function: Optional[ChoiceDeltaToolCallFunction] = None
71
69
 
72
- type: Optional[Literal["function"]] = None
70
+ type: Optional[str] = None
73
71
  """The type of the tool. Currently, only `function` is supported."""
74
72
 
73
+ def __post_init__(self):
74
+ """Validates that type is 'function' if present."""
75
+ if self.type is not None and self.type != "function":
76
+ raise ValueError(
77
+ f"Invalid type: '{self.type}'. Must be 'function' or None."
78
+ )
79
+
75
80
 
76
81
  @dataclass
77
82
  class ChoiceDelta:
@@ -85,11 +90,21 @@ class ChoiceDelta:
85
90
  model.
86
91
  """
87
92
 
88
- role: Optional[Literal["system", "user", "assistant", "tool"]] = None
93
+ role: Optional[str] = None
89
94
  """The role of the author of this message."""
90
95
 
91
96
  tool_calls: Optional[List[ChoiceDeltaToolCall]] = None
92
97
 
98
+ def __post_init__(self):
99
+ """Validates that role is one of the allowed values if present."""
100
+ if self.role is not None:
101
+ allowed_roles = {"system", "user", "assistant", "tool"}
102
+ if self.role not in allowed_roles:
103
+ raise ValueError(
104
+ f"Invalid role: '{self.role}'. "
105
+ f"Must be one of {allowed_roles} or None."
106
+ )
107
+
93
108
 
94
109
  @dataclass
95
110
  class ChoiceLogprobs:
@@ -105,9 +120,7 @@ class Choice:
105
120
  index: int
106
121
  """The index of the choice in the list of choices."""
107
122
 
108
- finish_reason: Optional[
109
- Literal["stop", "length", "tool_calls", "content_filter", "function_call"]
110
- ] = None
123
+ finish_reason: Optional[str] = None
111
124
  """The reason the model stopped generating tokens.
112
125
 
113
126
  This will be `stop` if the model hit a natural stop point or a provided stop
@@ -120,6 +133,22 @@ class Choice:
120
133
  logprobs: Optional[ChoiceLogprobs] = None
121
134
  """Log probability information for the choice."""
122
135
 
136
+ def __post_init__(self):
137
+ """Validates that finish_reason is one of the allowed values if present."""
138
+ if self.finish_reason is not None:
139
+ allowed_reasons = {
140
+ "stop",
141
+ "length",
142
+ "tool_calls",
143
+ "content_filter",
144
+ "function_call",
145
+ }
146
+ if self.finish_reason not in allowed_reasons:
147
+ raise ValueError(
148
+ f"Invalid finish_reason: '{self.finish_reason}'. "
149
+ f"Must be one of {allowed_reasons} or None."
150
+ )
151
+
123
152
 
124
153
  @dataclass
125
154
  class ChatCompletionChunk(ModelResponse):
@@ -141,7 +170,7 @@ class ChatCompletionChunk(ModelResponse):
141
170
  model: str
142
171
  """The model to generate the completion."""
143
172
 
144
- object: Literal["chat.completion.chunk"]
173
+ object: str
145
174
  """The object type, which is always `chat.completion.chunk`."""
146
175
 
147
176
  system_fingerprint: Optional[str] = None
@@ -150,3 +179,10 @@ class ChatCompletionChunk(ModelResponse):
150
179
  Can be used in conjunction with the `seed` request parameter to understand when
151
180
  backend changes have been made that might impact determinism.
152
181
  """
182
+
183
+ def __post_init__(self):
184
+ """Validates that the object type is correct."""
185
+ if self.object != "chat.completion.chunk":
186
+ raise ValueError(
187
+ f"Invalid object type: '{self.object}'. Must be 'chat.completion.chunk'"
188
+ )
@@ -16,8 +16,6 @@
16
16
  from dataclasses import dataclass
17
17
  from typing import List, Optional
18
18
 
19
- from typing_extensions import Literal
20
-
21
19
  from .chat_completion_message_tool_call import ChatCompletionMessageToolCall
22
20
 
23
21
  __all__ = ["ChatCompletionMessage", "FunctionCall"]
@@ -39,7 +37,7 @@ class FunctionCall:
39
37
 
40
38
  @dataclass
41
39
  class ChatCompletionMessage:
42
- role: Literal["assistant"]
40
+ role: str
43
41
  """The role of the author of this message."""
44
42
 
45
43
  content: Optional[str] = None
@@ -54,3 +52,8 @@ class ChatCompletionMessage:
54
52
 
55
53
  tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
56
54
  """The tool calls generated by the model, such as function calls."""
55
+
56
+ def __post_init__(self):
57
+ """Validates that the role type is correct."""
58
+ if self.role != "assistant":
59
+ raise ValueError(f"Invalid object type: '{self.role}'. Must be 'assistant'")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qwak-core
3
- Version: 0.4.403
3
+ Version: 0.4.405
4
4
  Summary: Qwak Core contains the necessary objects and communication tools for using the Qwak Platform
5
5
  License: Apache-2.0
6
6
  Keywords: mlops,ml,deployment,serving,model
@@ -22,7 +22,7 @@ Requires-Dist: PyYAML (>=6.0.2)
22
22
  Requires-Dist: cachetools
23
23
  Requires-Dist: chevron (==0.14.0)
24
24
  Requires-Dist: cloudpickle (==2.2.1) ; extra == "feature-store"
25
- Requires-Dist: dacite (==1.8.1)
25
+ Requires-Dist: dacite (==1.9.2)
26
26
  Requires-Dist: dependency-injector (>=4.0)
27
27
  Requires-Dist: filelock
28
28
  Requires-Dist: grpcio (>=1.71.2)
@@ -32,11 +32,11 @@ Requires-Dist: protobuf (>=4.25.8,<5)
32
32
  Requires-Dist: pyarrow (>=20.0.0) ; extra == "feature-store"
33
33
  Requires-Dist: pyathena (>=2.2.0,!=2.18.0) ; extra == "feature-store"
34
34
  Requires-Dist: pydantic
35
- Requires-Dist: pyspark (==3.4.2) ; extra == "feature-store"
35
+ Requires-Dist: pyspark (==3.5.7) ; extra == "feature-store"
36
36
  Requires-Dist: python-jose[cryptography] (>=3.4.0)
37
37
  Requires-Dist: python-json-logger (>=2.0.2)
38
38
  Requires-Dist: requests
39
- Requires-Dist: retrying (==1.3.4)
39
+ Requires-Dist: retrying (==1.4.2)
40
40
  Requires-Dist: tqdm
41
41
  Requires-Dist: typeguard (>=2,<3)
42
42
  Requires-Dist: typer
@@ -622,7 +622,7 @@ _qwak_proto/qwak/workspace/workspace_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXH
622
622
  _qwak_proto/qwak/workspace/workspace_service_pb2.py,sha256=93uNm83VVrkLG_XVsuBOBTPs4UJF91YD1xJTOEbRyig,9239
623
623
  _qwak_proto/qwak/workspace/workspace_service_pb2.pyi,sha256=nKKCHwnovZhsy8TSVmdz-Vtl0nviOOoX56HD-41Xo08,13726
624
624
  _qwak_proto/qwak/workspace/workspace_service_pb2_grpc.py,sha256=yKGuexxTBza99Ihe0DSTniV2ZSd_AG47inHenqfi890,27193
625
- qwak/__init__.py,sha256=jbJpnK5qaR8QUf28ZAElDwpseRvDwYcBf85PQMIs89c,587
625
+ qwak/__init__.py,sha256=9jl_ZNELtQVatPBtj2D-NKNFWYPVHaOnUSf8EEM8PJk,587
626
626
  qwak/automations/__init__.py,sha256=qFZRvCxUUn8gcxkJR0v19ulHW2oJ0x6-Rif7HiheDP4,1522
627
627
  qwak/automations/automation_executions.py,sha256=5MeH_epYYWb8NKXgAozwT_jPyyUDednBHG7izloi7RY,3228
628
628
  qwak/automations/automations.py,sha256=2Wyrgj2mW5VmJzTKAXj3vQM_svYCuq_Bsu3_Vu9SdR4,12732
@@ -895,13 +895,13 @@ qwak/llmops/generation/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
895
895
  qwak/llmops/generation/chat/openai/LICENSE.txt,sha256=d0M6HDjQ76tf255XPlAGkIoECMe688MXcGEYsOFySfI,11336
896
896
  qwak/llmops/generation/chat/openai/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
897
897
  qwak/llmops/generation/chat/openai/types/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
898
- qwak/llmops/generation/chat/openai/types/chat/chat_completion.py,sha256=GNabt8TN-N890KrZSUkwkG87aCYobVmtVZRpEV_1BKg,2922
898
+ qwak/llmops/generation/chat/openai/types/chat/chat_completion.py,sha256=tkrAUs112xAOVbwsYPZj0JIacGMNWAZ_7E1D_Hm0NN8,3519
899
899
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_assistant_message_param.py,sha256=Z-RpaLK5p7Mf87HXXEkhf7nIFsrq7GtJ-bZoAByat_k,2155
900
- qwak/llmops/generation/chat/openai/types/chat/chat_completion_chunk.py,sha256=K5yqRScwwgvQ_i67G63JKDJOOCqdHAa_md10XbYzw-k,4696
900
+ qwak/llmops/generation/chat/openai/types/chat/chat_completion_chunk.py,sha256=YeQx2PFkM0SqUPZE1QfsbdD3GeyWIC3sMcYgwm0dzbg,6045
901
901
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_content_part_text_param.py,sha256=N-880rUhsmzQX0gliLoc0GEzRYG6b999abPdiv5CeSc,945
902
902
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_function_call_option_param.py,sha256=T_dfvBpEupTdwHVxBX9nAJu5M0YmH7GNNwofQ-DT1kY,881
903
903
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_function_message_param.py,sha256=23WF1T86LoWrQaVg5DAASlxlpE82UUZYa58l3MlEF1Y,1108
904
- qwak/llmops/generation/chat/openai/types/chat/chat_completion_message.py,sha256=GjQx7m7cJ6HnjYewh83a51gDQBZfL45vS5BJAP0eZTw,1800
904
+ qwak/llmops/generation/chat/openai/types/chat/chat_completion_message.py,sha256=8DIPVH_HLwLxUtLY8hc85WvMb2vsktvXJ6aop9SmSPY,1955
905
905
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_message_param.py,sha256=wjJTJwOOZhFx8KgmBHl9iZJDMutzEma5R0q3FlJ2vUI,1354
906
906
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_message_tool_call.py,sha256=HrmsJw6D41H3a-8lNZsYRz0MJy3_8YGnX9-HEAYO3d4,1417
907
907
  qwak/llmops/generation/chat/openai/types/chat/chat_completion_message_tool_call_param.py,sha256=1PKfzKEV1WjtN7xkvGSLyS7H9wILM5LLQEbr5eg6Q2g,1525
@@ -1095,6 +1095,6 @@ qwak_services_mock/mocks/workspace_manager_service_mock.py,sha256=O9ZSwln4T4kHVk
1095
1095
  qwak_services_mock/services_mock.py,sha256=0BWwS2re9ryO3JrJJgSNyEQ0lDOjyrpV36oa8t7Pd7A,19163
1096
1096
  qwak_services_mock/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1097
1097
  qwak_services_mock/utils/service_utils.py,sha256=ZlB0CnB1J6oBn6_m7fQO2U8tKoboHdUa6ljjkRMYNXU,265
1098
- qwak_core-0.4.403.dist-info/METADATA,sha256=fY7VcDYvh5uQEGyspc7RGMLjrM8DA0hgng54VRMrTgo,2088
1099
- qwak_core-0.4.403.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1100
- qwak_core-0.4.403.dist-info/RECORD,,
1098
+ qwak_core-0.4.405.dist-info/METADATA,sha256=0AlgtO69BiHj6tBFUGDI32YjzE2SWlkYrpOoWiZoPgI,2088
1099
+ qwak_core-0.4.405.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1100
+ qwak_core-0.4.405.dist-info/RECORD,,