maitai-python 1.0.20__tar.gz → 1.0.21__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 (40) hide show
  1. {maitai_python-1.0.20 → maitai_python-1.0.21}/PKG-INFO +1 -1
  2. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_openai.py +12 -2
  3. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_openai_async.py +12 -2
  4. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/config/config_service.py +24 -3
  5. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/version.py +1 -1
  6. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/application/__init__.py +3 -0
  7. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/config/__init__.py +15 -1
  8. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/session/__init__.py +5 -0
  9. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_python.egg-info/PKG-INFO +1 -1
  10. {maitai_python-1.0.20 → maitai_python-1.0.21}/README.md +0 -0
  11. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/__init__.py +0 -0
  12. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_azure.py +0 -0
  13. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_config.py +0 -0
  14. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_config_listener_thread.py +0 -0
  15. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_evaluator.py +0 -0
  16. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_inference.py +0 -0
  17. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_maitai_client.py +0 -0
  18. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_openai_types.py +0 -0
  19. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai/_utils.py +0 -0
  20. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/__init__.py +0 -0
  21. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/config/__init__.py +0 -0
  22. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/processes/__init__.py +0 -0
  23. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/processes/io_thread.py +0 -0
  24. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/processes/websocket_listener_thread.py +0 -0
  25. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/utils/__init__.py +0 -0
  26. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/utils/proto_utils.py +0 -0
  27. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_common/utils/types.py +0 -0
  28. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/__init__.py +0 -0
  29. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/chat/__init__.py +0 -0
  30. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/company/__init__.py +0 -0
  31. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/inference/__init__.py +0 -0
  32. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/notification/__init__.py +0 -0
  33. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/sandbox/__init__.py +0 -0
  34. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_gen/sentinel/__init__.py +0 -0
  35. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_python.egg-info/SOURCES.txt +0 -0
  36. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_python.egg-info/dependency_links.txt +0 -0
  37. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_python.egg-info/requires.txt +0 -0
  38. {maitai_python-1.0.20 → maitai_python-1.0.21}/maitai_python.egg-info/top_level.txt +0 -0
  39. {maitai_python-1.0.20 → maitai_python-1.0.21}/setup.cfg +0 -0
  40. {maitai_python-1.0.20 → maitai_python-1.0.21}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.20
3
+ Version: 1.0.21
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -26,6 +26,8 @@ class MaitaiOpenAIClient:
26
26
  *,
27
27
  maitai_api_key: Optional[str] = None,
28
28
  api_key: Optional[str] = None,
29
+ openai_api_key: Optional[str] = None,
30
+ groq_api_key: Optional[str] = None,
29
31
  organization: Optional[str] = None,
30
32
  project: Optional[str] = None,
31
33
  base_url: Union[str, httpx.URL, None] = None,
@@ -36,10 +38,14 @@ class MaitaiOpenAIClient:
36
38
  http_client: Optional[httpx.Client] = None,
37
39
  _strict_response_validation: bool = False,
38
40
  ):
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")
39
43
  if maitai_api_key:
40
44
  config.initialize(maitai_api_key)
