maitai-python 1.0.30b1__tar.gz → 1.0.31b0__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 (47) hide show
  1. maitai_python-1.0.31b0/PKG-INFO +59 -0
  2. maitai_python-1.0.31b0/README.md +40 -0
  3. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/__init__.py +4 -2
  4. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_azure.py +2 -2
  5. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_inference.py +1 -1
  6. maitai_python-1.0.30b1/maitai/_openai.py → maitai_python-1.0.31b0/maitai/_maitai.py +2 -2
  7. maitai_python-1.0.30b1/maitai/_openai_async.py → maitai_python-1.0.31b0/maitai/_maitai_async.py +2 -2
  8. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/config/config_service.py +27 -21
  9. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/version.py +1 -1
  10. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/chat/__init__.py +1 -0
  11. maitai_python-1.0.31b0/maitai_gen/model/__init__.py +19 -0
  12. maitai_python-1.0.31b0/maitai_python.egg-info/PKG-INFO +59 -0
  13. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_python.egg-info/SOURCES.txt +4 -3
  14. maitai_python-1.0.30b1/PKG-INFO +0 -65
  15. maitai_python-1.0.30b1/README.md +0 -46
  16. maitai_python-1.0.30b1/maitai_python.egg-info/PKG-INFO +0 -65
  17. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_config.py +0 -0
  18. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_config_listener_thread.py +0 -0
  19. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_context.py +0 -0
  20. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_evaluator.py +0 -0
  21. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_maitai_client.py +0 -0
  22. /maitai_python-1.0.30b1/maitai/_openai_types.py → /maitai_python-1.0.31b0/maitai/_types.py +0 -0
  23. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai/_utils.py +0 -0
  24. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/__init__.py +0 -0
  25. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/config/__init__.py +0 -0
  26. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/processes/__init__.py +0 -0
  27. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/processes/io_thread.py +0 -0
  28. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/processes/websocket_listener_thread.py +0 -0
  29. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/utils/__init__.py +0 -0
  30. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/utils/proto_utils.py +0 -0
  31. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_common/utils/types.py +0 -0
  32. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/__init__.py +0 -0
  33. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/application/__init__.py +0 -0
  34. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/company/__init__.py +0 -0
  35. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/config/__init__.py +0 -0
  36. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/embedding/__init__.py +0 -0
  37. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/inference/__init__.py +0 -0
  38. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/key/__init__.py +0 -0
  39. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/notification/__init__.py +0 -0
  40. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/sandbox/__init__.py +0 -0
  41. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/sentinel/__init__.py +0 -0
  42. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_gen/session/__init__.py +0 -0
  43. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_python.egg-info/dependency_links.txt +0 -0
  44. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_python.egg-info/requires.txt +0 -0
  45. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/maitai_python.egg-info/top_level.txt +0 -0
  46. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/setup.cfg +0 -0
  47. {maitai_python-1.0.30b1 → maitai_python-1.0.31b0}/setup.py +0 -0
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.1
2
+ Name: maitai-python
3
+ Version: 1.0.31b0
4
+ Summary: Maitai SDK for Python
5
+ Home-page: https://docs.trymaitai.ai
6
+ Author: Maitai
7
+ Author-email: support@trymaitai.ai
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: requests
13
+ Requires-Dist: openai==1.34.0
14
+ Requires-Dist: betterproto
15
+ Requires-Dist: httpx
16
+ Requires-Dist: aiohttp
17
+ Requires-Dist: betterproto==2.0.0b6
18
+ Requires-Dist: websocket-client
19
+
20
+ # Quickstart
21
+
22
+ Full docs can be found at https://docs.trymaitai.ai
23
+
24
+ ## Installation
25
+
26
+ Install the Maitai SDK:
27
+
28
+ ```bash
29
+ pip install maitai-python
30
+ ```
31
+
32
+ ## Implementation
33
+
34
+ Implementing Maitai into your application requires minimal code changes.
35
+
36
+ ```python
37
+ import maitai
38
+
39
+ messages = [
40
+ {"role": "system", "content": "You are a helpful ordering assistant..."},
41
+ {"role": "user", "content": "Generate a response to the customer..."},
42
+ ]
43
+
44
+ response = maitai.chat.completions.create(
45
+ messages=messages,
46
+ model="llama3-70b-8192", ## Remove this line to set model in Portal
47
+ session_id="YOUR_SESSION_ID",
48
+ intent="CONVERSATION",
49
+ application_ref_name="YOUR_APPLICATION_REF_NAME",
50
+ )
51
+ ```
52
+
53
+ **Note**
54
+ Maitai requires `openai` version `1.30.1` or later. If you are using an older version, please upgrade.
55
+
56
+ ## Run Your Application
57
+
58
+ Run your application, make sure it makes at least one Chat Completion Request, then head over
59
+ to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
@@ -0,0 +1,40 @@
1
+ # Quickstart
2
+
3
+ Full docs can be found at https://docs.trymaitai.ai
4
+
5
+ ## Installation
6
+
7
+ Install the Maitai SDK:
8
+
9
+ ```bash
10
+ pip install maitai-python
11
+ ```
12
+
13
+ ## Implementation
14
+
15
+ Implementing Maitai into your application requires minimal code changes.
16
+
17
+ ```python
18
+ import maitai
19
+
20
+ messages = [
21
+ {"role": "system", "content": "You are a helpful ordering assistant..."},
22
+ {"role": "user", "content": "Generate a response to the customer..."},
23
+ ]
24
+
25
+ response = maitai.chat.completions.create(
26
+ messages=messages,
27
+ model="llama3-70b-8192", ## Remove this line to set model in Portal
28
+ session_id="YOUR_SESSION_ID",
29
+ intent="CONVERSATION",
30
+ application_ref_name="YOUR_APPLICATION_REF_NAME",
31
+ )
32
+ ```
33
+
34
+ **Note**
35
+ Maitai requires `openai` version `1.30.1` or later. If you are using an older version, please upgrade.
36
+
37
+ ## Run Your Application
38
+
39
+ Run your application, make sure it makes at least one Chat Completion Request, then head over
40
+ to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
@@ -4,11 +4,13 @@ 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._openai import Chat, MaitaiOpenAIClient as OpenAI
8
- from maitai._openai_async import MaitaiAsyncOpenAIClient as AsyncOpenAI
7
+ from maitai._maitai_async import MaitaiAsync
8
+ from maitai._maitai import Chat, Maitai
9
9
 
