maitai-python 1.2.23__tar.gz → 1.2.24__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 (36) hide show
  1. {maitai_python-1.2.23 → maitai_python-1.2.24}/PKG-INFO +1 -1
  2. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_config.py +1 -0
  3. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_maitai.py +16 -7
  4. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_maitai_async.py +14 -6
  5. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_utils.py +3 -0
  6. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/chat.py +4 -1
  7. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/key.py +2 -0
  8. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_common/version.py +1 -1
  9. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_python.egg-info/PKG-INFO +1 -1
  10. {maitai_python-1.2.23 → maitai_python-1.2.24}/README.md +0 -0
  11. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/__init__.py +0 -0
  12. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_config_listener.py +0 -0
  13. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_context.py +0 -0
  14. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_evaluator.py +0 -0
  15. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_inference.py +0 -0
  16. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_maitai_client.py +0 -0
  17. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_pydantic.py +0 -0
  18. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/_types.py +0 -0
  19. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/exceptions.py +0 -0
  20. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/__init__.py +0 -0
  21. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/application.py +0 -0
  22. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/config.py +0 -0
  23. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/event.py +0 -0
  24. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/inference.py +0 -0
  25. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/metric.py +0 -0
  26. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/models/sentinel.py +0 -0
  27. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai/tools/__init__.py +0 -0
  28. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_common/__init__.py +0 -0
  29. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_common/config/__init__.py +0 -0
  30. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_common/config/config_service.py +0 -0
  31. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_python.egg-info/SOURCES.txt +0 -0
  32. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_python.egg-info/dependency_links.txt +0 -0
  33. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_python.egg-info/requires.txt +0 -0
  34. {maitai_python-1.2.23 → maitai_python-1.2.24}/maitai_python.egg-info/top_level.txt +0 -0
  35. {maitai_python-1.2.23 → maitai_python-1.2.24}/setup.cfg +0 -0
  36. {maitai_python-1.2.23 → maitai_python-1.2.24}/setup.py +0 -0
@@ -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
@@ -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
 
@@ -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:
@@ -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:
@@ -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:
@@ -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
 
@@ -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()
@@ -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
File without changes
File without changes
File without changes