maitai-python 1.0.42b0__tar.gz → 1.0.43__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 (46) hide show
  1. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/PKG-INFO +3 -3
  2. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/README.md +1 -1
  3. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_maitai.py +9 -6
  4. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_maitai_async.py +9 -6
  5. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/version.py +1 -1
  6. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/chat/__init__.py +49 -0
  7. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/model/__init__.py +1 -0
  8. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_python.egg-info/PKG-INFO +3 -3
  9. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_python.egg-info/requires.txt +1 -1
  10. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/setup.py +1 -1
  11. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/__init__.py +0 -0
  12. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_azure.py +0 -0
  13. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_config.py +0 -0
  14. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_config_listener_thread.py +0 -0
  15. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_context.py +0 -0
  16. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_evaluator.py +0 -0
  17. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_inference.py +0 -0
  18. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_maitai_client.py +0 -0
  19. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_types.py +0 -0
  20. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/_utils.py +0 -0
  21. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai/tools/__init__.py +0 -0
  22. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/__init__.py +0 -0
  23. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/config/__init__.py +0 -0
  24. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/config/config_service.py +0 -0
  25. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/processes/__init__.py +0 -0
  26. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/processes/io_thread.py +0 -0
  27. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/processes/websocket_listener_thread.py +0 -0
  28. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/utils/__init__.py +0 -0
  29. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/utils/proto_utils.py +0 -0
  30. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_common/utils/types.py +0 -0
  31. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/__init__.py +0 -0
  32. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/application/__init__.py +0 -0
  33. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/company/__init__.py +0 -0
  34. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/config/__init__.py +0 -0
  35. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/embedding/__init__.py +0 -0
  36. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/event/__init__.py +0 -0
  37. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/inference/__init__.py +0 -0
  38. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/key/__init__.py +0 -0
  39. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/notification/__init__.py +0 -0
  40. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/sandbox/__init__.py +0 -0
  41. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/sentinel/__init__.py +0 -0
  42. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_gen/session/__init__.py +0 -0
  43. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_python.egg-info/SOURCES.txt +0 -0
  44. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_python.egg-info/dependency_links.txt +0 -0
  45. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/maitai_python.egg-info/top_level.txt +0 -0
  46. {maitai_python-1.0.42b0 → maitai_python-1.0.43}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.42b0
3
+ Version: 1.0.43
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: requests
13
- Requires-Dist: openai==1.34.0
13
+ Requires-Dist: openai>=1.34.0
14
14
  Requires-Dist: betterproto
15
15
  Requires-Dist: httpx
16
16
  Requires-Dist: aiohttp
@@ -56,4 +56,4 @@ Maitai requires `openai` version `1.30.1` or later. If you are using an older ve
56
56
  ## Run Your Application
57
57
 
58
58
  Run your application, make sure it makes at least one Chat Completion Request, then head over
59
- to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
59
+ to https://portal.trymaitai.ai and watch Maitai learn your application in real time.
@@ -37,4 +37,4 @@ Maitai requires `openai` version `1.30.1` or later. If you are using an older ve
37
37
  ## Run Your Application
38
38
 
39
39
  Run your application, make sure it makes at least one Chat Completion Request, then head over
40
- to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
40
+ to https://portal.trymaitai.ai and watch Maitai learn your application in real time.
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import uuid
2
3
  import warnings
3
4
  from typing import Dict, Iterable, List, Mapping, Optional, Union
4
5
 
@@ -92,12 +93,12 @@ class Completions:
92
93
  self.client = client
93
94
  self.client_params = client_params or ClientParams()
94
95
 
