maitai-python 1.2.23__py3-none-any.whl → 1.2.24__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.
maitai/_config.py CHANGED
@@ -32,6 +32,7 @@ class Config(MaitaiClient):
32
32
  sambanova_api_key=Key(id=-1, key_value=os.environ.get("SAMBANOVA_API_KEY")),
33
33
  gemini_api_key=Key(id=-1, key_value=os.environ.get("GEMINI_API_KEY")),
34
34
  azure_api_key=Key(id=-1, key_value=os.environ.get("AZURE_API_KEY")),
35
+ deepseek_api_key=Key(id=-1, key_value=os.environ.get("DEEPSEEK_API_KEY")),
35
36
  )
36
37
  self.refresh_interval = 30 * 60 # 30 minutes in seconds
37
38
 
maitai/_maitai.py CHANGED
@@ -68,6 +68,7 @@ class Maitai:
68
68
  azure_api_key: Optional[str] = None,
69
69
  sambanova_api_key: Optional[str] = None,
70
70
  gemini_api_key: Optional[str] = None,
71
+ deepseek_api_key: Optional[str] = None,
71
72
  azure_deployment: Optional[str] = None,
72
73
  azure_api_version: Optional[str] = None,
73
74
  azure_endpoint: Optional[str] = None,
@@ -91,7 +92,7 @@ class Maitai:
91
92
  )
92
93
  if api_key:
93
94
  raise ValueError(
94
- "api_key is deprecated. Use provider specific keys instead. Supported variables: openai_api_key, groq_api_key, anthropic_api_key, cerebras_api_key, azure_api_key, sambanova_api_key, gemini_api_key"
95
+ "api_key is deprecated. Use provider specific keys instead. Supported variables: openai_api_key, groq_api_key, anthropic_api_key, cerebras_api_key, azure_api_key, sambanova_api_key, gemini_api_key, deepseek_api_key"
95
96
  )
96
97
  if openai_api_key:
97
98
  if not config.auth_keys.openai_api_key:
@@ -142,6 +143,13 @@ class Maitai:
142
143
  )
143
144
  else:
144
145
  config.auth_keys.gemini_api_key.key_value = gemini_api_key
146
+ if deepseek_api_key:
147
+ if not config.auth_keys.deepseek_api_key:
148
+ config.auth_keys.deepseek_api_key = Key(
149
+ key_value=deepseek_api_key,
150
+ )
151
+ else:
152
+ config.auth_keys.deepseek_api_key.key_value = deepseek_api_key
145
153
  self._openai_client = None
146
154
  self._groq_client = None
147
155
  azure_params = None
@@ -482,6 +490,13 @@ class Completions:
482
490
  logger.warning("Maitai issue, retrying on client side")
483
491
  server_side_inference = False
484
492
  if not server_side_inference:
493
+ groq_model = False
494
+ if "groq:" in model or "maitai:" in model or "llama" in model:
495
+ groq_model = True
496
+ model = model.replace("groq:", "").replace("maitai:", "")
497
+ if "openai:" in model:
498
+ model = model.replace("openai:", "")
499
+
485
500
  local_params = {
486
501
  "messages": messages,
487
502
  "model": model,
@@ -511,12 +526,6 @@ class Completions:
511
526
  "timeout": timeout,
512
527
  "parallel_tool_calls": parallel_tool_calls,
513
528
  }
514
- groq_model = False
515
- if "groq:" in model or "maitai:" in model or "llama" in model:
516
- groq_model = True
517
- model = model.replace("groq:", "").replace("maitai:", "")
518
- if "openai:" in model:
519
- model = model.replace("openai:", "")
520
529
 
521
530
  if groq_model:
522
531
  if self._groq_client is None:
maitai/_maitai_async.py CHANGED
@@ -67,6 +67,7 @@ class MaitaiAsync:
67
67
  cerebras_api_key: Optional[str] = None,
68
68
  sambanova_api_key: Optional[str] = None,
69
69
  gemini_api_key: Optional[str] = None,
70
+ deepseek_api_key: Optional[str] = None,
70
71
  azure_api_key: Optional[str] = None,
71
72
  azure_deployment: Optional[str] = None,
72
73
  azure_api_version: Optional[str] = None,
@@ -137,6 +138,13 @@ class MaitaiAsync:
137
138
  )
138
139
  else:
139
140
  config.auth_keys.gemini_api_key.key_value = gemini_api_key
141
+ if deepseek_api_key:
142
+ if not config.auth_keys.deepseek_api_key:
143
+ config.auth_keys.deepseek_api_key = Key(
144
+ key_value=deepseek_api_key,
145
+ )
146
+ else:
147
+ config.auth_keys.deepseek_api_key.key_value = deepseek_api_key
140
148
  self._openai_client = None
141
149
  self._groq_client = None
142
150
  azure_params = None
@@ -480,6 +488,12 @@ class AsyncCompletions:
480
488
  logger.warning("Maitai issue, retrying on client side")
