omai 1.0.0__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.
- omai-1.0.0/PKG-INFO +129 -0
- omai-1.0.0/README.md +114 -0
- omai-1.0.0/omai.egg-info/PKG-INFO +129 -0
- omai-1.0.0/omai.egg-info/SOURCES.txt +9 -0
- omai-1.0.0/omai.egg-info/dependency_links.txt +1 -0
- omai-1.0.0/omai.egg-info/requires.txt +1 -0
- omai-1.0.0/omai.egg-info/top_level.txt +1 -0
- omai-1.0.0/omai_client/__init__.py +63 -0
- omai-1.0.0/omai_client/vlx_api_client.py +939 -0
- omai-1.0.0/setup.cfg +4 -0
- omai-1.0.0/setup.py +20 -0
omai-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: omai
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK for Omai VLX API
|
|
5
|
+
Home-page: UNKNOWN
|
|
6
|
+
Author: Omai
|
|
7
|
+
License: UNKNOWN
|
|
8
|
+
Platform: UNKNOWN
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# omai-client Python SDK
|
|
15
|
+
|
|
16
|
+
这是 Omai VLX Python SDK,当前覆盖 VLX 相关接口:
|
|
17
|
+
|
|
18
|
+
- `vlx_seek`:VLX-Seek 多模态同步调用
|
|
19
|
+
- `vlx_flow_stream`:创建 VLX 流式任务并消费原始 SSE 事件
|
|
20
|
+
- `vlx_flow_stream_message`:创建 VLX 流式任务并消费业务消息
|
|
21
|
+
- `vlx_flow_stream_raw`:返回原始流式响应
|
|
22
|
+
- `vlx_flow_stop`:停止 VLX 流式任务
|
|
23
|
+
- `vlx_flow_update_config`:更新 VLX 流式任务配置
|
|
24
|
+
|
|
25
|
+
## 安装 tar.gz
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install ./dist/omai-1.0.0.tar.gz
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 单文件验证
|
|
32
|
+
|
|
33
|
+
如果只是临时验证,可以直接把 `dist_single/vlx_api_client.py` 放到业务项目里:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from vlx_api_client import VlxApiClient, VlxSeekRequest, VlxSeekMessage, VlxSeekContent
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
单文件版和包版本共用同一份核心代码。真实 HTTP 请求依赖 `requests`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install requests
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 环境变量配置
|
|
46
|
+
|
|
47
|
+
Python SDK 推荐使用环境变量:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
export VLX_API_ENABLED=true
|
|
51
|
+
export VLX_API_ENDPOINT=http://linker-gateway-service:31003/
|
|
52
|
+
export VLX_API_KEY=aaas_xxx
|
|
53
|
+
export VLX_API_CONNECT_TIMEOUT_MS=60000
|
|
54
|
+
export VLX_API_READ_TIMEOUT_MS=60000
|
|
55
|
+
export VLX_API_WRITE_TIMEOUT_MS=60000
|
|
56
|
+
export VLX_API_STREAM_READ_TIMEOUT_MS=0
|
|
57
|
+
export VLX_API_CLIENT_NUM=2048
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`VLX_API_STREAM_READ_TIMEOUT_MS=0` 表示流式接口不启用读超时,适合 12/24 小时 SSE 长连接。
|
|
61
|
+
|
|
62
|
+
## VLX-Seek 示例
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from omai_client import (
|
|
66
|
+
VlxApiClient,
|
|
67
|
+
VlxSeekContent,
|
|
68
|
+
VlxSeekImageUrl,
|
|
69
|
+
VlxSeekMessage,
|
|
70
|
+
VlxSeekRequest,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
client = VlxApiClient.from_env()
|
|
74
|
+
|
|
75
|
+
request = VlxSeekRequest(
|
|
76
|
+
model="VLX-Seek",
|
|
77
|
+
messages=[
|
|
78
|
+
VlxSeekMessage(
|
|
79
|
+
role="user",
|
|
80
|
+
content=[
|
|
81
|
+
VlxSeekContent(type="text", text="请描述图片内容"),
|
|
82
|
+
VlxSeekContent(
|
|
83
|
+
type="image_url",
|
|
84
|
+
image_url=VlxSeekImageUrl(url="https://example.com/a.jpg"),
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
)
|
|
88
|
+
],
|
|
89
|
+
max_tokens=512,
|
|
90
|
+
temperature=0.2,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = client.vlx_seek(request)
|
|
94
|
+
print(response.choices[0].message.content)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 流式消息示例
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from omai_client import VlxApiClient, VlxFlowSource, VlxFlowStreamRequest
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Handler:
|
|
104
|
+
def on_event(self, message):
|
|
105
|
+
print(message.event, message.content)
|
|
106
|
+
|
|
107
|
+
def on_error(self, throwable):
|
|
108
|
+
print("error:", throwable)
|
|
109
|
+
|
|
110
|
+
def on_closed(self):
|
|
111
|
+
print("closed")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
client = VlxApiClient.from_env()
|
|
115
|
+
call = client.vlx_flow_stream_message(
|
|
116
|
+
VlxFlowStreamRequest(
|
|
117
|
+
source=VlxFlowSource(path="rtsp://camera", type=1),
|
|
118
|
+
prompt="识别画面中的异常情况",
|
|
119
|
+
frame_preempt="qa",
|
|
120
|
+
model="VLX-Stream",
|
|
121
|
+
),
|
|
122
|
+
Handler(),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# 需要停止本地 SSE 长连接时调用。
|
|
126
|
+
# call.cancel()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
omai-1.0.0/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# omai-client Python SDK
|
|
2
|
+
|
|
3
|
+
这是 Omai VLX Python SDK,当前覆盖 VLX 相关接口:
|
|
4
|
+
|
|
5
|
+
- `vlx_seek`:VLX-Seek 多模态同步调用
|
|
6
|
+
- `vlx_flow_stream`:创建 VLX 流式任务并消费原始 SSE 事件
|
|
7
|
+
- `vlx_flow_stream_message`:创建 VLX 流式任务并消费业务消息
|
|
8
|
+
- `vlx_flow_stream_raw`:返回原始流式响应
|
|
9
|
+
- `vlx_flow_stop`:停止 VLX 流式任务
|
|
10
|
+
- `vlx_flow_update_config`:更新 VLX 流式任务配置
|
|
11
|
+
|
|
12
|
+
## 安装 tar.gz
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install ./dist/omai-1.0.0.tar.gz
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 单文件验证
|
|
19
|
+
|
|
20
|
+
如果只是临时验证,可以直接把 `dist_single/vlx_api_client.py` 放到业务项目里:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from vlx_api_client import VlxApiClient, VlxSeekRequest, VlxSeekMessage, VlxSeekContent
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
单文件版和包版本共用同一份核心代码。真实 HTTP 请求依赖 `requests`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install requests
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 环境变量配置
|
|
33
|
+
|
|
34
|
+
Python SDK 推荐使用环境变量:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export VLX_API_ENABLED=true
|
|
38
|
+
export VLX_API_ENDPOINT=http://linker-gateway-service:31003/
|
|
39
|
+
export VLX_API_KEY=aaas_xxx
|
|
40
|
+
export VLX_API_CONNECT_TIMEOUT_MS=60000
|
|
41
|
+
export VLX_API_READ_TIMEOUT_MS=60000
|
|
42
|
+
export VLX_API_WRITE_TIMEOUT_MS=60000
|
|
43
|
+
export VLX_API_STREAM_READ_TIMEOUT_MS=0
|
|
44
|
+
export VLX_API_CLIENT_NUM=2048
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`VLX_API_STREAM_READ_TIMEOUT_MS=0` 表示流式接口不启用读超时,适合 12/24 小时 SSE 长连接。
|
|
48
|
+
|
|
49
|
+
## VLX-Seek 示例
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from omai_client import (
|
|
53
|
+
VlxApiClient,
|
|
54
|
+
VlxSeekContent,
|
|
55
|
+
VlxSeekImageUrl,
|
|
56
|
+
VlxSeekMessage,
|
|
57
|
+
VlxSeekRequest,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
client = VlxApiClient.from_env()
|
|
61
|
+
|
|
62
|
+
request = VlxSeekRequest(
|
|
63
|
+
model="VLX-Seek",
|
|
64
|
+
messages=[
|
|
65
|
+
VlxSeekMessage(
|
|
66
|
+
role="user",
|
|
67
|
+
content=[
|
|
68
|
+
VlxSeekContent(type="text", text="请描述图片内容"),
|
|
69
|
+
VlxSeekContent(
|
|
70
|
+
type="image_url",
|
|
71
|
+
image_url=VlxSeekImageUrl(url="https://example.com/a.jpg"),
|
|
72
|
+
),
|
|
73
|
+
],
|
|
74
|
+
)
|
|
75
|
+
],
|
|
76
|
+
max_tokens=512,
|
|
77
|
+
temperature=0.2,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
response = client.vlx_seek(request)
|
|
81
|
+
print(response.choices[0].message.content)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 流式消息示例
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from omai_client import VlxApiClient, VlxFlowSource, VlxFlowStreamRequest
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Handler:
|
|
91
|
+
def on_event(self, message):
|
|
92
|
+
print(message.event, message.content)
|
|
93
|
+
|
|
94
|
+
def on_error(self, throwable):
|
|
95
|
+
print("error:", throwable)
|
|
96
|
+
|
|
97
|
+
def on_closed(self):
|
|
98
|
+
print("closed")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
client = VlxApiClient.from_env()
|
|
102
|
+
call = client.vlx_flow_stream_message(
|
|
103
|
+
VlxFlowStreamRequest(
|
|
104
|
+
source=VlxFlowSource(path="rtsp://camera", type=1),
|
|
105
|
+
prompt="识别画面中的异常情况",
|
|
106
|
+
frame_preempt="qa",
|
|
107
|
+
model="VLX-Stream",
|
|
108
|
+
),
|
|
109
|
+
Handler(),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# 需要停止本地 SSE 长连接时调用。
|
|
113
|
+
# call.cancel()
|
|
114
|
+
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: omai
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK for Omai VLX API
|
|
5
|
+
Home-page: UNKNOWN
|
|
6
|
+
Author: Omai
|
|
7
|
+
License: UNKNOWN
|
|
8
|
+
Platform: UNKNOWN
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# omai-client Python SDK
|
|
15
|
+
|
|
16
|
+
这是 Omai VLX Python SDK,当前覆盖 VLX 相关接口:
|
|
17
|
+
|
|
18
|
+
- `vlx_seek`:VLX-Seek 多模态同步调用
|
|
19
|
+
- `vlx_flow_stream`:创建 VLX 流式任务并消费原始 SSE 事件
|
|
20
|
+
- `vlx_flow_stream_message`:创建 VLX 流式任务并消费业务消息
|
|
21
|
+
- `vlx_flow_stream_raw`:返回原始流式响应
|
|
22
|
+
- `vlx_flow_stop`:停止 VLX 流式任务
|
|
23
|
+
- `vlx_flow_update_config`:更新 VLX 流式任务配置
|
|
24
|
+
|
|
25
|
+
## 安装 tar.gz
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install ./dist/omai-1.0.0.tar.gz
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 单文件验证
|
|
32
|
+
|
|
33
|
+
如果只是临时验证,可以直接把 `dist_single/vlx_api_client.py` 放到业务项目里:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from vlx_api_client import VlxApiClient, VlxSeekRequest, VlxSeekMessage, VlxSeekContent
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
单文件版和包版本共用同一份核心代码。真实 HTTP 请求依赖 `requests`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install requests
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 环境变量配置
|
|
46
|
+
|
|
47
|
+
Python SDK 推荐使用环境变量:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
export VLX_API_ENABLED=true
|
|
51
|
+
export VLX_API_ENDPOINT=http://linker-gateway-service:31003/
|
|
52
|
+
export VLX_API_KEY=aaas_xxx
|
|
53
|
+
export VLX_API_CONNECT_TIMEOUT_MS=60000
|
|
54
|
+
export VLX_API_READ_TIMEOUT_MS=60000
|
|
55
|
+
export VLX_API_WRITE_TIMEOUT_MS=60000
|
|
56
|
+
export VLX_API_STREAM_READ_TIMEOUT_MS=0
|
|
57
|
+
export VLX_API_CLIENT_NUM=2048
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`VLX_API_STREAM_READ_TIMEOUT_MS=0` 表示流式接口不启用读超时,适合 12/24 小时 SSE 长连接。
|
|
61
|
+
|
|
62
|
+
## VLX-Seek 示例
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from omai_client import (
|
|
66
|
+
VlxApiClient,
|
|
67
|
+
VlxSeekContent,
|
|
68
|
+
VlxSeekImageUrl,
|
|
69
|
+
VlxSeekMessage,
|
|
70
|
+
VlxSeekRequest,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
client = VlxApiClient.from_env()
|
|
74
|
+
|
|
75
|
+
request = VlxSeekRequest(
|
|
76
|
+
model="VLX-Seek",
|
|
77
|
+
messages=[
|
|
78
|
+
VlxSeekMessage(
|
|
79
|
+
role="user",
|
|
80
|
+
content=[
|
|
81
|
+
VlxSeekContent(type="text", text="请描述图片内容"),
|
|
82
|
+
VlxSeekContent(
|
|
83
|
+
type="image_url",
|
|
84
|
+
image_url=VlxSeekImageUrl(url="https://example.com/a.jpg"),
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
)
|
|
88
|
+
],
|
|
89
|
+
max_tokens=512,
|
|
90
|
+
temperature=0.2,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = client.vlx_seek(request)
|
|
94
|
+
print(response.choices[0].message.content)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 流式消息示例
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from omai_client import VlxApiClient, VlxFlowSource, VlxFlowStreamRequest
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Handler:
|
|
104
|
+
def on_event(self, message):
|
|
105
|
+
print(message.event, message.content)
|
|
106
|
+
|
|
107
|
+
def on_error(self, throwable):
|
|
108
|
+
print("error:", throwable)
|
|
109
|
+
|
|
110
|
+
def on_closed(self):
|
|
111
|
+
print("closed")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
client = VlxApiClient.from_env()
|
|
115
|
+
call = client.vlx_flow_stream_message(
|
|
116
|
+
VlxFlowStreamRequest(
|
|
117
|
+
source=VlxFlowSource(path="rtsp://camera", type=1),
|
|
118
|
+
prompt="识别画面中的异常情况",
|
|
119
|
+
frame_preempt="qa",
|
|
120
|
+
model="VLX-Stream",
|
|
121
|
+
),
|
|
122
|
+
Handler(),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# 需要停止本地 SSE 长连接时调用。
|
|
126
|
+
# call.cancel()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.28.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
omai_client
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""omai-client Python SDK.
|
|
2
|
+
|
|
3
|
+
业务侧推荐用法:
|
|
4
|
+
|
|
5
|
+
from omai_client import VlxApiClient
|
|
6
|
+
|
|
7
|
+
client = VlxApiClient.from_env()
|
|
8
|
+
resp = client.vlx_seek(request)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .vlx_api_client import (
|
|
12
|
+
BaseResp,
|
|
13
|
+
VlxApiClient,
|
|
14
|
+
VlxApiConfig,
|
|
15
|
+
VlxApiError,
|
|
16
|
+
VlxConfigError,
|
|
17
|
+
VlxFlowEvent,
|
|
18
|
+
VlxFlowEventHandler,
|
|
19
|
+
VlxFlowEventMessageHandler,
|
|
20
|
+
VlxFlowSource,
|
|
21
|
+
VlxFlowStopRequest,
|
|
22
|
+
VlxFlowStreamCall,
|
|
23
|
+
VlxFlowStreamRequest,
|
|
24
|
+
VlxFlowUpdateConfigRequest,
|
|
25
|
+
VlxHttpError,
|
|
26
|
+
VlxSeekChoice,
|
|
27
|
+
VlxSeekContent,
|
|
28
|
+
VlxSeekImageUrl,
|
|
29
|
+
VlxSeekMessage,
|
|
30
|
+
VlxSeekMessageResult,
|
|
31
|
+
VlxSeekRequest,
|
|
32
|
+
VlxSeekResponse,
|
|
33
|
+
VlxSeekUsage,
|
|
34
|
+
VlxSseEventParser,
|
|
35
|
+
VlxStreamEventMessage,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"BaseResp",
|
|
40
|
+
"VlxApiClient",
|
|
41
|
+
"VlxApiConfig",
|
|
42
|
+
"VlxApiError",
|
|
43
|
+
"VlxConfigError",
|
|
44
|
+
"VlxFlowEvent",
|
|
45
|
+
"VlxFlowEventHandler",
|
|
46
|
+
"VlxFlowEventMessageHandler",
|
|
47
|
+
"VlxFlowSource",
|
|
48
|
+
"VlxFlowStopRequest",
|
|
49
|
+
"VlxFlowStreamCall",
|
|
50
|
+
"VlxFlowStreamRequest",
|
|
51
|
+
"VlxFlowUpdateConfigRequest",
|
|
52
|
+
"VlxHttpError",
|
|
53
|
+
"VlxSeekChoice",
|
|
54
|
+
"VlxSeekContent",
|
|
55
|
+
"VlxSeekImageUrl",
|
|
56
|
+
"VlxSeekMessage",
|
|
57
|
+
"VlxSeekMessageResult",
|
|
58
|
+
"VlxSeekRequest",
|
|
59
|
+
"VlxSeekResponse",
|
|
60
|
+
"VlxSeekUsage",
|
|
61
|
+
"VlxSseEventParser",
|
|
62
|
+
"VlxStreamEventMessage",
|
|
63
|
+
]
|