maitai-python 1.0.32b0__tar.gz → 1.0.33b0__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 (45) hide show
  1. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/PKG-INFO +1 -1
  2. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_config.py +1 -1
  3. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_context.py +1 -2
  4. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_evaluator.py +2 -3
  5. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_inference.py +5 -4
  6. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_maitai.py +25 -14
  7. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_maitai_async.py +10 -2
  8. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_utils.py +4 -7
  9. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/version.py +1 -1
  10. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/chat/__init__.py +69 -35
  11. maitai_python-1.0.33b0/maitai_gen/event/__init__.py +19 -0
  12. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/key/__init__.py +4 -1
  13. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/session/__init__.py +10 -10
  14. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_python.egg-info/PKG-INFO +1 -1
  15. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_python.egg-info/SOURCES.txt +1 -0
  16. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/setup.py +1 -1
  17. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/README.md +0 -0
  18. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/__init__.py +1 -1
  19. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_azure.py +0 -0
  20. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_config_listener_thread.py +0 -0
  21. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_maitai_client.py +0 -0
  22. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai/_types.py +0 -0
  23. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/__init__.py +0 -0
  24. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/config/__init__.py +0 -0
  25. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/config/config_service.py +0 -0
  26. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/processes/__init__.py +0 -0
  27. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/processes/io_thread.py +0 -0
  28. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/processes/websocket_listener_thread.py +0 -0
  29. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/utils/__init__.py +0 -0
  30. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/utils/proto_utils.py +0 -0
  31. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_common/utils/types.py +0 -0
  32. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/__init__.py +0 -0
  33. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/application/__init__.py +0 -0
  34. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/company/__init__.py +0 -0
  35. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/config/__init__.py +0 -0
  36. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/embedding/__init__.py +0 -0
  37. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/inference/__init__.py +0 -0
  38. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/model/__init__.py +0 -0
  39. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/notification/__init__.py +0 -0
  40. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/sandbox/__init__.py +0 -0
  41. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_gen/sentinel/__init__.py +0 -0
  42. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_python.egg-info/dependency_links.txt +0 -0
  43. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_python.egg-info/requires.txt +0 -0
  44. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/maitai_python.egg-info/top_level.txt +0 -0
  45. {maitai_python-1.0.32b0 → maitai_python-1.0.33b0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.32b0
3
+ Version: 1.0.33b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -4,8 +4,8 @@ from typing import List
4
4
  import requests
5
5
 
6
6
  from maitai._config_listener_thread import ConfigListenerThread
7
+ from maitai._utils import __version__ as version
7
8
  from maitai_common.config import config_service
8
- from maitai_common.version import version
9
9
  from maitai_gen.application import Application
10
10
  from maitai_gen.config import Config as ActionConfig
11
11
  from maitai_gen.key import Key, KeyMap
@@ -4,8 +4,7 @@ import requests
4
4
  from betterproto import Casing
5
5
 
6
6
  from maitai._config import config
7
- from maitai._utils import required_args
8
- from maitai_common.version import version
7
+ from maitai._utils import __version__ as version, required_args
9
8
  from maitai_gen.application import ApplicationContext
10
9
 
11
10
 
@@ -8,15 +8,14 @@ from betterproto import Casing
8
8
 
9
9
  from maitai._config import config
10
10
  from maitai._maitai_client import MaitaiClient
11
- from maitai._utils import chat_completion_chunk_to_response
11
+ from maitai._utils import __version__ as version, chat_completion_chunk_to_response
12
12
  from maitai_common.utils.types import EvaluateCallback
13
- from maitai_common.version import version
14
13
  from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompletionResponse, EvaluateRequest, EvaluateResponse, EvaluationContentType
15
14
 
16
15
 
17
16
  def _get_content_type(content, partial=None):
18
17
  if partial is not None:
19
- return EvaluateResponse.PARTIAL_CONTENT
18
+ return EvaluationContentType.PARTIAL
20
19
  if isinstance(content, str):
21
20
  return EvaluationContentType.TEXT
22
21
  elif isinstance(content, list):
@@ -7,9 +7,8 @@ from betterproto import Casing
7
7
 
8
8
  from maitai._config import config
9
9
  from maitai._maitai_client import MaitaiClient
10
- from maitai._utils import chat_completion_chunk_to_response
10
+ from maitai._utils import __version__ as version, chat_completion_chunk_to_response
11
11
  from maitai_common.utils.types import AsyncChunkQueue, ChunkQueue, EvaluateCallback, QueueIterable
12
- from maitai_common.version import version
13
12
  from maitai_gen.chat import ChatCompletionChunk, ChatCompletionParams, ChatCompletionRequest, ChatCompletionResponse, ChatStorageRequest
14
13
  from maitai_gen.inference import InferenceStreamResponse
15
14
 
@@ -32,7 +31,8 @@ class Inference(MaitaiClient):
32
31
  @classmethod
33
32
  def infer(cls, session_id, reference_id, intent, application_ref_name, completion_params: ChatCompletionParams, apply_corrections: bool, evaluation_enabled: bool, evaluate_callback: EvaluateCallback = None,
34
33
  timeout=None, context_retrieval_enabled=False, context_query='', return_request=False, fallback_model=None) -> Iterable[InferenceStreamResponse]:
35
- chat_request: ChatCompletionRequest = cls.create_inference_request(application_ref_name, session_id, reference_id, intent, apply_corrections, evaluation_enabled, completion_params, evaluate_callback, context_retrieval_enabled, context_query, return_request, fallback_model)
34
+ chat_request: ChatCompletionRequest = cls.create_inference_request(application_ref_name, session_id, reference_id, intent, apply_corrections, evaluation_enabled, completion_params, evaluate_callback,
35
+ context_retrieval_enabled, context_query, return_request, fallback_model)
36
36
  if evaluate_callback:
37
37
  q = ChunkQueue()
38
38
  cls.run_async(cls.send_inference_request_async(chat_request, chunk_queue=q, evaluation_callback=evaluate_callback))
@@ -43,7 +43,8 @@ class Inference(MaitaiClient):
43
43
  @classmethod
44
44
  async def infer_async(cls, session_id, reference_id, intent, application_ref_name, completion_params: ChatCompletionParams, apply_corrections: bool, evaluation_enabled: bool,
45
45
  evaluate_callback: EvaluateCallback = None, timeout=None, context_retrieval_enabled=False, context_query='', fallback_model=None) -> AsyncIterable[InferenceStreamResponse]:
46
- chat_request: ChatCompletionRequest = cls.create_inference_request(application_ref_name, session_id, reference_id, intent, apply_corrections, evaluation_enabled, completion_params, evaluate_callback, context_retrieval_enabled, context_query, fallback_model)
46
+ chat_request: ChatCompletionRequest = cls.create_inference_request(application_ref_name, session_id, reference_id, intent, apply_corrections, evaluation_enabled, completion_params, evaluate_callback,
47
+ context_retrieval_enabled, context_query, fallback_model)
47
48
  q = AsyncChunkQueue()
48
49
  cls.run_async(cls.send_inference_request_async(chat_request, async_chunk_queue=q, evaluation_callback=evaluate_callback))
49
50
  return QueueIterable(q, timeout=timeout)
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import warnings
2
3
  from typing import Dict, Iterable, List, Mapping, Optional, Union
3
4
 
@@ -30,6 +31,7 @@ class Maitai:
30
31
  api_key: Optional[str] = None,
31
32
  openai_api_key: Optional[str] = None,
32
33
  groq_api_key: Optional[str] = None,
34
+ anthropic_api_key: Optional[str] = None,
33
35
  organization: Optional[str] = None,
34
36
  project: Optional[str] = None,
35
37
  base_url: Union[str, httpx.URL, None] = None,
@@ -40,26 +42,35 @@ class Maitai:
40
42
  http_client: Optional[httpx.Client] = None,
41
43
  _strict_response_validation: bool = False,
42
44
  ):