95
- @required_args(["session_id", "action_type", "application_ref_name", "messages"],
96
- ["session_id", "intent", "application_ref_name", "messages"],
97
- ["session_id", "action_type", "application_ref_name", "messages", "model"],
98
- ["session_id", "intent", "application_ref_name", "messages", "model"],
99
- ["session_id", "action_type", "application_ref_name", "messages", "model", "stream"],
100
- ["session_id", "intent", "application_ref_name", "messages", "model", "stream"])
96
+ @required_args(["action_type", "application_ref_name", "messages"],
97
+ ["intent", "application_ref_name", "messages"],
98
+ ["action_type", "application_ref_name", "messages", "model"],
99
+ ["intent", "application_ref_name", "messages", "model"],
100
+ ["action_type", "application_ref_name", "messages", "model", "stream"],
101
+ ["intent", "application_ref_name", "messages", "model", "stream"])
101
102
  def create(
102
103
  self,
103
104
  *,
@@ -150,6 +151,8 @@ class Completions:
150
151
  raise ValueError("server_side_inference must be true to apply_corrections")
151
152
  if apply_corrections is True and evaluation_enabled is False:
152
153
  raise ValueError("evaluations must be enabled to apply_corrections")
154
+ if not session_id:
155
+ session_id = str(uuid.uuid4())
153
156
  if not intent and action_type:
154
157
  intent = action_type
155
158
  maitai_config = config.get_application_action_config(application_ref_name, intent)
@@ -1,3 +1,4 @@
1
+ import uuid
1
2
  import warnings
2
3
  from typing import AsyncIterable, Dict, Iterable, List, Mapping, Optional, Union
3
4
 
@@ -91,12 +92,12 @@ class AsyncCompletions:
91
92
  self.client = client
92
93
  self.client_params = client_params or ClientParams()
93
94
 
94
- @required_args(["session_id", "action_type", "application_ref_name", "messages"],
95
- ["session_id", "intent", "application_ref_name", "messages"],
96
- ["session_id", "action_type", "application_ref_name", "messages", "model"],
97
- ["session_id", "intent", "application_ref_name", "messages", "model"],
98
- ["session_id", "action_type", "application_ref_name", "messages", "model", "stream"],
99
- ["session_id", "intent", "application_ref_name", "messages", "model", "stream"])
95
+ @required_args(["action_type", "application_ref_name", "messages"],
96
+ ["intent", "application_ref_name", "messages"],
97
+ ["action_type", "application_ref_name", "messages", "model"],
98
+ ["intent", "application_ref_name", "messages", "model"],
99
+ ["action_type", "application_ref_name", "messages", "model", "stream"],
100
+ ["intent", "application_ref_name", "messages", "model", "stream"])
100
101
  async def create(
101
102
  self,
102
103
  *,
@@ -147,6 +148,8 @@ class AsyncCompletions:
147
148
  raise ValueError("server_side_inference must be true to apply_corrections")
148
149
  if apply_corrections is True and evaluation_enabled is False:
149
150
  raise ValueError("evaluations must be enabled to apply_corrections")
151
+ if not session_id:
152
+ session_id = str(uuid.uuid4())
150
153
  if action_type and not intent:
151
154
  intent = action_type
152
155
  maitai_config = config.get_application_action_config(application_ref_name, intent)
@@ -1,3 +1,3 @@
1
- version = "1.0.42b0"
1
+ version = "1.0.43"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -40,6 +40,11 @@ class EvaluationContentType(betterproto.Enum):
40
40
  PARTIAL = 2
41
41
 
42
42
 
43
+ class PromptStatus(betterproto.Enum):
44
+ BENIGN = 0
45
+ MALICIOUS = 1
46
+
47
+
43
48
  @dataclass(eq=False, repr=False)
44
49
  class ChatCompletionRequest(betterproto.Message):
45
50
  params: "ChatCompletionParams" = betterproto.message_field(1)
@@ -166,6 +171,7 @@ class ChatCompletionResponse(betterproto.Message):
166
171
  service_tier: Optional[str] = betterproto.string_field(
167
172
  15, optional=True, group="_service_tier"
168
173
  )
174
+ input_safety_score: float = betterproto.float_field(16)
169
175
 
170
176
 
171
177
  @dataclass(eq=False, repr=False)
@@ -231,6 +237,7 @@ class ChatCompletionChunk(betterproto.Message):
231
237
  service_tier: Optional[str] = betterproto.string_field(
232
238
  10, optional=True, group="_service_tier"
233
239
  )
240
+ input_safety_score: float = betterproto.float_field(11)
234
241
 
235
242
 
236
243
  @dataclass(eq=False, repr=False)
@@ -352,6 +359,12 @@ class Turn(betterproto.Message):
352
359
  eval_request: "EvaluateRequest" = betterproto.message_field(3)
353
360
 
354
361
 
362
+ @dataclass(eq=False, repr=False)
363
+ class PromptguardResponse(betterproto.Message):
364
+ input_safety_score: float = betterproto.float_field(1)
365
+ status: "PromptStatus" = betterproto.enum_field(2)
366
+
367
+
355
368
  @dataclass(eq=False, repr=False)
356
369
  class SessionMessage(betterproto.Message):
357
370
  id: int = betterproto.int64_field(1)
@@ -418,6 +431,23 @@ class EvaluationServiceStub(betterproto.ServiceStub):
418
431
  metadata=metadata,
419
432
  )
420
433
 
434
+ async def evaluate_input(
435
+ self,
436
+ chat_completion_request: "ChatCompletionRequest",
437
+ *,
438
+ timeout: Optional[float] = None,
439
+ deadline: Optional["Deadline"] = None,
440
+ metadata: Optional["MetadataLike"] = None
441
+ ) -> "PromptguardResponse":
442
+ return await self._unary_unary(
443
+ "/chat.EvaluationService/EvaluateInput",
444
+ chat_completion_request,
445
+ PromptguardResponse,
446
+ timeout=timeout,
447
+ deadline=deadline,
448
+ metadata=metadata,
449
+ )
450
+
421
451
 
422
452
  class EvaluationServiceBase(ServiceBase):
423
453
 
@@ -435,6 +465,11 @@ class EvaluationServiceBase(ServiceBase):
435
465
  ) -> "betterproto_lib_google_protobuf.Empty":