10
10
  chat = Chat()
11
11
  context = ContextManager()
12
+ AsyncOpenAI = MaitaiAsync
13
+ OpenAI = Maitai
12
14
 
13
15
 
14
16
  def initialize(api_key):
@@ -5,8 +5,8 @@ import openai
5
5
  from openai.lib.azure import AsyncAzureADTokenProvider, AzureADTokenProvider
6
6
 
7
7
  from maitai._config import config
8
- from maitai._openai import Chat
9
- from maitai._openai_async import AsyncChat
8
+ from maitai._maitai import Chat
9
+ from maitai._maitai_async import AsyncChat
10
10
 
11
11
  DEFAULT_MAX_RETRIES = 2
12
12
 
@@ -101,7 +101,7 @@ class Inference(MaitaiClient):
101
101
  async with session.post(url, headers=headers, data=chat_request.to_json(casing=Casing.SNAKE)) as response:
102
102
  if response.status != 200:
103
103
  error_text = await response.text()
104
- print(f"Failed to send evaluation request. Status code: {response.status}. Error: {error_text}")
104
+ print(f"Failed to send inference request. Status code: {response.status}. Error: {error_text}")
105
105
  if chunk_queue:
106
106
  chunk_queue.put(StopIteration())
107
107
  if async_chunk_queue:
@@ -11,7 +11,7 @@ import maitai
11
11
  from maitai._config import config
12
12
  from maitai._evaluator import Evaluator
13
13
  from maitai._inference import InferenceException, InferenceWarning
14
- from maitai._openai_types import Body, Headers, Query
14
+ from maitai._types import Body, Headers, Query
15
15
  from maitai._utils import convert_open_ai_chat_completion_chunk, convert_openai_chat_completion, get_chat_completion_params, required_args
16
16
  from maitai_common.utils.proto_utils import openai_messages_to_proto
17
17
  from maitai_common.utils.types import EvaluateCallback
@@ -22,7 +22,7 @@ from maitai_gen.inference import InferenceStreamResponse
22
22
  DEFAULT_MAX_RETRIES = 2
23
23
 
24
24
 