43
- if api_key:
44
- print("Warning: The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
45
45
  if maitai_api_key:
46
46
  config.initialize(maitai_api_key)
47
+ if api_key:
48
+ if not openai_api_key:
49
+ openai_api_key = api_key
50
+ if not groq_api_key:
51
+ groq_api_key = api_key
52
+ if not anthropic_api_key:
53
+ anthropic_api_key = api_key
47
54
  if openai_api_key:
48
55
  config.auth_keys.openai_api_key.key_value = openai_api_key
49
56
  if groq_api_key:
50
57
  config.auth_keys.groq_api_key.key_value = groq_api_key
51
- self.client = openai.OpenAI(
52
- api_key=api_key or openai_api_key,
53
- organization=organization,
54
- project=project,
55
- base_url=base_url,
56
- timeout=timeout,
57
- max_retries=max_retries,
58
- default_headers=default_headers,
59
- default_query=default_query,
60
- http_client=http_client,
61
- _strict_response_validation=_strict_response_validation,
62
- )
58
+ if anthropic_api_key:
59
+ config.auth_keys.anthropic_api_key.key_value = anthropic_api_key
60
+ self.client = None
61
+ if api_key or openai_api_key or os.environ.get("OPENAI_API_KEY"):
62
+ self.client = openai.OpenAI(
63
+ api_key=api_key or openai_api_key or os.environ.get("OPENAI_API_KEY"),
64
+ organization=organization,
65
+ project=project,
66
+ base_url=base_url,
67
+ timeout=timeout,
68
+ max_retries=max_retries,
69
+ default_headers=default_headers,
70
+ default_query=default_query,
71
+ http_client=http_client,
72
+ _strict_response_validation=_strict_response_validation,
73
+ )
63
74
  self.chat = Chat(self.client)
64
75
 
65
76
 
@@ -30,6 +30,7 @@ class MaitaiAsync:
30
30
  api_key: Optional[str] = None,
31
31
  openai_api_key: Optional[str] = None,
32
32
  groq_api_key: Optional[str] = None,
33
+ anthropic_api_key: Optional[str] = None,
33
34
  organization: Optional[str] = None,
34
35
  project: Optional[str] = None,
35
36
  base_url: Union[str, httpx.URL, None] = None,
@@ -41,14 +42,21 @@ class MaitaiAsync:
41
42
  _strict_response_validation: bool = False,
42
43
 
43
44
  ):
