maitai-python 1.0.31__tar.gz → 1.0.31b1__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.
- maitai_python-1.0.31b1/PKG-INFO +59 -0
- maitai_python-1.0.31b1/README.md +40 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/__init__.py +4 -2
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_azure.py +2 -2
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_inference.py +1 -1
- maitai_python-1.0.31/maitai/_openai.py → maitai_python-1.0.31b1/maitai/_maitai.py +2 -2
- maitai_python-1.0.31/maitai/_openai_async.py → maitai_python-1.0.31b1/maitai/_maitai_async.py +2 -2
- maitai_python-1.0.31b1/maitai_common/config/config_service.py +31 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/version.py +1 -1
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/chat/__init__.py +1 -0
- maitai_python-1.0.31b1/maitai_gen/model/__init__.py +19 -0
- maitai_python-1.0.31b1/maitai_python.egg-info/PKG-INFO +59 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_python.egg-info/SOURCES.txt +4 -3
- maitai_python-1.0.31/PKG-INFO +0 -65
- maitai_python-1.0.31/README.md +0 -46
- maitai_python-1.0.31/maitai_common/config/config_service.py +0 -76
- maitai_python-1.0.31/maitai_python.egg-info/PKG-INFO +0 -65
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_config.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_config_listener_thread.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_context.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_evaluator.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_maitai_client.py +0 -0
- /maitai_python-1.0.31/maitai/_openai_types.py → /maitai_python-1.0.31b1/maitai/_types.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai/_utils.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/config/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/processes/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/processes/io_thread.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/processes/websocket_listener_thread.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/utils/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/utils/proto_utils.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/utils/types.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/application/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/company/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/config/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/embedding/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/inference/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/key/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/notification/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/sandbox/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/sentinel/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_gen/session/__init__.py +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_python.egg-info/dependency_links.txt +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_python.egg-info/requires.txt +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_python.egg-info/top_level.txt +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/setup.cfg +0 -0
- {maitai_python-1.0.31 → maitai_python-1.0.31b1}/setup.py +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: maitai-python
|
|
3
|
+
Version: 1.0.31b1
|
|
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.
|
|
8
|
-
from maitai.
|
|
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.
|
|
9
|
-
from maitai.
|
|
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
|
|
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.
|
|
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
|
|
25
|
+
class Maitai:
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
28
|
*,
|
maitai_python-1.0.31/maitai/_openai_async.py → maitai_python-1.0.31b1/maitai/_maitai_async.py
RENAMED
|
@@ -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.
|
|
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
|
|
25
|
+
class MaitaiAsync:
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
28
|
*,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from betterproto import Casing
|
|
2
|
+
|
|
3
|
+
from maitai_gen.config import Config, InferenceLocations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_default_config() -> Config:
|
|
7
|
+
return Config(
|
|
8
|
+
inference_location=InferenceLocations.SERVER,
|
|
9
|
+
evaluation_enabled=True,
|
|
10
|
+
apply_corrections=True,
|
|
11
|
+
model='gpt-4o',
|
|
12
|
+
temperature=1,
|
|
13
|
+
streaming=False,
|
|
14
|
+
response_format="text",
|
|
15
|
+
stop=None,
|
|
16
|
+
logprobs=False,
|
|
17
|
+
max_tokens=None,
|
|
18
|
+
n=1,
|
|
19
|
+
frequency_penalty=0,
|
|
20
|
+
presence_penalty=0,
|
|
21
|
+
timeout=-1,
|
|
22
|
+
context_retrieval_enabled=False,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def reconcile_config_with_default(config_dict: dict) -> Config:
|
|
27
|
+
default_config_json = get_default_config().to_pydict(casing=Casing.SNAKE)
|
|
28
|
+
for key, value in default_config_json.items():
|
|
29
|
+
if key not in config_dict:
|
|
30
|
+
config_dict[key] = value
|
|
31
|
+
return Config().from_pydict(config_dict)
|
|
@@ -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.31b1
|
|
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/
|
|
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
|
maitai_python-1.0.31/PKG-INFO
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: maitai-python
|
|
3
|
-
Version: 1.0.31
|
|
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
|
-
```
|
maitai_python-1.0.31/README.md
DELETED
|
@@ -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,76 +0,0 @@
|
|
|
1
|
-
from betterproto import Casing
|
|
2
|
-
|
|
3
|
-
from maitai_gen.config import Config, InferenceLocations, ModelConfig
|
|
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"]
|
|
7
|
-
CLIENT_PROVIDERS = ["openai"]
|
|
8
|
-
|
|
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
|
-
}
|
|
23
|
-
|
|
24
|
-
DEFAULT_CLIENT_MODEL = "gpt-4o"
|
|
25
|
-
DEFAULT_SERVER_MODEL = "llama3-70b-8192"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_default_config() -> Config:
|
|
29
|
-
return Config(
|
|
30
|
-
inference_location=InferenceLocations.SERVER,
|
|
31
|
-
evaluation_enabled=True,
|
|
32
|
-
apply_corrections=True,
|
|
33
|
-
model='gpt-4o',
|
|
34
|
-
temperature=1,
|
|
35
|
-
streaming=False,
|
|
36
|
-
response_format="text",
|
|
37
|
-
stop=None,
|
|
38
|
-
logprobs=False,
|
|
39
|
-
max_tokens=None,
|
|
40
|
-
n=1,
|
|
41
|
-
frequency_penalty=0,
|
|
42
|
-
presence_penalty=0,
|
|
43
|
-
timeout=-1,
|
|
44
|
-
context_retrieval_enabled=False,
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def reconcile_config_with_default(config_dict: dict) -> Config:
|
|
49
|
-
default_config_json = get_default_config().to_pydict(casing=Casing.SNAKE)
|
|
50
|
-
for key, value in default_config_json.items():
|
|
51
|
-
if key not in config_dict:
|
|
52
|
-
config_dict[key] = value
|
|
53
|
-
return Config().from_pydict(config_dict)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def get_model_provider(model_name: str):
|
|
57
|
-
return MODELS.get(model_name)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def get_models(providers):
|
|
61
|
-
models = []
|
|
62
|
-
for model_name, provider in MODELS.items():
|
|
63
|
-
if provider in providers:
|
|
64
|
-
models.append(model_name)
|
|
65
|
-
return models
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def get_available_models():
|
|
69
|
-
model_config = ModelConfig(
|
|
70
|
-
all_models=list(MODELS.keys()),
|
|
71
|
-
client_models=get_models(CLIENT_PROVIDERS),
|
|
72
|
-
server_models=get_models(SERVER_PROVIDERS),
|
|
73
|
-
default_client_model=DEFAULT_CLIENT_MODEL,
|
|
74
|
-
default_server_model=DEFAULT_SERVER_MODEL,
|
|
75
|
-
)
|
|
76
|
-
return model_config.to_pydict(casing=Casing.SNAKE)
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: maitai-python
|
|
3
|
-
Version: 1.0.31
|
|
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
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{maitai_python-1.0.31 → maitai_python-1.0.31b1}/maitai_common/processes/websocket_listener_thread.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|