maitai-python 1.0.24__tar.gz → 1.0.25b0__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 (41) hide show
  1. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/PKG-INFO +1 -1
  2. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_config.py +4 -4
  3. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_maitai_client.py +1 -1
  4. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_openai.py +4 -4
  5. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_openai_async.py +4 -4
  6. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/config/config_service.py +1 -1
  7. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/version.py +1 -1
  8. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/chat/__init__.py +5 -1
  9. maitai_python-1.0.25b0/maitai_gen/key/__init__.py +35 -0
  10. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_python.egg-info/PKG-INFO +1 -1
  11. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_python.egg-info/SOURCES.txt +1 -0
  12. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/README.md +0 -0
  13. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/__init__.py +0 -0
  14. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_azure.py +0 -0
  15. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_config_listener_thread.py +0 -0
  16. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_evaluator.py +0 -0
  17. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_inference.py +0 -0
  18. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_openai_types.py +0 -0
  19. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai/_utils.py +0 -0
  20. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/__init__.py +0 -0
  21. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/config/__init__.py +0 -0
  22. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/processes/__init__.py +0 -0
  23. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/processes/io_thread.py +0 -0
  24. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/processes/websocket_listener_thread.py +0 -0
  25. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/utils/__init__.py +0 -0
  26. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/utils/proto_utils.py +0 -0
  27. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_common/utils/types.py +0 -0
  28. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/__init__.py +0 -0
  29. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/application/__init__.py +0 -0
  30. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/company/__init__.py +0 -0
  31. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/config/__init__.py +0 -0
  32. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/inference/__init__.py +0 -0
  33. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/notification/__init__.py +0 -0
  34. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/sandbox/__init__.py +0 -0
  35. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/sentinel/__init__.py +0 -0
  36. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_gen/session/__init__.py +0 -0
  37. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_python.egg-info/dependency_links.txt +0 -0
  38. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_python.egg-info/requires.txt +0 -0
  39. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/maitai_python.egg-info/top_level.txt +0 -0
  40. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/setup.cfg +0 -0
  41. {maitai_python-1.0.24 → maitai_python-1.0.25b0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.24
3
+ Version: 1.0.25b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -7,8 +7,8 @@ from maitai._config_listener_thread import ConfigListenerThread
7
7
  from maitai_common.config import config_service
8
8
  from maitai_common.version import version
9
9
  from maitai_gen.application import Application
10
- from maitai_gen.chat import ChatCompletionAuth
11
10
  from maitai_gen.config import Config as ActionConfig
11
+ from maitai_gen.key import Key, KeyMap
12
12
 
13
13
 
14
14
  class Config:
@@ -23,9 +23,9 @@ class Config:
23
23
  self.config_listener_thread = None
24
24
  self._application_action_configs: dict[str, dict[str, ActionConfig]] = {}
25
25
  self.initialized = False
26
- self.auth_info = ChatCompletionAuth(
27
- openai_api_key=os.environ.get("OPENAI_API_KEY"),
28
- groq_api_key=os.environ.get("GROQ_API_KEY"),
26
+ self.auth_keys: KeyMap = KeyMap(
27
+ openai_api_key=Key(id=-1, key_value=os.environ.get("OPENAI_API_KEY")),
28
+ groq_api_key=Key(id=-1, key_value=os.environ.get("GROQ_API_KEY")),
29
29
  )
30
30
 
31
31
  @property
@@ -46,6 +46,6 @@ class MaitaiClient:
46
46
  infer_request.apply_corrections = apply_corrections
47
47
  infer_request.params = completion_params
48
48
  infer_request.evaluation_enabled = evaluation_enabled
49
- infer_request.auth_info = config.auth_info
49
+ infer_request.auth_keys = config.auth_keys
50
50
  infer_request.return_evaluation = True if callback else False
51
51
  return infer_request
@@ -39,15 +39,15 @@ class MaitaiOpenAIClient:
39
39
  _strict_response_validation: bool = False,
40
40
  ):
41
41
  if api_key:
42
- raise ValueError("The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
42
+ print("Warning: The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
43
43
  if maitai_api_key:
44
44
  config.initialize(maitai_api_key)
45
45
  if openai_api_key:
46
- config.auth_info.openai_api_key = openai_api_key
46
+ config.auth_keys.openai_api_key.key_value = openai_api_key
47
47
  if groq_api_key:
48
- config.auth_info.groq_api_key = groq_api_key
48
+ config.auth_keys.groq_api_key.key_value = groq_api_key
49
49
  self.client = openai.OpenAI(
50
- api_key=api_key,
50
+ api_key=api_key or openai_api_key,
51
51
  organization=organization,
52
52
  project=project,
53
53
  base_url=base_url,
@@ -40,15 +40,15 @@ class MaitaiAsyncOpenAIClient:
40
40
 
41
41
  ):
42
42
  if api_key:
43
- raise ValueError("The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
43
+ print("Warning: The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
44
44
  if maitai_api_key:
45
45
  config.initialize(maitai_api_key)
46
46
  if openai_api_key:
47
- config.auth_info.openai_api_key = openai_api_key
47
+ config.auth_keys.openai_api_key.key_value = openai_api_key
48
48
  if groq_api_key:
49
- config.auth_info.groq_api_key = groq_api_key
49
+ config.auth_keys.groq_api_key.key_value = groq_api_key
50
50
  self.client = openai.AsyncClient(
51
- api_key=api_key,
51
+ api_key=api_key or openai_api_key,
52
52
  organization=organization,
53
53
  project=project,
54
54
  base_url=base_url,
@@ -63,7 +63,7 @@ def reconcile_config_with_default(config_dict: dict) -> Config:
63
63
 
64
64
 
65
65
  def get_model_provider(model_name: str):
66
- return MODELS[model_name]
66
+ return MODELS.get(model_name)
67
67
 
68
68
 
69
69
  def get_models(providers):
@@ -1,3 +1,3 @@
1
- version = "1.0.24"
1
+ version = "1.0.25b0"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -17,7 +17,10 @@ import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
17
17
  import grpclib
18
18
  from betterproto.grpc.grpclib_server import ServiceBase
19
19
 
20
- from .. import sentinel as _sentinel__
20
+ from .. import (
21
+ key as _key__,
22
+ sentinel as _sentinel__,
23
+ )
21
24
 
22
25
 
23
26
  if TYPE_CHECKING:
@@ -53,6 +56,7 @@ class ChatCompletionRequest(betterproto.Message):
53
56
  auth_info: "ChatCompletionAuth" = betterproto.message_field(12)
54
57
  return_evaluation: bool = betterproto.bool_field(13)
55
58
  error: str = betterproto.string_field(14)
59
+ auth_keys: "_key__.KeyMap" = betterproto.message_field(15)
56
60
 
57
61
 
58
62
  @dataclass(eq=False, repr=False)
@@ -0,0 +1,35 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: key.proto
3
+ # plugin: python-betterproto
4
+ # This file has been @generated
5
+
6
+ from dataclasses import dataclass
7
+
8
+ import betterproto
9
+
10
+
11
+ @dataclass(eq=False, repr=False)
12
+ class Key(betterproto.Message):
13
+ id: int = betterproto.int64_field(1)
14
+ date_created: int = betterproto.int64_field(2)
15
+ key_value: str = betterproto.string_field(3)
16
+ company_id: int = betterproto.int64_field(4)
17
+ description: str = betterproto.string_field(5)
18
+ owner: str = betterproto.string_field(6)
19
+ type: str = betterproto.string_field(7)
20
+ obfuscated: bool = betterproto.bool_field(8)
21
+ key_map: "KeyIdMap" = betterproto.message_field(9)
22
+
23
+
24
+ @dataclass(eq=False, repr=False)
25
+ class KeyIdMap(betterproto.Message):
26
+ openai_api_key: int = betterproto.int64_field(1)
27
+ groq_api_key: int = betterproto.int64_field(2)
28
+ anthropic_api_key: int = betterproto.int64_field(3)
29
+
30
+
31
+ @dataclass(eq=False, repr=False)
32
+ class KeyMap(betterproto.Message):
33
+ openai_api_key: "Key" = betterproto.message_field(1)
34
+ groq_api_key: "Key" = betterproto.message_field(2)
35
+ anthropic_api_key: "Key" = betterproto.message_field(3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.24
3
+ Version: 1.0.25b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -27,6 +27,7 @@ maitai_gen/chat/__init__.py
27
27
  maitai_gen/company/__init__.py
28
28
  maitai_gen/config/__init__.py
29
29
  maitai_gen/inference/__init__.py
30
+ maitai_gen/key/__init__.py
30
31
  maitai_gen/notification/__init__.py
31
32
  maitai_gen/sandbox/__init__.py
32
33
  maitai_gen/sentinel/__init__.py