436
466
  raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
437
467
 
468
+ async def evaluate_input(
469
+ self, chat_completion_request: "ChatCompletionRequest"
470
+ ) -> "PromptguardResponse":
471
+ raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
472
+
438
473
  async def __rpc_evaluate(
439
474
  self, stream: "grpclib.server.Stream[EvaluateRequest, EvaluateResponse]"
440
475
  ) -> None:
@@ -460,6 +495,14 @@ class EvaluationServiceBase(ServiceBase):
460
495
  response = await self.evaluate_async(request)
461
496
  await stream.send_message(response)
462
497
 
498
+ async def __rpc_evaluate_input(
499
+ self,
500
+ stream: "grpclib.server.Stream[ChatCompletionRequest, PromptguardResponse]",
501
+ ) -> None:
502
+ request = await stream.recv_message()
503
+ response = await self.evaluate_input(request)
504
+ await stream.send_message(response)
505
+
463
506
  def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
464
507
  return {
465
508
  "/chat.EvaluationService/Evaluate": grpclib.const.Handler(
@@ -480,4 +523,10 @@ class EvaluationServiceBase(ServiceBase):
480
523
  EvaluateRequest,
481
524
  betterproto_lib_google_protobuf.Empty,
482
525
  ),
526
+ "/chat.EvaluationService/EvaluateInput": grpclib.const.Handler(
527
+ self.__rpc_evaluate_input,
528
+ grpclib.const.Cardinality.UNARY_UNARY,
529
+ ChatCompletionRequest,
530
+ PromptguardResponse,
531
+ ),
483
532
  }
@@ -17,3 +17,4 @@ class Model(betterproto.Message):
17
17
  model: str = betterproto.string_field(5)
18
18
  points_to: str = betterproto.string_field(6)
19
19
  status: str = betterproto.string_field(7)
20
+ use_fallback: bool = betterproto.bool_field(8)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.42b0
3
+ Version: 1.0.43
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: requests
13
- Requires-Dist: openai==1.34.0
13
+ Requires-Dist: openai>=1.34.0
14
14
  Requires-Dist: betterproto
15
15
  Requires-Dist: httpx
16
16
  Requires-Dist: aiohttp
@@ -56,4 +56,4 @@ Maitai requires `openai` version `1.30.1` or later. If you are using an older ve
56
56
  ## Run Your Application
57
57
 
58
58
  Run your application, make sure it makes at least one Chat Completion Request, then head over
59
- to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
59
+ to https://portal.trymaitai.ai and watch Maitai learn your application in real time.
@@ -1,5 +1,5 @@
1
1
  requests
2
- openai==1.34.0
2
+ openai>=1.34.0
3
3
  betterproto
4
4
  httpx
5
5
  aiohttp
@@ -10,7 +10,7 @@ setup(
10
10
  packages=find_packages(exclude=("maitai_back", "maitai_back.*"), include=("maitai.*", "maitai", "maitai_common", "maitai_common.*", "maitai_gen", "maitai_gen.*")),
11
11
  install_requires=[
12
12
  'requests',
13
- 'openai==1.34.0',
13
+ 'openai>=1.34.0',
14
14
  'betterproto',
15
15
  'httpx',
16
16
  'aiohttp',