481
489
  server_side_inference = False
482
490
  if not server_side_inference:
491
+ groq_model = False
492
+ if "groq:" in model or "maitai:" in model or "llama" in model:
493
+ groq_model = True
494
+ model = model.replace("groq:", "").replace("maitai:", "")
495
+ if "openai:" in model:
496
+ model = model.replace("openai:", "")
483
497
  local_params = {
484
498
  "messages": messages,
485
499
  "model": model,
@@ -509,12 +523,6 @@ class AsyncCompletions:
509
523
  "timeout": timeout,
510
524
  "parallel_tool_calls": parallel_tool_calls,
511
525
  }
512
- groq_model = False
513
- if "groq:" in model or "maitai:" in model or "llama" in model:
514
- groq_model = True
515
- model = model.replace("groq:", "").replace("maitai:", "")
516
- if "openai:" in model:
517
- model = model.replace("openai:", "")
518
526
 
519
527
  if groq_model:
520
528
  if self._groq_client is None:
maitai/_utils.py CHANGED
@@ -308,6 +308,9 @@ def convert_params_to_groq(params: Dict[str, Any]) -> Dict[str, Any]:
308
308
  del params["reasoning_effort"]
309
309
  if "stream_options" in params:
310
310
  del params["stream_options"]
311
+ if params.get("max_tokens", openai.NOT_GIVEN) == openai.NOT_GIVEN or params.get("max_tokens", 0) <= 0:
312
+ ## max_tokens must be positive
313
+ params["max_tokens"] = 1000
311
314
  to_del = []
312
315
  for key, item in params.items():
313
316
  if item == openai.NOT_GIVEN:
maitai/models/chat.py CHANGED
@@ -18,6 +18,8 @@ class EvaluationProvider(Enum):
18
18
  MAITAI = 3
19
19
  SAMBANOVA = 4
20
20
  GEMINI = 5
21
+ DEEPSEEK = 6
22
+ ANTHROPIC = 7
21
23
 
22
24
 
23
25
  class AzureParams(BaseModel):
@@ -42,6 +44,7 @@ class ChatCompletionAuth(BaseModel):
42
44
  azure_api_key: Optional[str] = ""
43
45
  sambanova_api_key: Optional[str] = ""
44
46
  gemini_api_key: Optional[str] = ""
47
+ deepseek_api_key: Optional[str] = ""
45
48
 
46
49
 
47
50
  class Property(BaseModel):
@@ -82,7 +85,7 @@ class Tool(BaseModel):
82
85
 
83
86
 
84
87
  class JSONSchema(BaseModel):
85
- name: str
88
+ name: str = "output_schema"
86
89
  strict: Optional[bool] = False
87
90
  json_schema: FunctionParameters = Field(alias="schema")
88
91
 
maitai/models/key.py CHANGED
@@ -24,6 +24,7 @@ class KeyIdMap(BaseModel):
24
24
  azure_api_key: Optional[int] = 0
25
25
  sambanova_api_key: Optional[int] = 0
26
26
  gemini_api_key: Optional[int] = 0
27
+ deepseek_api_key: Optional[int] = 0
27
28
 
28
29
 
29
30
  class KeyMap(BaseModel):
@@ -34,6 +35,7 @@ class KeyMap(BaseModel):
34
35
  azure_api_key: Optional[Key] = None
35
36
  sambanova_api_key: Optional[Key] = None
36
37
  gemini_api_key: Optional[Key] = None
38
+ deepseek_api_key: Optional[Key] = None
37
39
 
38
40
 
39
41
  Key.model_rebuild()
maitai_common/version.py CHANGED
@@ -1,3 +1,3 @@
1
- version = "1.2.23"
1
+ version = "1.2.24"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maitai-python
3
- Version: 1.2.23
3
+ Version: 1.2.24
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -1,31 +1,31 @@
1
1
  maitai/__init__.py,sha256=UocvQ1455PnA27V1S6vk3yc_BysjTgLGbwfdMF2eL0A,336
2
- maitai/_config.py,sha256=Rp7dy_g9ZsMsXWvXV52OSRmkBmA6NbNAAPYwKZ6kf-4,7625
2
+ maitai/_config.py,sha256=9p5lrzctWAA8GRvaRXrigQH18H286MupuIwe1kvU_3A,7712
3
3
  maitai/_config_listener.py,sha256=FhjV84Pugy5h0mlbCSaanKZ4aVpINaEKzMNQmdZhRj4,5140
4
4
  maitai/_context.py,sha256=qyxCww-02qvLpJ7dRG_eOkZI2UaCOgLtqkASlb7QbZU,2470
5
5
  maitai/_evaluator.py,sha256=JDcb6xFjUHE28VyGrHxgwD4LVdeDuuOioQd9ZMmOXkI,11363
6
6
  maitai/_inference.py,sha256=fcapXkBYv1BLmJQ9vRl8p5tFwnM1ojVRz2X7TZLukPY,12735