44
- if api_key:
45
- print("Warning: The api_key parameter is not supported by Maitai. Provide openai_api_key or groq_api_key instead")
46
45
  if maitai_api_key:
47
46
  config.initialize(maitai_api_key)
47
+ if api_key:
48
+ if not openai_api_key:
49
+ openai_api_key = api_key
50
+ if not groq_api_key:
51
+ groq_api_key = api_key
52
+ if not anthropic_api_key:
53
+ anthropic_api_key = api_key
48
54
  if openai_api_key:
49
55
  config.auth_keys.openai_api_key.key_value = openai_api_key
50
56
  if groq_api_key:
51
57
  config.auth_keys.groq_api_key.key_value = groq_api_key
58
+ if anthropic_api_key:
59
+ config.auth_keys.anthropic_api_key.key_value = anthropic_api_key
52
60
  self.client = openai.AsyncClient(
53
61
  api_key=api_key or openai_api_key,
54
62
  organization=organization,
@@ -1,5 +1,6 @@
1
1
  import functools
2
2
  import inspect
3
+ import sys
3
4
  from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, TypeVar, Union
4
5
 
5
6
  import openai
@@ -9,6 +10,9 @@ from openai.types import ChatModel
9
10
 
10
11
  import maitai_gen.chat as chat_types
11
12
  from maitai_common.utils.proto_utils import openai_messages_to_proto
13
+ from maitai_common.version import version
14
+
15
+ __version__ = f'{version}_python_{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}'
12
16
 
13
17
  CallableT = TypeVar("CallableT", bound=Callable[..., Any])
14
18
 
@@ -91,13 +95,6 @@ def convert_openai_chat_completion(chat: openai_types.ChatCompletion) -> chat_ty
91
95
  return chat_types.ChatCompletionResponse().from_dict(chat.to_dict())
92
96
 
93
97
 
94
- def _copy_choice(choice: Union[openai_types.chat_completion.Choice, chat_types.ChatCompletionChoice]) -> chat_types.ChatCompletionChoice:
95
- message = chat_types.ChatMessage(content=choice.message.content, role=choice.message.role)
96
- copied_choice = chat_types.ChatCompletionChoice(finish_reason=choice.finish_reason, index=choice.index,
97
- logprobs=choice.logprobs, message=message)
98
- return copied_choice
99
-
100
-
101
98
  def convert_open_ai_chat_completion_chunk(chunk: openai_types.ChatCompletionChunk) -> chat_types.ChatCompletionChunk:
102
99
  return chat_types.ChatCompletionChunk().from_dict(chunk.to_dict())
103
100
 
@@ -1,3 +1,3 @@
1
- version = "1.0.32b0"
1
+ version = "1.0.33b0"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -47,11 +47,17 @@ class ChatCompletionRequest(betterproto.Message):
47
47
  session_id: str = betterproto.string_field(3)
48
48
  reference_id: str = betterproto.string_field(4)
49
49
  action_type: str = betterproto.string_field(5)
50
- company_id: int = betterproto.int64_field(6)
50
+ company_id: Optional[int] = betterproto.int64_field(
51
+ 6, optional=True, group="_company_id"
52
+ )
51
53
  apply_corrections: bool = betterproto.bool_field(7)
52
54
  id: int = betterproto.int64_field(8)
53
- date_created: int = betterproto.int64_field(9)
54
- request_id: str = betterproto.string_field(10)
55
+ date_created: Optional[int] = betterproto.int64_field(
56
+ 9, optional=True, group="_date_created"
57
+ )
58
+ request_id: Optional[str] = betterproto.string_field(
59
+ 10, optional=True, group="_request_id"
60
+ )
55
61
  evaluation_enabled: bool = betterproto.bool_field(11)
56
62
  auth_info: "ChatCompletionAuth" = betterproto.message_field(12)
57
63
  return_evaluation: bool = betterproto.bool_field(13)
@@ -135,29 +141,51 @@ class ChatCompletionResponse(betterproto.Message):
135
141
  usage: "ChatCompletionUsage" = betterproto.message_field(8)
136
142
  request_id: str = betterproto.string_field(9)
137
143
  evaluate_response: Optional["EvaluateResponse"] = betterproto.message_field(
138
- 11, optional=True, group="_evaluate_response"
144
+ 10, optional=True, group="_evaluate_response"
139
145
  )
140
- correction_applied: bool = betterproto.bool_field(12)
141
- first_token_time: int = betterproto.int64_field(13)
142
- response_time: int = betterproto.int64_field(14)
146
+ correction_applied: bool = betterproto.bool_field(11)
147
+ first_token_time: int = betterproto.int64_field(12)
148
+ response_time: int = betterproto.int64_field(13)
143
149
  chat_completion_request: Optional["ChatCompletionRequest"] = (
144
- betterproto.message_field(15, optional=True, group="_chat_completion_request")
150
+ betterproto.message_field(14, optional=True, group="_chat_completion_request")
151
+ )
152
+ service_tier: Optional[str] = betterproto.string_field(
153
+ 15, optional=True, group="_service_tier"
145
154
  )
146
155
 
147
156
 
148
157
  @dataclass(eq=False, repr=False)
149
158
  class ChatCompletionChoice(betterproto.Message):
150
159
  index: int = betterproto.int32_field(1)
151
- message: "ChatMessage" = betterproto.message_field(2)
152
- logprobs: List[float] = betterproto.double_field(3)
160
+ message: "ChatCompletionMessage" = betterproto.message_field(2)
161
+ logprobs: "LogProbs" = betterproto.message_field(3)
153
162
  finish_reason: str = betterproto.string_field(4)
154
163
  is_correction: bool = betterproto.bool_field(5)
155
164
 
156
165
 
157
166
  @dataclass(eq=False, repr=False)
158
167
  class ChatMessage(betterproto.Message):
168
+ role: str = betterproto.string_field(1)
169
+ content: Optional[str] = betterproto.string_field(
170
+ 2, optional=True, group="_content"
171
+ )
172
+ name: Optional[str] = betterproto.string_field(3, optional=True, group="_name")
173
+
174
+
175
+ @dataclass(eq=False, repr=False)
176
+ class FunctionCall(betterproto.Message):
177
+ arguments: str = betterproto.string_field(1)
178
+ name: str = betterproto.string_field(2)
179
+
180
+
181
+ @dataclass(eq=False, repr=False)
182
+ class ChatCompletionMessage(betterproto.Message):
159
183
  role: str = betterproto.string_field(1)
160
184
  content: str = betterproto.string_field(2)
185
+ function_call: Optional["FunctionCall"] = betterproto.message_field(
186
+ 3, optional=True, group="_function_call"
187
+ )
188
+ tool_calls: List["ToolCall"] = betterproto.message_field(4)
161
189
 
162
190
 
163
191
  @dataclass(eq=False, repr=False)
@@ -172,7 +200,7 @@ class ChatCompletionUsage(betterproto.Message):
172
200
  @dataclass(eq=False, repr=False)
173
201
  class ChatCompletionChunk(betterproto.Message):
174
202
  id: str = betterproto.string_field(1)
175
- choices: List["Choice"] = betterproto.message_field(2)
203
+ choices: List["ChunkChoice"] = betterproto.message_field(2)
176
204
  created: int = betterproto.int64_field(3)
177
205
  model: str = betterproto.string_field(4)
178
206
  object: str = betterproto.string_field(5)
@@ -182,13 +210,26 @@ class ChatCompletionChunk(betterproto.Message):
182
210
  8, optional=True, group="_evaluate_response"
183
211
  )