41
- if api_key:
42
- config.auth_info.override_api_key = api_key
45
+ if openai_api_key:
46
+ config.auth_info.openai_api_key = openai_api_key
47
+ if groq_api_key:
48
+ config.auth_info.groq_api_key = groq_api_key
43
49
  self.client = openai.OpenAI(
44
50
  api_key=api_key,
45
51
  organization=organization,
@@ -135,6 +141,10 @@ class Completions:
135
141
  max_tokens = maitai_config.max_tokens
136
142
  if n == openai.NOT_GIVEN:
137
143
  n = maitai_config.n
144
+ if frequency_penalty == openai.NOT_GIVEN:
145
+ frequency_penalty = maitai_config.frequency_penalty
146
+ if presence_penalty == openai.NOT_GIVEN:
147
+ presence_penalty = maitai_config.presence_penalty
138
148
  completion_params = get_chat_completion_params(
139
149
  messages=messages,
140
150
  model=model,
@@ -26,6 +26,8 @@ class MaitaiAsyncOpenAIClient:
26
26
  *,
27
27
  maitai_api_key: Optional[str] = None,
28
28
  api_key: Optional[str] = None,
29
+ openai_api_key: Optional[str] = None,
30
+ groq_api_key: Optional[str] = None,
29
31
  organization: Optional[str] = None,
30
32
  project: Optional[str] = None,
31
33
  base_url: Union[str, httpx.URL, None] = None,
@@ -37,10 +39,14 @@ class MaitaiAsyncOpenAIClient:
37
39
  _strict_response_validation: bool = False,
38
40
 
39
41
  ):
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")
40
44
  if maitai_api_key:
41
45
  config.initialize(maitai_api_key)
42
- if api_key:
43
- config.auth_info.override_api_key = api_key
46
+ if openai_api_key:
47
+ config.auth_info.openai_api_key = openai_api_key
48
+ if groq_api_key:
49
+ config.auth_info.groq_api_key = groq_api_key
44
50
  self.client = openai.AsyncClient(
45
51
  api_key=api_key,
46
52
  organization=organization,
@@ -140,6 +146,10 @@ class AsyncCompletions:
140
146
  max_tokens = maitai_config.max_tokens
141
147
  if n == openai.NOT_GIVEN:
142
148
  n = maitai_config.n
149
+ if frequency_penalty == openai.NOT_GIVEN:
150
+ frequency_penalty = maitai_config.frequency_penalty
151
+ if presence_penalty == openai.NOT_GIVEN:
152
+ presence_penalty = maitai_config.presence_penalty
143
153
 
144
154
  completion_params = get_chat_completion_params(
145
155
  messages=messages,
@@ -1,4 +1,5 @@
1
- from maitai_gen.config import Config, InferenceLocations
1
+ from maitai_back.utils import misc_utils
2
+ from maitai_gen.config import Config, InferenceLocations, ModelConfig
2
3
 
3
4
  # TODO consider finding a source of truth where we don't need to deploy everytime a new model comes out
4
5
  SERVER_PROVIDERS = ["groq", "openai"]
@@ -30,6 +31,9 @@ MODELS = {
30
31
  "gpt-3.5-turbo-16k-0613": "openai",
31
32
  }
32
33
 
34
+ DEFAULT_CLIENT_MODEL = "gpt-4o"
35
+ DEFAULT_SERVER_MODEL = "llama3-70b-8192"
36
+
33
37
 
34
38
  def get_default_config() -> Config:
35
39
  return Config(
@@ -37,16 +41,26 @@ def get_default_config() -> Config:
37
41
  evaluation_enabled=True,
38
42
  apply_corrections=True,
39
43
  model='gpt-4o',
40
- temperature=0.4,
44
+ temperature=1,
41
45
  streaming=False,
42
46
  response_format="text",
43
47
  stop=None,
44
48
  logprobs=False,
45
49
  max_tokens=None,
46
50
  n=1,
51
+ frequency_penalty=0,
52
+ presence_penalty=0,
47
53
  )
48
54
 
49
55
 
56
+ def reconcile_config_with_default(config_dict: dict) -> Config:
57
+ default_config_json = misc_utils.to_dict(get_default_config())
58
+ for key, value in default_config_json.items():
59
+ if key not in config_dict:
60
+ config_dict[key] = value
61
+ return Config().from_pydict(config_dict)
62
+
63
+
50
64
  def get_model_provider(model_name: str):
51
65
  return MODELS[model_name]
52
66
 
@@ -60,4 +74,11 @@ def get_models(providers):
60
74
 
61
75
 
62
76
  def get_available_models():
63
- return {"all_models": list(MODELS.keys()), "client_models": get_models(CLIENT_PROVIDERS), "server_models": get_models(SERVER_PROVIDERS)}
77
+ model_config = ModelConfig(
78
+ all_models=list(MODELS.keys()),
79
+ client_models=get_models(CLIENT_PROVIDERS),
80
+ server_models=get_models(SERVER_PROVIDERS),
81
+ default_client_model=DEFAULT_CLIENT_MODEL,
82
+ default_server_model=DEFAULT_SERVER_MODEL,
83
+ )
84
+ return misc_utils.to_dict(model_config)
@@ -1,3 +1,3 @@
1
- version = "1.0.20"
1
+ version = "1.0.21"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -44,6 +44,8 @@ class Application(betterproto.Message):
44
44
  meta: "_config__.Config" = betterproto.message_field(8)
45
45
  action_types: List["ApplicationAction"] = betterproto.message_field(9)
46
46
  last_activity: int = betterproto.int64_field(10)
47
+ fault_notifications: bool = betterproto.bool_field(11)
48
+ session_summaries: bool = betterproto.bool_field(12)
47
49
 
48
50
 
49
51
  @dataclass(eq=False, repr=False)
@@ -54,3 +56,4 @@ class ApplicationAction(betterproto.Message):
54
56
  application_id: int = betterproto.int64_field(4)
55
57
  meta: "_config__.Config" = betterproto.message_field(5)
56
58
  last_activity: int = betterproto.int64_field(6)
59
+ notifications_enabled: bool = betterproto.bool_field(7)
@@ -4,7 +4,10 @@
4
4
  # This file has been @generated
5
5
 
6
6
  from dataclasses import dataclass
7
- from typing import Optional
7
+ from typing import (
8
+ List,
9
+ Optional,
10
+ )
8
11
 
9
12
  import betterproto
10
13
 
@@ -29,3 +32,14 @@ class Config(betterproto.Message):
29
32
  10, optional=True, group="_max_tokens"
30
33
  )
31
34
  n: int = betterproto.int64_field(11)
35
+ presence_penalty: float = betterproto.double_field(15)
36
+ frequency_penalty: float = betterproto.double_field(16)
37
+
38
+
39
+ @dataclass(eq=False, repr=False)
40
+ class ModelConfig(betterproto.Message):
41
+ all_models: List[str] = betterproto.string_field(1)
42
+ client_models: List[str] = betterproto.string_field(2)
43
+ server_models: List[str] = betterproto.string_field(3)
44
+ default_client_model: str = betterproto.string_field(4)
45
+ default_server_model: str = betterproto.string_field(5)
@@ -36,6 +36,11 @@ class Session(betterproto.Message):
36
36
  reviewer: Dict[str, str] = betterproto.map_field(
37
37
  9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
38
38
  )
39
+ date_ended: int = betterproto.int64_field(10)
40
+ company_id: int = betterproto.int64_field(11)
41
+ meta: Dict[str, str] = betterproto.map_field(
42
+ 12, betterproto.TYPE_STRING, betterproto.TYPE_STRING
43
+ )
39
44
 
40
45
 
41
46
  @dataclass(eq=False, repr=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.20
3
+ Version: 1.0.21
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