25
- class MaitaiOpenAIClient:
25
+ class Maitai:
26
26
  def __init__(
27
27
  self,
28
28
  *,
@@ -11,7 +11,7 @@ import maitai
11
11
  from maitai._config import config
12
12
  from maitai._evaluator import Evaluator
13
13
  from maitai._inference import InferenceException, InferenceWarning
14
- from maitai._openai_types import Body, Headers, Query
14
+ from maitai._types import Body, Headers, Query
15
15
  from maitai._utils import convert_open_ai_chat_completion_chunk, convert_openai_chat_completion, get_chat_completion_params, required_args
16
16
  from maitai_common.utils.proto_utils import openai_messages_to_proto
17
17
  from maitai_common.utils.types import EvaluateCallback
@@ -22,7 +22,7 @@ from maitai_gen.inference import InferenceStreamResponse
22
22
  DEFAULT_MAX_RETRIES = 2
23
23
 
24
24
 
25
- class MaitaiAsyncOpenAIClient:
25
+ class MaitaiAsync:
26
26
  def __init__(
27
27
  self,
28
28
  *,
@@ -2,24 +2,27 @@ from betterproto import Casing
2
2
 
3
3
  from maitai_gen.config import Config, InferenceLocations, ModelConfig
4
4
 
5
- # TODO consider finding a source of truth where we don't need to deploy everytime a new model comes out
6
- SERVER_PROVIDERS = ["groq", "openai"]
5
+ from maitai_back.services import model_service
6
+
7
+ SERVER_PROVIDERS = ["groq", "openai", "anthropic"]
7
8
  CLIENT_PROVIDERS = ["openai"]
8
9
 
9
- MODELS = {
10
- "llama3-70b-8192": "groq",
11
- "llama3-8b-8192": "groq",
12
- "gpt-4o": "openai",
13
- "gpt-4o-2024-05-13": "openai",
14
- "gpt-4-turbo": "openai",
15
- "gpt-4-turbo-2024-04-09": "openai",
16
- "gpt-4": "openai",
17
- "gpt-3.5-turbo": "openai",
18
- "claude-3-5-sonnet-20240620": "anthropic",
19
- "claude-3-opus-20240229": "anthropic",
20
- "claude-3-sonnet-20240229": "anthropic",
21
- "claude-3-haiku-20240307": "anthropic"
22
- }
10
+
11
+ # Initialize MODELS and last_fetch_time as global variables
12
+ import time
13
+
14
+ MODELS = None
15
+ LAST_FETCH_TIME = None
16
+ TTL = 60 * 60
17
+
18
+ def initialize_models():
19
+ global MODELS, LAST_FETCH_TIME
20
+ current_time = time.time()
21
+ if MODELS is None or (current_time - LAST_FETCH_TIME) > TTL:
22
+ MODELS = model_service.get_models(-1)
23
+ LAST_FETCH_TIME = current_time
24
+
25
+ initialize_models()
23
26
 
24
27
  DEFAULT_CLIENT_MODEL = "gpt-4o"
25
28
  DEFAULT_SERVER_MODEL = "llama3-70b-8192"
@@ -54,20 +57,23 @@ def reconcile_config_with_default(config_dict: dict) -> Config:
54
57
 
55
58
 
56
59
  def get_model_provider(model_name: str):
57
- return MODELS.get(model_name)
60
+ for model in MODELS:
61
+ if model.model == model_name:
62
+ return model.provider
63
+ return None
58
64
 
59
65
 
60
66
  def get_models(providers):
61
67
  models = []
62
- for model_name, provider in MODELS.items():
63
- if provider in providers:
64
- models.append(model_name)
68
+ for model in MODELS:
69
+ if model.provider in providers:
70
+ models.append(model.model)
65
71
  return models
66
72
 
67
73
 
68
74
  def get_available_models():
69
75
  model_config = ModelConfig(
70
- all_models=list(MODELS.keys()),
76
+ all_models=[m.model for m in MODELS],
71
77
  client_models=get_models(CLIENT_PROVIDERS),
72
78
  server_models=get_models(SERVER_PROVIDERS),
73
79
  default_client_model=DEFAULT_CLIENT_MODEL,
@@ -1,3 +1,3 @@
1
- version = "1.0.30b1"
1
+ version = "1.0.31b0"
2
2
  if __name__ == "__main__":
3
3
  print(version)
@@ -251,6 +251,7 @@ class EvaluateRequest(betterproto.Message):
251
251
  chat_completion_response: Optional["ChatCompletionResponse"] = (
252
252
  betterproto.message_field(18, optional=True, group="_chat_completion_response")
253
253
  )
254
+ timeout: float = betterproto.float_field(19)
254
255
 
255
256
 
256
257
  @dataclass(eq=False, repr=False)
@@ -0,0 +1,19 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: model.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 Model(betterproto.Message):
13
+ id: int = betterproto.int64_field(1)
14
+ date_added: int = betterproto.int64_field(2)
15
+ company_id: int = betterproto.int64_field(3)
16
+ provider: str = betterproto.string_field(4)
17
+ model: str = betterproto.string_field(5)
18
+ points_to: str = betterproto.string_field(6)
19
+ status: str = betterproto.string_field(7)
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.1
2
+ Name: maitai-python
3
+ Version: 1.0.31b0
4
+ Summary: Maitai SDK for Python
5
+ Home-page: https://docs.trymaitai.ai
6
+ Author: Maitai
7
+ Author-email: support@trymaitai.ai
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: requests
13
+ Requires-Dist: openai==1.34.0
14
+ Requires-Dist: betterproto
15
+ Requires-Dist: httpx
16
+ Requires-Dist: aiohttp
17
+ Requires-Dist: betterproto==2.0.0b6
18
+ Requires-Dist: websocket-client
19
+
20
+ # Quickstart
21
+
22
+ Full docs can be found at https://docs.trymaitai.ai
23
+
24
+ ## Installation
25
+
26
+ Install the Maitai SDK:
27
+
28
+ ```bash
29
+ pip install maitai-python
30
+ ```
31
+
32
+ ## Implementation
33
+
34
+ Implementing Maitai into your application requires minimal code changes.
35
+
36
+ ```python
37
+ import maitai
38
+
39
+ messages = [
40
+ {"role": "system", "content": "You are a helpful ordering assistant..."},
41
+ {"role": "user", "content": "Generate a response to the customer..."},
42
+ ]
43
+
44
+ response = maitai.chat.completions.create(
45
+ messages=messages,
46
+ model="llama3-70b-8192", ## Remove this line to set model in Portal
47
+ session_id="YOUR_SESSION_ID",
48
+ intent="CONVERSATION",
49
+ application_ref_name="YOUR_APPLICATION_REF_NAME",
50
+ )
51
+ ```
52
+
53
+ **Note**
54
+ Maitai requires `openai` version `1.30.1` or later. If you are using an older version, please upgrade.
55
+
56
+ ## Run Your Application
57
+
58
+ Run your application, make sure it makes at least one Chat Completion Request, then head over
59
+ to `https://portal.trymaitai.ai` and watch Maitai learn your application in real time.
@@ -7,10 +7,10 @@ maitai/_config_listener_thread.py
7
7
  maitai/_context.py
8
8
  maitai/_evaluator.py
9
9
  maitai/_inference.py
10
+ maitai/_maitai.py
11
+ maitai/_maitai_async.py
10
12
  maitai/_maitai_client.py
11
- maitai/_openai.py
12
- maitai/_openai_async.py
13
- maitai/_openai_types.py
13
+ maitai/_types.py
14
14
  maitai/_utils.py
15
15
  maitai_common/__init__.py
16
16
  maitai_common/version.py
@@ -30,6 +30,7 @@ maitai_gen/config/__init__.py
30
30
  maitai_gen/embedding/__init__.py
31
31
  maitai_gen/inference/__init__.py
32
32
  maitai_gen/key/__init__.py
33
+ maitai_gen/model/__init__.py
33
34
  maitai_gen/notification/__init__.py
34
35
  maitai_gen/sandbox/__init__.py
35
36
  maitai_gen/sentinel/__init__.py
@@ -1,65 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: maitai-python
3
- Version: 1.0.30b1
4
- Summary: Maitai SDK for Python
5
- Home-page: https://docs.trymaitai.ai
6
- Author: Maitai
7
- Author-email: support@trymaitai.ai
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: requests
13
- Requires-Dist: openai==1.34.0
14
- Requires-Dist: betterproto
15
- Requires-Dist: httpx
16
- Requires-Dist: aiohttp
17
- Requires-Dist: betterproto==2.0.0b6
18
- Requires-Dist: websocket-client
19
-
20
- # Quickstart
21
-
22
- Full docs can be found at https://docs.trymaitai.ai
23
-
24
- ## Configure your application in the Maitai portal
25
-
26
- From the [Maitai Portal](https://portal.trymaitai.ai/), click the `+ New Application` button to create your first
27
- application.
28
-
29
- Fill out your application details, and note the `Application Reference` - you'll need that later
30
-
31
- ## Create your first sentinel
32
-
33
- Maitai will analyze your application and automatically create sentinels for you over time. However, if you want to
34
- enable governance immediately, you can manually create sentinels as well.
35
-
36
- Find your application in the portal and click the `+` button to create a new sentinel.
37
-
38
- ## Installation
39
-
40
- Install the Maitai SDK:
41
-
42
- ```bash
43
- pip install maitai-python
44
- ```
45
-
46
- ## Implementation
47
-
48
- Integrating Maitai into your application requires minimal code changes
49
-
50
- ```python
51
- import maitai as openai
52
-
53
- messages = [
54
- {"role": "system", "content": "You are a helpful assistant"},
55
- {"role": "user", "content": "Generate numbers 1-10"},
56
- ]
57
-
58
- response = openai.chat.completions.create(
59
- messages=messages,
60
- model="gpt-4",
61
- session_id="YOUR_SESSION_ID",
62
- intent="NUMBER_GENERATOR",
63
- application_ref_name="YOUR_APPLICATION_REF_NAME",
64
- )
65
- ```
@@ -1,46 +0,0 @@
1
- # Quickstart
2
-
3
- Full docs can be found at https://docs.trymaitai.ai
4
-
5
- ## Configure your application in the Maitai portal
6
-
7
- From the [Maitai Portal](https://portal.trymaitai.ai/), click the `+ New Application` button to create your first
8
- application.
9
-
10
- Fill out your application details, and note the `Application Reference` - you'll need that later
11
-
12
- ## Create your first sentinel
13
-
14
- Maitai will analyze your application and automatically create sentinels for you over time. However, if you want to
15
- enable governance immediately, you can manually create sentinels as well.
16
-
17
- Find your application in the portal and click the `+` button to create a new sentinel.
18
-
19
- ## Installation
20
-
21
- Install the Maitai SDK:
22
-
23
- ```bash
24
- pip install maitai-python
25
- ```
26
-
27
- ## Implementation
28
-
29
- Integrating Maitai into your application requires minimal code changes
30
-
31
- ```python
32
- import maitai as openai
33
-
34
- messages = [
35
- {"role": "system", "content": "You are a helpful assistant"},
36
- {"role": "user", "content": "Generate numbers 1-10"},
37
- ]
38
-
39
- response = openai.chat.completions.create(
40
- messages=messages,
41
- model="gpt-4",
42
- session_id="YOUR_SESSION_ID",
43
- intent="NUMBER_GENERATOR",
44
- application_ref_name="YOUR_APPLICATION_REF_NAME",
45
- )
46
- ```
@@ -1,65 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: maitai-python
3
- Version: 1.0.30b1
4
- Summary: Maitai SDK for Python
5
- Home-page: https://docs.trymaitai.ai
6
- Author: Maitai
7
- Author-email: support@trymaitai.ai
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: requests
13
- Requires-Dist: openai==1.34.0
14
- Requires-Dist: betterproto
15
- Requires-Dist: httpx
16
- Requires-Dist: aiohttp
17
- Requires-Dist: betterproto==2.0.0b6
18
- Requires-Dist: websocket-client
19
-
20
- # Quickstart
21
-
22
- Full docs can be found at https://docs.trymaitai.ai
23
-
24
- ## Configure your application in the Maitai portal
25
-
26
- From the [Maitai Portal](https://portal.trymaitai.ai/), click the `+ New Application` button to create your first
27
- application.
28
-
29
- Fill out your application details, and note the `Application Reference` - you'll need that later
30
-
31
- ## Create your first sentinel
32
-
33
- Maitai will analyze your application and automatically create sentinels for you over time. However, if you want to
34
- enable governance immediately, you can manually create sentinels as well.
35
-
36
- Find your application in the portal and click the `+` button to create a new sentinel.
37
-
38
- ## Installation
39
-
40
- Install the Maitai SDK:
41
-
42
- ```bash
43
- pip install maitai-python
44
- ```
45
-
46
- ## Implementation
47
-
48
- Integrating Maitai into your application requires minimal code changes
49
-
50
- ```python
51
- import maitai as openai
52
-
53
- messages = [
54
- {"role": "system", "content": "You are a helpful assistant"},
55
- {"role": "user", "content": "Generate numbers 1-10"},
56
- ]
57
-
58
- response = openai.chat.completions.create(
59
- messages=messages,
60
- model="gpt-4",
61
- session_id="YOUR_SESSION_ID",
62
- intent="NUMBER_GENERATOR",
63
- application_ref_name="YOUR_APPLICATION_REF_NAME",
64
- )
65
- ```