184
212
  correction_applied: bool = betterproto.bool_field(9)
213
+ service_tier: Optional[str] = betterproto.string_field(
214
+ 10, optional=True, group="_service_tier"
215
+ )
216
+
217
+
218
+ @dataclass(eq=False, repr=False)
219
+ class ChunkChoice(betterproto.Message):
220
+ delta: "ChoiceDelta" = betterproto.message_field(1)
221
+ finish_reason: str = betterproto.string_field(2)
222
+ index: int = betterproto.int32_field(3)
223
+ logprobs: "LogProbs" = betterproto.message_field(4)
224
+ is_correction: bool = betterproto.bool_field(5)
185
225
 
186
226
 
187
227
  @dataclass(eq=False, repr=False)
188
228
  class ChoiceDelta(betterproto.Message):
189
229
  content: str = betterproto.string_field(1)
190
- role: str = betterproto.string_field(3)
191
- tool_calls: List["ToolCall"] = betterproto.message_field(4)
230
+ role: str = betterproto.string_field(2)
231
+ tool_calls: List["ToolCall"] = betterproto.message_field(3)
232
+ function_call: "FunctionCall" = betterproto.message_field(4)
192
233
 
193
234
 
194
235
  @dataclass(eq=False, repr=False)
@@ -196,6 +237,7 @@ class ToolCall(betterproto.Message):
196
237
  id: str = betterproto.string_field(1)