7
- maitai/_maitai.py,sha256=VxgZwBChcFnlTK4bSRMTzSWZsq1z5FQtrCTiEEXlG5E,30179
8
- maitai/_maitai_async.py,sha256=wzi3dBhLPD4Jkn8N29mVtdudye8lMzCjKGIcj-zQlUs,30442
7
+ maitai/_maitai.py,sha256=DsOu4Gvd6SxOvIOaNBsQ6pSqSAN1eNQx9HQyK-49yA4,30549
8
+ maitai/_maitai_async.py,sha256=5tbdSX9PEAtWu4FWCD7rhruPhQ6LOeEcIc_7RGwzRK0,30793
9
9
  maitai/_maitai_client.py,sha256=NmsOYdk2VpDQPuyAZACo7V387ZkEwZZPkpubr3BVs5Q,6392
10
10
  maitai/_pydantic.py,sha256=8clflOhR7-6AeLFBzmsYO0aaQSAkp8KMuxsrYwPthaA,5683
11
11
  maitai/_types.py,sha256=UL3CMIZ0bc1I6vyGcGxCusxVl-OHsTGUFY8oIBckyEs,5875
12
- maitai/_utils.py,sha256=WhVNIA8XyazovRRSCjCIz8Hh2-dKFqsaUNkgn0RVXHI,11375
12
+ maitai/_utils.py,sha256=SVZU4l2XfXX1aQb33MfDkYa6x7wSQCdwtiaMnjb9mfQ,11557
13
13
  maitai/exceptions.py,sha256=n0jwH3dhq8ewdgkCHTaaMd1GeB3EL_zulytnwqD3XUg,500
14
14
  maitai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  maitai/models/application.py,sha256=nfddjI5gt56MkSZgvG-EZmsO3JFxpAA5mzPwVoGig10,1656
16
- maitai/models/chat.py,sha256=gY4PHID-xg2soongY69-RGVGvZUgrfjVBLs82-Wx0_M,12881
16
+ maitai/models/chat.py,sha256=7hAkG1HrkM8a0fru1nQlvCuKBNBFre2VZebdWV3Ah1I,12975
17
17
  maitai/models/config.py,sha256=L798kNl-To-LSzHApy_Tu8JKGJ3KkKA8lvKVTdQujXE,2017
18
18
  maitai/models/event.py,sha256=xrwSCP-nVdFsO6F30pmYdSg9M_L1RG-0vj9e_17amEY,313
19
19
  maitai/models/inference.py,sha256=lySiDgdsu6IdX7KG8O6orjZokeX5mR4OnLuJFJykY68,516
20
- maitai/models/key.py,sha256=KbdQw5bec9ndfnG2t-cLdC7prfbhxnX5OKwyb3YmsQM,1009
20
+ maitai/models/key.py,sha256=MYPstMcxJhtSU9dnMWJcL-ZU4J199Il696crRHBGqqc,1092
21
21
  maitai/models/metric.py,sha256=iL1FqaJ-3ii5pgY4cGZKp0nuQVG1XnBggopazQhGN_E,451
22
22
  maitai/models/sentinel.py,sha256=D1qPhV6GQDRq-JkDtm_lwSXDWFQ1kUjuCw5H6fUvsFg,1802
23
23
  maitai/tools/__init__.py,sha256=Fo7tOLJNFbFtVN9LI8fpFUPk95lcq97Pp1TP5-2NU3s,4086
24
24
  maitai_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- maitai_common/version.py,sha256=lBJwiSrVcJS0543PYVM0tTUGdfP2afN2Wup4UpbZJeY,65
25
+ maitai_common/version.py,sha256=eRCOTHD2z0HULhhORWPA5i_5MaDGaDiDf6rAMc0UJP8,65
26
26
  maitai_common/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  maitai_common/config/config_service.py,sha256=CRUz-LYyGxCaDqqkqaJ6CyhpTKr11NKux104oU__NBg,1110
28
- maitai_python-1.2.23.dist-info/METADATA,sha256=5sL9veoGyeuFYoruczqIM4trMCbwmcLYQuARv97SMto,1682
29
- maitai_python-1.2.23.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
30
- maitai_python-1.2.23.dist-info/top_level.txt,sha256=3uBDd_HUkDZhdPkUjbHJpoKMT3YoYszkUeOLIxgjzUo,21
31
- maitai_python-1.2.23.dist-info/RECORD,,
28
+ maitai_python-1.2.24.dist-info/METADATA,sha256=egTs34YJ7M4sDeYvl-3qImHQ4eDSU5Rmaa7_eiHjOF4,1682
29
+ maitai_python-1.2.24.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
30
+ maitai_python-1.2.24.dist-info/top_level.txt,sha256=3uBDd_HUkDZhdPkUjbHJpoKMT3YoYszkUeOLIxgjzUo,21
31
+ maitai_python-1.2.24.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5