maitai-python 1.1.8__tar.gz → 1.1.9__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.
Files changed (48) hide show
  1. {maitai_python-1.1.8 → maitai_python-1.1.9}/PKG-INFO +1 -1
  2. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_utils.py +3 -1
  3. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/tools/__init__.py +7 -3
  4. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/version.py +1 -1
  5. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/chat/__init__.py +24 -1
  6. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/sentinel/__init__.py +14 -0
  7. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_python.egg-info/PKG-INFO +1 -1
  8. {maitai_python-1.1.8 → maitai_python-1.1.9}/README.md +0 -0
  9. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/__init__.py +0 -0
  10. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_azure.py +0 -0
  11. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_config.py +0 -0
  12. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_config_listener_thread.py +0 -0
  13. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_context.py +0 -0
  14. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_evaluator.py +0 -0
  15. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_inference.py +0 -0
  16. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_maitai.py +0 -0
  17. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_maitai_async.py +0 -0
  18. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_maitai_client.py +0 -0
  19. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai/_types.py +0 -0
  20. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/__init__.py +0 -0
  21. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/config/__init__.py +0 -0
  22. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/config/config_service.py +0 -0
  23. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/processes/__init__.py +0 -0
  24. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/processes/io_thread.py +0 -0
  25. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/processes/websocket_listener_thread.py +0 -0
  26. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/utils/__init__.py +0 -0
  27. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/utils/proto_utils.py +0 -0
  28. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_common/utils/types.py +0 -0
  29. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/__init__.py +0 -0
  30. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/application/__init__.py +0 -0
  31. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/backtest/__init__.py +0 -0
  32. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/company/__init__.py +0 -0
  33. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/config/__init__.py +0 -0
  34. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/embedding/__init__.py +0 -0
  35. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/event/__init__.py +0 -0
  36. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/inference/__init__.py +0 -0
  37. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/key/__init__.py +0 -0
  38. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/metric/__init__.py +0 -0
  39. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/model/__init__.py +0 -0
  40. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/notification/__init__.py +0 -0
  41. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/sandbox/__init__.py +0 -0
  42. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_gen/session/__init__.py +0 -0
  43. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_python.egg-info/SOURCES.txt +0 -0
  44. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_python.egg-info/dependency_links.txt +0 -0
  45. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_python.egg-info/requires.txt +0 -0
  46. {maitai_python-1.1.8 → maitai_python-1.1.9}/maitai_python.egg-info/top_level.txt +0 -0
  47. {maitai_python-1.1.8 → maitai_python-1.1.9}/setup.cfg +0 -0
  48. {maitai_python-1.1.8 → maitai_python-1.1.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.1.8
3
+ Version: 1.1.9
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -110,7 +110,7 @@ def get_chat_completion_params(*,
110
110
  max_tokens: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
111
111
  n: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
112
112
  presence_penalty: Union[Optional[float], openai.NotGiven] = openai.NOT_GIVEN,
113
- response_format: Union[openai_types.completion_create_params.ResponseFormat, openai.NotGiven] = openai.NOT_GIVEN,
113
+ response_format: Union[openai_types.completion_create_params.ResponseFormat, chat_types.ResponseFormat, openai.NotGiven] = openai.NOT_GIVEN,
114
114
  seed: Union[Optional[int], openai.NotGiven] = openai.NOT_GIVEN,
115
115
  stop: Union[Union[Optional[str], List[str]], openai.NotGiven] = openai.NOT_GIVEN,
116
116
  stream: Optional[bool] = False,
@@ -153,6 +153,8 @@ def get_chat_completion_params(*,
153
153
 
154
154
  if response_format != openai.NOT_GIVEN:
155
155
  params.response_format = chat_types.ResponseFormat(type=response_format["type"])
156
+ if response_format.get("json_schema"):
157
+ params.response_format.json_schema = chat_types.JsonSchema().from_dict(response_format["json_schema"])
156
158
 
157
159
  if tools != openai.NOT_GIVEN:
158
160
  params.tools = []
@@ -31,7 +31,10 @@ class Tools:
31
31
  return function_response
32
32
 
33
33
 
34
- def tool(func):
34
+ def tool(func=None, strict=True):
35
+ if func is None:
36
+ return lambda f: tool(f, strict=strict)
37
+
35
38
  function_description = func.__doc__
36
39
  if not function_description:
37
40
  raise ValueError("Missing docstring for tool")
@@ -61,18 +64,19 @@ def tool(func):
61
64
  "type": _parse_type(param_type),
62
65
  "description": param_descriptions.get(param_name, ""),
63
66
  }
64
- if param.default is param.empty:
65
- required.append(param_name)
67
+ required.append(param_name)
66
68
 
67
69
  wrapper.__tool__ = Tool(
68
70
  type="function",
69
71
  function=Function(
70
72
  name=func.__name__,
73
+ strict=strict,
71
74
  description=function_description,
72
75
  parameters={
73
76
  "type": "object",
74
77
  "properties": properties,
75
78
  "required": required,
79
+ "additionalProperties": False,
76
80
  },
77
81
  )
78
82
  )
@@ -1,3 +1,3 @@
1
- version = "1.1.8"
1
+ version = "1.1.9"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -122,6 +122,9 @@ class ChatCompletionParams(betterproto.Message):
122
122
  @dataclass(eq=False, repr=False)
123
123
  class ResponseFormat(betterproto.Message):
124
124
  type: str = betterproto.string_field(1)
125
+ json_schema: Optional["JsonSchema"] = betterproto.message_field(
126
+ 2, optional=True, group="_json_schema"
127
+ )
125
128
 
126
129
 
127
130
  @dataclass(eq=False, repr=False)
@@ -142,6 +145,16 @@ class Function(betterproto.Message):
142
145
  parameters: Dict[str, str] = betterproto.map_field(
143
146
  3, betterproto.TYPE_STRING, betterproto.TYPE_STRING
144
147
  )
148
+ strict: bool = betterproto.bool_field(4)
149
+
150
+
151
+ @dataclass(eq=False, repr=False)
152
+ class JsonSchema(betterproto.Message):
153
+ name: str = betterproto.string_field(1)
154
+ strict: bool = betterproto.bool_field(2)
155
+ schema: Dict[str, str] = betterproto.map_field(
156
+ 3, betterproto.TYPE_STRING, betterproto.TYPE_STRING
157
+ )
145
158
 
146
159
 
147
160
  @dataclass(eq=False, repr=False)
@@ -206,6 +219,7 @@ class ChatCompletionMessage(betterproto.Message):
206
219
  3, optional=True, group="_function_call"
207
220
  )
208
221
  tool_calls: List["ToolCall"] = betterproto.message_field(4)
222
+ refusal: str = betterproto.string_field(5)
209
223
 
210
224
 
211
225
  @dataclass(eq=False, repr=False)
@@ -252,6 +266,7 @@ class ChoiceDelta(betterproto.Message):
252
266
  role: str = betterproto.string_field(2)
253
267
  tool_calls: List["ToolCall"] = betterproto.message_field(3)
254
268
  function_call: "FunctionCall" = betterproto.message_field(4)
269
+ refusal: str = betterproto.string_field(6)
255
270
 
256
271
 
257
272
  @dataclass(eq=False, repr=False)
@@ -271,6 +286,7 @@ class ToolCallFunction(betterproto.Message):
271
286
  @dataclass(eq=False, repr=False)
272
287
  class LogProbs(betterproto.Message):
273
288
  content: List["LogPropsContent"] = betterproto.message_field(1)
289
+ refusal: List["LogPropsContent"] = betterproto.message_field(2)
274
290
 
275
291
 
276
292
  @dataclass(eq=False, repr=False)
@@ -278,7 +294,14 @@ class LogPropsContent(betterproto.Message):
278
294
  token: str = betterproto.string_field(1)
279
295
  logprob: float = betterproto.double_field(2)
280
296
  bytes: List[int] = betterproto.int32_field(3)
281
- top_logprobs: List["LogProbs"] = betterproto.message_field(4)
297
+ top_logprobs: List["TopLogProbs"] = betterproto.message_field(4)
298
+
299
+
300
+ @dataclass(eq=False, repr=False)
301
+ class TopLogProbs(betterproto.Message):
302
+ token: str = betterproto.string_field(1)
303
+ logprob: float = betterproto.double_field(2)
304
+ bytes: List[float] = betterproto.double_field(3)
282
305
 
283
306
 
284
307
  @dataclass(eq=False, repr=False)
@@ -32,6 +32,7 @@ class Sentinel(betterproto.Message):
32
32
  meta: Dict[str, str] = betterproto.map_field(
33
33
  9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
34
34
  )
35
+ sentinel_generation_id: int = betterproto.int64_field(10)
35
36
 
36
37
 
37
38
  @dataclass(eq=False, repr=False)
@@ -53,3 +54,16 @@ class DirectiveBody(betterproto.Message):
53
54
  class SentinelExample(betterproto.Message):
54
55
  example_type: str = betterproto.string_field(1)
55
56
  example_body: str = betterproto.string_field(2)
57
+
58
+
59
+ @dataclass(eq=False, repr=False)
60
+ class SentinelGeneration(betterproto.Message):
61
+ id: int = betterproto.int64_field(1)
62
+ date_created: int = betterproto.int64_field(2)
63
+ company_id: int = betterproto.int64_field(3)
64
+ application_id: int = betterproto.int64_field(4)
65
+ application_action_id: int = betterproto.int64_field(5)
66
+ base_prompt: str = betterproto.string_field(6)
67
+ meta: Dict[str, str] = betterproto.map_field(
68
+ 7, betterproto.TYPE_STRING, betterproto.TYPE_STRING
69
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.1.8
3
+ Version: 1.1.9
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
File without changes
File without changes
File without changes