197
238
  type: str = betterproto.string_field(2)
198
239
  function: "ToolCallFunction" = betterproto.message_field(3)
240
+ index: int = betterproto.int64_field(4)
199
241
 
200
242
 
201
243
  @dataclass(eq=False, repr=False)
@@ -204,17 +246,9 @@ class ToolCallFunction(betterproto.Message):
204
246
  arguments: str = betterproto.string_field(2)
205
247
 
206
248
 
207
- @dataclass(eq=False, repr=False)
208
- class Choice(betterproto.Message):
209
- delta: "ChoiceDelta" = betterproto.message_field(1)
210
- finish_reason: str = betterproto.string_field(2)
211
- index: int = betterproto.int32_field(3)
212
- logprobs: List["LogProbs"] = betterproto.message_field(4)
213
-
214
-
215
249
  @dataclass(eq=False, repr=False)
216
250
  class LogProbs(betterproto.Message):
217
- content: "LogPropsContent" = betterproto.message_field(1)
251
+ content: List["LogPropsContent"] = betterproto.message_field(1)
218
252
 
219
253
 
220
254
  @dataclass(eq=False, repr=False)
@@ -243,12 +277,12 @@ class EvaluateRequest(betterproto.Message):
243
277
  action_type: str = betterproto.string_field(7)
