MeUtils 2025.8.29.19.48.35__py3-none-any.whl → 2025.9.3.23.13.47__py3-none-any.whl
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.
- examples/_openaisdk/openai_router.py +11 -10
- examples/_openaisdk/openai_volc_doubao.py +139 -0
- meutils/apis/chatglm/glm_video_api.py +1 -1
- meutils/apis/google/chat.py +6 -2
- meutils/apis/google/images.py +13 -8
- meutils/apis/images/generations.py +2 -2
- meutils/{db/id2redis.py → apis/meituan/__init__.py} +2 -3
- meutils/apis/meituan/chat.py +109 -0
- meutils/apis/minimax/videos.py +11 -7
- meutils/apis/oneapi/tasks.py +3 -1
- meutils/apis/ppio/videos.py +1 -1
- meutils/clis/server.py +1 -3
- meutils/data/VERSION +1 -1
- meutils/io/_openai_files.py +1 -0
- meutils/llm/check_utils.py +39 -4
- meutils/llm/openai_polling/chat.py +66 -15
- meutils/schemas/oneapi/common.py +5 -0
- meutils/serving/fastapi/gunicorn.conf.py +4 -4
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/METADATA +262 -262
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/RECORD +24 -23
- examples/_openaisdk/openai_doubao.py +0 -67
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/WHEEL +0 -0
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/entry_points.txt +0 -0
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/licenses/LICENSE +0 -0
- {meutils-2025.8.29.19.48.35.dist-info → meutils-2025.9.3.23.13.47.dist-info}/top_level.txt +0 -0
@@ -34,18 +34,61 @@ class Completions(object):
|
|
34
34
|
self.client = AsyncOpenAI(base_url=self.base_url, api_key=self.api_key, http_client=http_client)
|
35
35
|
|
36
36
|
async def create(self, request: CompletionRequest):
|
37
|
+
# todo:
|
38
|
+
# 1. 可思考模型 思考优先
|
39
|
+
# request.thinking = {"type": "enabled"}
|
40
|
+
|
41
|
+
if request.thinking and request.model.startswith("doubao-seed") and request.thinking.get("type") == "disabled":
|
42
|
+
choices = {
|
43
|
+
"doubao-seed-1.6-250615",
|
44
|
+
"doubao-seed-1-6-250615",
|
45
|
+
"doubao-seed-1-6-vision-250815"
|
46
|
+
} - {request.model}
|
47
|
+
request.model = np.random.choice(list(choices))
|
48
|
+
elif request.model.startswith("doubao-seed"):
|
49
|
+
request.thinking = {"type": "enabled"}
|
50
|
+
choices = {
|
51
|
+
"doubao-seed-1.6-250615",
|
52
|
+
"doubao-seed-1-6-250615",
|
53
|
+
"doubao-seed-1-6-vision-250815",
|
54
|
+
"doubao-seed-1-6-thinking-250615",
|
55
|
+
"doubao-seed-1-6-thinking-250715"
|
56
|
+
} - {request.model}
|
57
|
+
request.model = np.random.choice(list(choices))
|
58
|
+
|
59
|
+
|
60
|
+
elif request.model.startswith(("doubao-1-5-thinking",)): # thinking
|
61
|
+
request.thinking = None
|
62
|
+
|
63
|
+
choices = {
|
64
|
+
"doubao-1-5-thinking-pro-250415",
|
65
|
+
"doubao-1-5-thinking-pro-m-250428",
|
66
|
+
"doubao-1-5-thinking-vision-pro-250428",
|
67
|
+
"doubao-1-5-ui-tars-250428",
|
68
|
+
} - {request.model}
|
69
|
+
request.model = np.random.choice(list(choices))
|
70
|
+
|
71
|
+
elif request.model.startswith(("doubao-1-5", "doubao-1.5")): # nothinking
|
72
|
+
request.thinking = {"type": "disabled"}
|
73
|
+
|
74
|
+
choices = {
|
75
|
+
"doubao-1-5-pro-32k-250115",
|
76
|
+
"doubao-1-5-pro-256k-250115",
|
77
|
+
"doubao-1-5-pro-32k-character-250715",
|
78
|
+
"doubao-1-5-pro-32k-character-250228",
|
79
|
+
"doubao-1.5-vision-pro-250328",
|
80
|
+
"doubao-1-5-vision-pro-32k-250115",
|
81
|
+
"doubao-1-5-thinking-pro-250415",
|
82
|
+
"doubao-1-5-thinking-pro-m-250428",
|
83
|
+
"doubao-1-5-thinking-vision-pro-250428",
|
84
|
+
"doubao-1-5-ui-tars-250428",
|
85
|
+
} - {request.model}
|
86
|
+
request.model = np.random.choice(list(choices))
|
87
|
+
# todo vision
|
37
88
|
|
38
|
-
if request.model.startswith("doubao-seed"): # todo: 1-5
|
39
|
-
choices = """
|
40
|
-
doubao-seed-1-6-250615
|
41
|
-
doubao-seed-1-6-thinking-250615
|
42
|
-
doubao-seed-1-6-thinking-250715
|
43
|
-
doubao-seed-1-6-vision-250815
|
44
|
-
""".split()
|
45
|
-
request.model = np.random.choice(choices)
|
46
89
|
###########################################################################
|
47
90
|
# 开启视觉模型
|
48
|
-
if not any(i in request.model.lower() for i in ["v-", "vl", 'vision', 'doubao-seed']) and (
|
91
|
+
if not any(i in request.model.lower() for i in ["v-", "vl", "ui", 'vision', 'doubao-seed']) and (
|
49
92
|
urls := request.last_urls.get("image_url")):
|
50
93
|
# logger.debug(request)
|
51
94
|
if request.model.startswith(("gemini",)):
|
@@ -125,8 +168,12 @@ if __name__ == '__main__':
|
|
125
168
|
# model="gemini-2.0-flash",
|
126
169
|
# model="glm-4-flash",
|
127
170
|
# model="deepseek-ai/DeepSeek-V3",
|
128
|
-
model="Qwen/Qwen3-8B1",
|
129
|
-
|
171
|
+
# model="Qwen/Qwen3-8B1",
|
172
|
+
# model="Qwen/Qwen3-8B1",
|
173
|
+
# model="doubao-1-5-thinking",
|
174
|
+
# model="doubao-1-5",
|
175
|
+
model="doubao-seed",
|
176
|
+
thinking={"type": "disabled"},
|
130
177
|
messages=[
|
131
178
|
{
|
132
179
|
"role": "system",
|
@@ -141,7 +188,7 @@ if __name__ == '__main__':
|
|
141
188
|
{"role": "user", "content": [
|
142
189
|
{
|
143
190
|
"type": "text",
|
144
|
-
"text": "解释下" *
|
191
|
+
"text": "解释下" * 1
|
145
192
|
},
|
146
193
|
# {
|
147
194
|
# "image_url": {
|
@@ -153,7 +200,7 @@ if __name__ == '__main__':
|
|
153
200
|
]}
|
154
201
|
],
|
155
202
|
stream=False,
|
156
|
-
max_tokens=
|
203
|
+
max_tokens=10,
|
157
204
|
)
|
158
205
|
# arun(Completions().create(request))
|
159
206
|
# d = {
|
@@ -222,6 +269,10 @@ if __name__ == '__main__':
|
|
222
269
|
# stream=False,
|
223
270
|
# max_tokens=None,
|
224
271
|
# )
|
225
|
-
api_key = os.getenv("SILICONFLOW_API_KEY")
|
226
|
-
base_url = "https://api.siliconflow.cn"
|
272
|
+
# api_key = os.getenv("SILICONFLOW_API_KEY")
|
273
|
+
# base_url = "https://api.siliconflow.cn"
|
274
|
+
# arun(Completions(api_key=api_key, base_url=base_url).create(request))
|
275
|
+
|
276
|
+
api_key = os.getenv("VOLC_API_KEY")
|
277
|
+
base_url = os.getenv("VOLC_BASE_URL")
|
227
278
|
arun(Completions(api_key=api_key, base_url=base_url).create(request))
|
meutils/schemas/oneapi/common.py
CHANGED
@@ -101,6 +101,11 @@ FAL_MODELS = {
|
|
101
101
|
"fal-ai/wan/v2.2-5b/text-to-video": 0.15 * FAL_,
|
102
102
|
"fal-ai/wan/v2.2-5b/image-to-video": 0.15 * FAL_,
|
103
103
|
|
104
|
+
# pika
|
105
|
+
"fal-ai/pika/v2.2/text-to-video": 0.45 * FAL,
|
106
|
+
"fal-ai/pika/v2.2/image-to-video": 0.45 * FAL,
|
107
|
+
"fal-ai/pika/v2.2/pikascenes": 0.45 * FAL,
|
108
|
+
|
104
109
|
}
|
105
110
|
|
106
111
|
FAL_MODELS = {
|
@@ -78,10 +78,10 @@ backlog = 1024
|
|
78
78
|
|
79
79
|
workers = int(os.getenv("FASTAPI_WORKERS", 2))
|
80
80
|
worker_class = "uvicorn.workers.UvicornWorker"
|
81
|
-
worker_connections =
|
82
|
-
timeout =
|
83
|
-
graceful_timeout =
|
84
|
-
keepalive =
|
81
|
+
worker_connections = 1024
|
82
|
+
timeout = 360
|
83
|
+
graceful_timeout = 128 # 在接收到重新启动信号后,worker有这么多时间来完成服务请求。超时后(从接收到重启信号开始)仍然活着的worder被强制杀死。
|
84
|
+
keepalive = 16
|
85
85
|
reload = False
|
86
86
|
|
87
87
|
#
|