244
278
  evaluation_content_type: "EvaluationContentType" = betterproto.enum_field(8)
245
279
  eval_results_set: Optional["EvaluateResponse"] = betterproto.message_field(
246
- 10, optional=True, group="_eval_results_set"
280
+ 9, optional=True, group="_eval_results_set"
247
281
  )
248
- company_id: int = betterproto.int64_field(11)
249
- evaluation_context: str = betterproto.string_field(13)
250
- text_content: str = betterproto.string_field(9)
251
- message_content: List["ChatMessage"] = betterproto.message_field(12)
282
+ company_id: int = betterproto.int64_field(10)
283
+ evaluation_context: str = betterproto.string_field(11)
284
+ text_content: str = betterproto.string_field(12)
285
+ message_content: List["ChatMessage"] = betterproto.message_field(13)
252
286
  request_id: str = betterproto.string_field(14)
253
287
  sentinel_id: int = betterproto.int64_field(15)
254
288
  fault_description: str = betterproto.string_field(16)
@@ -279,16 +313,16 @@ class EvaluateResult(betterproto.Message):
279
313
 
280
314
  @dataclass(eq=False, repr=False)
281
315
  class EvaluateResponse(betterproto.Message):
282
- application_id: int = betterproto.int64_field(3)
283
- session_id: str = betterproto.string_field(4)
284
- request_id: int = betterproto.int64_field(5)
285
- evaluation_results: List["EvaluateResult"] = betterproto.message_field(6)
286
- evaluation_request_id: str = betterproto.string_field(7)
316
+ application_id: int = betterproto.int64_field(1)
317
+ session_id: str = betterproto.string_field(2)
318
+ request_id: int = betterproto.int64_field(3)
319
+ evaluation_results: List["EvaluateResult"] = betterproto.message_field(4)
320
+ evaluation_request_id: str = betterproto.string_field(5)
287
321
  evaluation_request: Optional["EvaluateRequest"] = betterproto.message_field(
288
- 8, optional=True, group="_evaluation_request"
322
+ 6, optional=True, group="_evaluation_request"
289
323
  )
290
- evaluate_summary: str = betterproto.string_field(9)
291
- evaluation_time: int = betterproto.int64_field(10)
324
+ evaluate_summary: str = betterproto.string_field(7)
325
+ evaluation_time: int = betterproto.int64_field(8)
292
326
 
293
327
 
294
328
  @dataclass(eq=False, repr=False)
@@ -0,0 +1,19 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: event.proto
3
+ # plugin: python-betterproto
4
+ # This file has been @generated
5
+
6
+ from dataclasses import dataclass
7
+
8
+ import betterproto
9
+ import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
10
+
11
+
12
+ @dataclass(eq=False, repr=False)
13
+ class Event(betterproto.Message):
14
+ id: int = betterproto.int64_field(1)
15
+ date_created: int = betterproto.int64_field(2)
16
+ event_type: str = betterproto.string_field(3)
17
+ event_key: str = betterproto.string_field(4)
18
+ event_data: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(5)
19
+ source_ips: str = betterproto.string_field(6)
@@ -4,6 +4,7 @@
4
4
  # This file has been @generated
5
5
 
6
6
  from dataclasses import dataclass
7
+ from typing import Optional
7
8
 
8
9
  import betterproto
9
10
 
@@ -12,7 +13,9 @@ import betterproto
12
13
  class Key(betterproto.Message):
13
14
  id: int = betterproto.int64_field(1)
14
15
  date_created: int = betterproto.int64_field(2)
15
- key_value: str = betterproto.string_field(3)
16
+ key_value: Optional[str] = betterproto.string_field(
17
+ 3, optional=True, group="_key_value"
18
+ )
16
19
  company_id: int = betterproto.int64_field(4)
17
20
  description: str = betterproto.string_field(5)
18
21
  owner: str = betterproto.string_field(6)
@@ -27,18 +27,18 @@ class Session(betterproto.Message):
27
27
  date_created: int = betterproto.int64_field(2)
28
28
  application_id: int = betterproto.int64_field(3)
29
29
  application_name: Optional[str] = betterproto.string_field(
30
- 5, optional=True, group="_application_name"
30
+ 4, optional=True, group="_application_name"
31
31
  )
32
- fully_corrected: bool = betterproto.bool_field(6)
33
- summary: str = betterproto.string_field(7)
34
- feedback: "SessionFeedback" = betterproto.enum_field(8)
32
+ fully_corrected: bool = betterproto.bool_field(5)
33
+ summary: str = betterproto.string_field(6)
34
+ feedback: "SessionFeedback" = betterproto.enum_field(7)
35
35
  reviewer: Dict[str, str] = betterproto.map_field(
36
- 9, betterproto.TYPE_STRING, betterproto.TYPE_STRING
36
+ 8, betterproto.TYPE_STRING, betterproto.TYPE_STRING
37
37
  )
38
- date_ended: int = betterproto.int64_field(10)
39
- company_id: int = betterproto.int64_field(11)
38
+ date_ended: int = betterproto.int64_field(9)
39
+ company_id: int = betterproto.int64_field(10)
40
40
  meta: Dict[str, str] = betterproto.map_field(
41
- 12, betterproto.TYPE_STRING, betterproto.TYPE_STRING
41
+ 11, betterproto.TYPE_STRING, betterproto.TYPE_STRING
42
42
  )
43
- timeline: List["_chat__.Turn"] = betterproto.message_field(13)
44
- cost: int = betterproto.int64_field(14)
43
+ timeline: List["_chat__.Turn"] = betterproto.message_field(12)
44
+ cost: int = betterproto.int64_field(13)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maitai-python
3
- Version: 1.0.32b0
3
+ Version: 1.0.33b0
4
4
  Summary: Maitai SDK for Python
5
5
  Home-page: https://docs.trymaitai.ai
6
6
  Author: Maitai
@@ -28,6 +28,7 @@ maitai_gen/chat/__init__.py
28
28
  maitai_gen/company/__init__.py
29
29
  maitai_gen/config/__init__.py
30
30
  maitai_gen/embedding/__init__.py
31
+ maitai_gen/event/__init__.py
31
32
  maitai_gen/inference/__init__.py
32
33
  maitai_gen/key/__init__.py
33
34
  maitai_gen/model/__init__.py
@@ -1,6 +1,6 @@
1
1
  # setup.py
2
2
 
3
- from setuptools import setup, find_packages
3
+ from setuptools import find_packages, setup
4
4
 
5
5
  from maitai_common.version import version
6
6
 
@@ -4,8 +4,8 @@ from maitai._azure import MaitaiAsyncAzureOpenAIClient as AsyncAzureOpenAI, Mait
4
4
  from maitai._context import ContextManager
5
5
  from maitai._evaluator import Evaluator as Evaluator
6
6
  from maitai._inference import Inference as Inference
7
- from maitai._maitai_async import MaitaiAsync
8
7
  from maitai._maitai import Chat, Maitai
8
+ from maitai._maitai_async import MaitaiAsync
9
9
 
10
10
  chat = Chat()
11
11
  context = ContextManager()