MeUtils 2025.2.6.20.41.23__py3-none-any.whl → 2025.2.11.18.25.28__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.
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/METADATA +27 -27
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/RECORD +31 -26
- examples/_openaisdk/openai_chatfire.py +18 -8
- examples/_openaisdk/openai_modelscope.py +1 -1
- examples/_openaisdk/openai_v.py +38 -0
- examples/_openaisdk/openai_x.py +22 -1
- examples/_openaisdk/testDeepseek.py +67 -0
- meutils/apis/images/edits.py +6 -5
- meutils/apis/jimeng/images.py +6 -5
- meutils/apis/search/metaso.py +6 -19
- meutils/caches/acache.py +10 -10
- meutils/caches/c.py +29 -0
- meutils/caches/redis_.py +26 -0
- meutils/caches/redis_cache.py +0 -2
- meutils/caches/redis_mulit.py +30 -0
- meutils/data/VERSION +1 -1
- meutils/data/oneapi/NOTICE.md +11 -1
- meutils/llm/clients.py +19 -7
- meutils/llm/completions/agents/search.py +11 -7
- meutils/llm/completions/reasoner.py +14 -8
- meutils/llm/openai_utils/common.py +2 -2
- meutils/oss/minio_oss.py +2 -0
- meutils/schemas/image_types.py +1 -1
- meutils/schemas/metaso_types.py +16 -5
- meutils/schemas/oneapi/common.py +98 -25
- meutils/schemas/openai_types.py +19 -15
- meutils/serving/fastapi/exceptions/http_error.py +2 -2
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/LICENSE +0 -0
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/WHEEL +0 -0
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/entry_points.txt +0 -0
- {MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/top_level.txt +0 -0
meutils/caches/redis_.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import asyncio
|
2
|
+
|
3
|
+
from aiocache import Cache
|
4
|
+
|
5
|
+
|
6
|
+
cache = Cache(Cache.REDIS, endpoint="127.0.0.1", port=6379, namespace="main")
|
7
|
+
|
8
|
+
|
9
|
+
async def redis():
|
10
|
+
await cache.set("key", "value")
|
11
|
+
await cache.set("expire_me", "value", ttl=10)
|
12
|
+
|
13
|
+
assert await cache.get("key") == "value"
|
14
|
+
assert await cache.get("expire_me") == "value"
|
15
|
+
assert await cache.raw("ttl", "main:expire_me") > 0
|
16
|
+
|
17
|
+
|
18
|
+
async def test_redis():
|
19
|
+
await redis()
|
20
|
+
await cache.delete("key")
|
21
|
+
await cache.delete("expire_me")
|
22
|
+
await cache.close()
|
23
|
+
|
24
|
+
|
25
|
+
if __name__ == "__main__":
|
26
|
+
asyncio.run(test_redis())
|
meutils/caches/redis_cache.py
CHANGED
@@ -29,13 +29,11 @@ acache_inmemory = hermes.Hermes(
|
|
29
29
|
)
|
30
30
|
|
31
31
|
|
32
|
-
from aiocache import cached, Cache, RedisCache
|
33
32
|
|
34
33
|
|
35
34
|
if __name__ == '__main__':
|
36
35
|
from meutils.pipe import *
|
37
36
|
|
38
|
-
@cached(ttl=100)
|
39
37
|
@cache(tags=('test',))
|
40
38
|
async def foo(a, b):
|
41
39
|
time.sleep(3)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import asyncio
|
2
|
+
|
3
|
+
from aiocache import multi_cached, Cache
|
4
|
+
|
5
|
+
DICT = {
|
6
|
+
'a': "Z",
|
7
|
+
'b': "Y",
|
8
|
+
'c': "X",
|
9
|
+
'd': "W"
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
# @multi_cached("ids", cache=Cache.REDIS, namespace="main")
|
14
|
+
# async def multi_cached_ids(ids=None):
|
15
|
+
# return {id_: DICT[id_] for id_ in ids}
|
16
|
+
|
17
|
+
|
18
|
+
@multi_cached("keys", cache=Cache.REDIS, namespace="main")
|
19
|
+
async def multi_cached_keys(keys=None):
|
20
|
+
return keys
|
21
|
+
|
22
|
+
# cache = Cache(Cache.REDIS, endpoint="127.0.0.1", port=6379, namespace="main")
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
if __name__ == "__main__":
|
29
|
+
# test_multi_cached()
|
30
|
+
asyncio.run(multi_cached_keys('xxx'))
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2025.02.
|
1
|
+
2025.02.11.18.25.28
|
meutils/data/oneapi/NOTICE.md
CHANGED
@@ -35,7 +35,17 @@
|
|
35
35
|
<summary><b>大额对公,请联系客服</b></summary>
|
36
36
|
</details>
|
37
37
|
|
38
|
-
## 2025-02-
|
38
|
+
## 2025-02-10
|
39
|
+
### 上线新模型
|
40
|
+
- qwen2.5-max: 比deepseek-v3效果更好,更智能(权威排行榜更靠前)
|
41
|
+
|
42
|
+
## 2025-02-06
|
43
|
+
### 上线新模型
|
44
|
+
- deepseek-r1-think: 兼容任意客户端,再也不用担心看不到`深度思考`了
|
45
|
+
- deepseek-search: 搜索+深度思考
|
46
|
+
- deepseek-r1-search: 搜索+深度思考
|
47
|
+
- deepseek-r1-metasearch: 秘塔搜索+深度思考
|
48
|
+
|
39
49
|
- deepseek-ai/deepseek-v3
|
40
50
|
- 即日起至北京时间 2025-02-09 00:00 同步官网倍率
|
41
51
|
|
meutils/llm/clients.py
CHANGED
@@ -26,6 +26,11 @@ zhipuai_client = AsyncOpenAI(
|
|
26
26
|
base_url=os.getenv("ZHIPUAI_BASE_URL")
|
27
27
|
)
|
28
28
|
|
29
|
+
# zhipuai_client = OpenAI(
|
30
|
+
# api_key=os.getenv("ZHIPUAI_API_KEY"),
|
31
|
+
# base_url=os.getenv("ZHIPUAI_BASE_URL")
|
32
|
+
# )
|
33
|
+
|
29
34
|
if __name__ == '__main__':
|
30
35
|
from meutils.pipe import *
|
31
36
|
|
@@ -34,11 +39,18 @@ if __name__ == '__main__':
|
|
34
39
|
# arun(zhipuai_client.chat.completions.create(messages=[{"role": "user", "content": "hi"}], model='glm-4-flash'))
|
35
40
|
|
36
41
|
# web-search-pro
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
)
|
42
|
-
|
43
|
-
r.
|
42
|
+
# s = zhipuai_client.chat.completions.create(
|
43
|
+
# messages=[{"role": "user", "content": "《哪吒之魔童闹海》现在的票房是多少"}],
|
44
|
+
# model='web-search-pro',
|
45
|
+
# stream=True
|
46
|
+
# )
|
47
|
+
#
|
48
|
+
# r = arun(zhipuai_client.chat.completions.create(
|
49
|
+
# messages=[{"role": "user", "content": "《哪吒之魔童闹海》现在的票房是多少"}],
|
50
|
+
# model='web-search-pro',
|
51
|
+
# stream=True
|
52
|
+
# )
|
53
|
+
# )
|
54
|
+
|
55
|
+
# r.model_dump_json()
|
44
56
|
|
@@ -96,13 +96,16 @@ class Completions(object):
|
|
96
96
|
data['model'] = "web-search-pro"
|
97
97
|
data['stream'] = False
|
98
98
|
search_completion = await zhipuai_client.chat.completions.create(**data)
|
99
|
-
logger.debug(search_completion) # todo: 返回详细信息
|
99
|
+
logger.debug(search_completion.model_dump_json(indent=4)) # todo: 返回详细信息
|
100
|
+
# todo: chat搜索接口 搜索内容重排序 搜索聚合
|
100
101
|
|
101
102
|
# 大模型
|
102
|
-
request.messages.append(
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
request.messages.append(
|
104
|
+
{
|
105
|
+
"role": "user",
|
106
|
+
"content": search_completion.model_dump_json(indent=4),
|
107
|
+
}
|
108
|
+
)
|
106
109
|
|
107
110
|
data = to_openai_params(request)
|
108
111
|
completion = await chatfire_client.chat.completions.create(**data)
|
@@ -114,13 +117,14 @@ if __name__ == '__main__':
|
|
114
117
|
# model="baichuan4-turbo",
|
115
118
|
# model="xx",
|
116
119
|
# model="deepseek-r1",
|
117
|
-
model="deepseek-r1:1.5b",
|
120
|
+
# model="deepseek-r1:1.5b",
|
121
|
+
model="deepseek-r1:32b",
|
118
122
|
|
119
123
|
# model="moonshot-v1-8k",
|
120
124
|
# model="doubao",
|
121
125
|
|
122
126
|
messages=[
|
123
|
-
{"role": "user", "content": "
|
127
|
+
{"role": "user", "content": "《哪吒之魔童闹海》现在的票房是多少"}
|
124
128
|
],
|
125
129
|
|
126
130
|
stream=False
|
@@ -44,9 +44,6 @@ def extract_think_content(content):
|
|
44
44
|
return "", content
|
45
45
|
|
46
46
|
|
47
|
-
reasoning = True
|
48
|
-
|
49
|
-
|
50
47
|
class Completions(object):
|
51
48
|
|
52
49
|
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None, reasoning_stream: bool = True):
|
@@ -74,9 +71,10 @@ class Completions(object):
|
|
74
71
|
async for chunk in completion_chunks:
|
75
72
|
# chunk.model = "deepseek-reasoner"
|
76
73
|
message = chunk.choices[0].delta
|
77
|
-
message.content = message.content or ""
|
74
|
+
message.content = message.content or "" ########## 损失了?message chunk #########应该是很多值未带进chunk
|
78
75
|
|
79
|
-
|
76
|
+
# logger.debug(message)
|
77
|
+
if not hasattr(message, 'reasoning_content'): # 标准化 finish_reason
|
80
78
|
message.reasoning_content = ""
|
81
79
|
if is_reasoning_content:
|
82
80
|
message.reasoning_content = (
|
@@ -84,7 +82,7 @@ class Completions(object):
|
|
84
82
|
.replace("</think>", "")
|
85
83
|
.replace("\n\n", "\n")
|
86
84
|
)
|
87
|
-
if
|
85
|
+
if "</think>" in message.content: # 思考结束
|
88
86
|
is_reasoning_content = False
|
89
87
|
message.content = ""
|
90
88
|
|
@@ -92,7 +90,7 @@ class Completions(object):
|
|
92
90
|
|
93
91
|
if self.reasoning_stream: # 适配任意客户端: 展示推理内容
|
94
92
|
|
95
|
-
if message.reasoning_content.strip(): # 思考开始
|
93
|
+
if message.reasoning_content and message.reasoning_content.strip(): # 思考开始
|
96
94
|
message.content = f"{reasoning_prefix}{message.reasoning_content}"
|
97
95
|
reasoning_prefix = ""
|
98
96
|
|
@@ -102,8 +100,11 @@ class Completions(object):
|
|
102
100
|
reasoning_suffix = ""
|
103
101
|
|
104
102
|
yield chunk
|
103
|
+
logger.debug(chunk)
|
105
104
|
else:
|
106
105
|
yield chunk
|
106
|
+
logger.debug(chunk)
|
107
|
+
|
107
108
|
|
108
109
|
else: # 非流
|
109
110
|
completions = await self.client.chat.completions.create(**data)
|
@@ -114,6 +115,10 @@ class Completions(object):
|
|
114
115
|
if not hasattr(message, 'reasoning_content'):
|
115
116
|
reasoning_content, content = extract_think_content(message.content)
|
116
117
|
|
118
|
+
if content.strip().startswith("<think>"): # max tokens
|
119
|
+
reasoning_content = content.replace("<think>", "")
|
120
|
+
content = ""
|
121
|
+
|
117
122
|
completions.choices[0].message.reasoning_content = reasoning_content
|
118
123
|
completions.choices[0].message.content = content
|
119
124
|
|
@@ -137,9 +142,10 @@ if __name__ == '__main__':
|
|
137
142
|
# model="qwen-plus-latest",
|
138
143
|
|
139
144
|
# model="deepseek-r1:1.5b",
|
145
|
+
model="DeepSeek-R1-Distill-Qwen-1.5B",
|
140
146
|
# model="deepseek-r1:32b",
|
141
147
|
#
|
142
|
-
model="deepseek-r1",
|
148
|
+
# model="deepseek-r1",
|
143
149
|
# model
|
144
150
|
|
145
151
|
messages=[
|
@@ -207,7 +207,7 @@ async def create_chat_completion_chunk(
|
|
207
207
|
# logger.debug(type(completion_chunks))
|
208
208
|
|
209
209
|
chat_completion_chunk.id = chat_id or f"chatcmpl-{shortuuid.random()}"
|
210
|
-
chat_completion_chunk_stop.id = chat_completion_chunk.id
|
210
|
+
chat_completion_chunk_stop.id = chat_completion_chunk.id
|
211
211
|
async for completion_chunk in achain(completion_chunks):
|
212
212
|
|
213
213
|
# logger.debug(completion_chunk)
|
@@ -218,7 +218,7 @@ async def create_chat_completion_chunk(
|
|
218
218
|
yield chat_completion_chunk.model_dump_json()
|
219
219
|
else: # todo: AttributeError: 'tuple' object has no attribute 'model'
|
220
220
|
try:
|
221
|
-
chat_completion_chunk_stop.id =
|
221
|
+
chat_completion_chunk_stop.id = completion_chunk.id ##############
|
222
222
|
completion_chunk.model = redirect_model or completion_chunk.model
|
223
223
|
chat_completion_chunk_stop.usage = completion_chunk.usage ############## 需要判断 usage?
|
224
224
|
yield completion_chunk.model_dump_json()
|
meutils/oss/minio_oss.py
CHANGED
meutils/schemas/image_types.py
CHANGED
meutils/schemas/metaso_types.py
CHANGED
@@ -23,21 +23,32 @@ class MetasoRequest(BaseModel):
|
|
23
23
|
question: str = "Chatfire"
|
24
24
|
|
25
25
|
"""全网 文库 学术 图片 播客"""
|
26
|
-
engineType: str = "" # scholar
|
27
|
-
|
28
26
|
scholarSearchDomain: str = "all"
|
29
27
|
|
28
|
+
url: str = "https://metaso.cn/"
|
29
|
+
lang: str = "zh"
|
30
|
+
|
30
31
|
searchTopicId: Optional[str] = None
|
31
32
|
searchTopicName: Optional[str] = None
|
32
33
|
|
33
|
-
enableMix:
|
34
|
-
newEngine:
|
35
|
-
enableImage:
|
34
|
+
enableMix: str = 'true'
|
35
|
+
newEngine: str = 'true'
|
36
|
+
enableImage: str = 'true'
|
36
37
|
|
37
38
|
# 自定义字段
|
38
39
|
response_format: Optional[str] = None # 原生内容
|
39
40
|
|
40
41
|
|
42
|
+
# question: hi
|
43
|
+
# mode: detail
|
44
|
+
# scholarSearchDomain: all
|
45
|
+
# model: ds-r1
|
46
|
+
# url: https://metaso.cn/
|
47
|
+
# lang: zh
|
48
|
+
# enableMix: true
|
49
|
+
# newEngine: true
|
50
|
+
# enableImage: true
|
51
|
+
# metaso-pc: pc
|
41
52
|
class MetasoResponse(BaseModel): # sse
|
42
53
|
|
43
54
|
type: Optional[str] = None # query set-reference heartbeat append-text
|
meutils/schemas/oneapi/common.py
CHANGED
@@ -18,6 +18,9 @@ MJ_RELAX = 1
|
|
18
18
|
STEP = 2
|
19
19
|
|
20
20
|
MODEL_PRICE = {
|
21
|
+
"black-forest-labs/FLUX.1-dev": 0.0001,
|
22
|
+
"black-forest-labs/FLUX.1-pro": 0.0001,
|
23
|
+
|
21
24
|
"images": FREE,
|
22
25
|
# rix
|
23
26
|
"kling_image": 0.025,
|
@@ -34,6 +37,11 @@ MODEL_PRICE = {
|
|
34
37
|
"minimax_i2v-01-live": 1.2,
|
35
38
|
"minimax_s2v-01": 1.2,
|
36
39
|
|
40
|
+
# free
|
41
|
+
"google/gemini-2.0-flash-thinking-exp:free": 0.00001,
|
42
|
+
"google/gemini-2.0-flash-lite-preview-02-05:free": 0.00001,
|
43
|
+
"google/gemini-2.0-pro-exp-02-05:free": 0.00001,
|
44
|
+
|
37
45
|
# chatfire
|
38
46
|
"ppu-0001": 0.0001,
|
39
47
|
"ppu-001": 0.001,
|
@@ -45,6 +53,7 @@ MODEL_PRICE = {
|
|
45
53
|
"chatfire-law": 0.01,
|
46
54
|
|
47
55
|
"sora-1:1-480p-5s": 1.2,
|
56
|
+
"dall-e-3": 0.03,
|
48
57
|
|
49
58
|
# 虚拟换衣fish
|
50
59
|
"api-kolors-virtual-try-on": 0.1,
|
@@ -199,6 +208,12 @@ MODEL_PRICE = {
|
|
199
208
|
"api-cogvideox": 0.1,
|
200
209
|
"api-cogvideox-vip": 0.4,
|
201
210
|
|
211
|
+
#
|
212
|
+
"runway_video": 0.6,
|
213
|
+
"runway_video2video": 0.6,
|
214
|
+
"runway_act_one": 1,
|
215
|
+
"runwayml_image_to_video": 0.8,
|
216
|
+
|
202
217
|
"api-runwayml-gen3": 0.1,
|
203
218
|
|
204
219
|
"api-translator": 0.0001,
|
@@ -212,7 +227,7 @@ MODEL_PRICE = {
|
|
212
227
|
|
213
228
|
# all
|
214
229
|
"o1-plus": 0.2,
|
215
|
-
"o1-pro":
|
230
|
+
"o1-pro": 1.2,
|
216
231
|
|
217
232
|
"o1-mini-all": 0.2,
|
218
233
|
"o1-preview-all": 0.6,
|
@@ -261,6 +276,13 @@ MODEL_PRICE = {
|
|
261
276
|
"ai-search-pro": 0.1,
|
262
277
|
"ai-search-pro:scholar": 0.1,
|
263
278
|
|
279
|
+
'deepseek-search': 0.01,
|
280
|
+
'deepseek-r1-search': 0.01,
|
281
|
+
'deepseek-reasoner-search': 0.01,
|
282
|
+
|
283
|
+
'deepseek-r1-metasearch': 0.03,
|
284
|
+
'deepseek-reasoner-metasearch': 0.03,
|
285
|
+
|
264
286
|
# MJ
|
265
287
|
"mj-chat": 0.3,
|
266
288
|
|
@@ -379,7 +401,7 @@ MODEL_RATIO = {
|
|
379
401
|
"qwen-long": 0.25,
|
380
402
|
"qwen-turbo": 0.05,
|
381
403
|
"qwen-plus": 2,
|
382
|
-
"qwen-max":
|
404
|
+
"qwen-max": 1.2,
|
383
405
|
"qwen-max-longcontext": 20,
|
384
406
|
"qwen-turbo-2024-11-01": 0.15,
|
385
407
|
"qwen-max-latest": 1.2,
|
@@ -399,6 +421,7 @@ MODEL_RATIO = {
|
|
399
421
|
"Qwen/QwQ-32B-Preview": 1,
|
400
422
|
"qwq-32b-preview": 1,
|
401
423
|
"qvq-72b-preview": 2,
|
424
|
+
"qwen2.5-vl-72b-instruct": 1.25,
|
402
425
|
|
403
426
|
"qwen1.5-7b-chat": 0.05, # 特价
|
404
427
|
"qwen1.5-14b-chat": 0.7,
|
@@ -461,29 +484,42 @@ MODEL_RATIO = {
|
|
461
484
|
"abab5.5s-chat": 2.5,
|
462
485
|
|
463
486
|
# deepseek
|
464
|
-
"deepseek-
|
487
|
+
"deepseek-v3": 2,
|
488
|
+
"deepseek-v3-128k": 5,
|
489
|
+
"deepseek-chat": 2,
|
490
|
+
"deepseek-chat-64k": 5,
|
491
|
+
"deepseek-chat-164k": 5,
|
492
|
+
"deepseek-chat:function": 4,
|
465
493
|
"deepseek-vl2": 0.5,
|
466
|
-
|
467
494
|
"deepseek-ai/deepseek-vl2": 0.5,
|
468
|
-
"deepseek-llm-67b-chat": 0.5,
|
469
|
-
|
470
|
-
"deepseek-chat:function": 4,
|
471
|
-
|
472
|
-
"deepseek-v3": 0.5,
|
473
|
-
"deepseek/deepseek-chat": 0.5,
|
474
|
-
"deepseek-ai/DeepSeek-V3": 0.5,
|
475
|
-
"accounts/fireworks/models/deepseek-v3": 0.5,
|
476
495
|
|
496
|
+
# deepseek-r1:1.5b,deepseek-r1-distill-qwen-1.5b,deepseek-r1:7b,deepseek-r1-distill-qwen-7b,deepseek-r1:8b,deepseek-r1-distill-llama-8b,deepseek-r1:14b,deepseek-r1-distill-qwen-14b,deepseek-r1:32b,deepseek-r1-distill-qwen-32b,deepseek-r1:70b,deepseek-r1-distill-llama-70b
|
477
497
|
"deepseek-r1:1.5b": 0.1,
|
498
|
+
'deepseek-r1-lite': 0.1, # think
|
499
|
+
"deepseek-r1-distill-qwen-1.5b": 0.1,
|
478
500
|
"deepseek-r1:7b": 0.2,
|
501
|
+
"deepseek-r1-distill-qwen-7b": 0.2,
|
502
|
+
"deepseek-r1:8b": 0.3,
|
503
|
+
"deepseek-r1-distill-llama-8b": 0.3,
|
504
|
+
|
479
505
|
"deepseek-r1:14b": 0.5,
|
506
|
+
"deepseek-r1-distill-qwen-14b": 0.5,
|
507
|
+
|
480
508
|
"deepseek-r1:32b": 1,
|
509
|
+
"deepseek-r1-distill-qwen-32b": 1,
|
510
|
+
|
511
|
+
"deepseek-r1:70b": 1.5,
|
512
|
+
"deepseek-r1-distill-llama-70b": 1.5,
|
513
|
+
|
481
514
|
'deepseek-r1': 2,
|
482
515
|
'deepseek-reasoner': 2,
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
516
|
+
|
517
|
+
'deepseek-r1-think': 1.5,
|
518
|
+
'deepseek-reasoner-think': 1.5,
|
519
|
+
|
520
|
+
"deepseek-search": 1,
|
521
|
+
'deepseek-r1-search': 2,
|
522
|
+
'deepseek-reasoner-search': 2,
|
487
523
|
|
488
524
|
# 豆包
|
489
525
|
"doubao-lite-128k": 0.4,
|
@@ -573,6 +609,7 @@ MODEL_RATIO = {
|
|
573
609
|
"gemini-1.0-pro-vision-latest": 1,
|
574
610
|
"gemini-exp-1206": 1,
|
575
611
|
|
612
|
+
"gemini-1.5-flash": 0.1,
|
576
613
|
"gemini-1.5-flash-002": 0.3, # 重定向到openrouter
|
577
614
|
"google/gemini-flash-1.5-8b": 0.3, # openrouter $0.0375 $0.15
|
578
615
|
|
@@ -581,8 +618,12 @@ MODEL_RATIO = {
|
|
581
618
|
"google/gemini-flash-1.5-exp": 0.1, # openrouter免费
|
582
619
|
"google/gemini-flash-1.5-8b-exp": 0.1, # openrouter免费
|
583
620
|
|
584
|
-
"gemini-2.0-flash": 0.
|
585
|
-
"gemini-2.0-flash-001": 0.
|
621
|
+
"gemini-2.0-flash": 0.075,
|
622
|
+
"gemini-2.0-flash-001": 0.075,
|
623
|
+
"gemini-2.0-flash-lite-preview-02-05": 0.625,
|
624
|
+
|
625
|
+
"gemini-2.0-pro": 1.25,
|
626
|
+
"gemini-2.0-pro-exp-02-05": 1.25,
|
586
627
|
|
587
628
|
"gemini-2.0-flash-exp": 0.5,
|
588
629
|
"gemini-2.0-flash-thinking-exp": 1,
|
@@ -685,7 +726,8 @@ MODEL_RATIO = {
|
|
685
726
|
"Qwen/Qwen2-VL-72B-Instruct": 2,
|
686
727
|
|
687
728
|
# 临时
|
688
|
-
"ep-20240515073409-dlpqp": 5
|
729
|
+
"ep-20240515073409-dlpqp": 5,
|
730
|
+
"microsoft/phi-4": 0.035 * 5,
|
689
731
|
|
690
732
|
}
|
691
733
|
|
@@ -751,6 +793,7 @@ COMPLETION_RATIO = {
|
|
751
793
|
|
752
794
|
"gemini-1.5-pro-001": 4,
|
753
795
|
"gemini-1.5-pro-002": 4,
|
796
|
+
"gemini-1.5-flash": 4,
|
754
797
|
"gemini-1.5-flash-002": 4,
|
755
798
|
|
756
799
|
"gemini-exp-1206": 5,
|
@@ -763,6 +806,11 @@ COMPLETION_RATIO = {
|
|
763
806
|
"gemini-2.0-flash-thinking-exp-1219": 5,
|
764
807
|
"gemini-2.0-flash-thinking-exp-01-21": 5,
|
765
808
|
|
809
|
+
"gemini-2.0-flash-lite-preview-02-05": 4,
|
810
|
+
|
811
|
+
"gemini-2.0-pro": 4,
|
812
|
+
"gemini-2.0-pro-exp-02-05": 4,
|
813
|
+
|
766
814
|
"hunyuan-a52b-instruct": 5,
|
767
815
|
"qwen2.5-coder-32b-instruct": 3,
|
768
816
|
|
@@ -773,7 +821,7 @@ COMPLETION_RATIO = {
|
|
773
821
|
"qvq-72b-preview": 3,
|
774
822
|
|
775
823
|
"qwen-long": 4,
|
776
|
-
"qwen-max":
|
824
|
+
"qwen-max": 4,
|
777
825
|
"qwen-vl-max-latest": 3,
|
778
826
|
"qwen-vl-plus-latest": 3,
|
779
827
|
"qwen2-vl-7b-instruct": 5,
|
@@ -786,6 +834,7 @@ COMPLETION_RATIO = {
|
|
786
834
|
"qwen2.5-32b-instruct": 4,
|
787
835
|
"qwen2.5-72b-instruct": 4,
|
788
836
|
"qwen2.5-math-72b-instruct": 4,
|
837
|
+
"qwen2.5-vl-72b-instruct": 3,
|
789
838
|
|
790
839
|
"deepseek-vl2": 4,
|
791
840
|
"deepseek-ai/deepseek-vl2": 4,
|
@@ -809,17 +858,39 @@ COMPLETION_RATIO = {
|
|
809
858
|
"doubao-vision-lite-32k": 3,
|
810
859
|
"doubao-vision-pro-32k": 3,
|
811
860
|
|
861
|
+
"deepseek-r1:1.5b": 4,
|
862
|
+
"deepseek-r1-distill-qwen-1.5b": 4,
|
863
|
+
"deepseek-r1:7b": 4,
|
864
|
+
"deepseek-r1-distill-qwen-7b": 4,
|
865
|
+
"deepseek-r1:8b": 4,
|
866
|
+
"deepseek-r1-distill-llama-8b": 4,
|
867
|
+
"deepseek-r1:14b": 4,
|
868
|
+
"deepseek-r1-distill-qwen-14b": 4,
|
869
|
+
"deepseek-r1:32b": 4,
|
870
|
+
"deepseek-r1-distill-qwen-32b": 4,
|
871
|
+
"deepseek-r1:70b": 4,
|
872
|
+
"deepseek-r1-distill-llama-70b": 4,
|
873
|
+
|
812
874
|
"deepseek-v3": 4,
|
813
|
-
"deepseek-
|
875
|
+
"deepseek-chat": 4,
|
814
876
|
'deepseek-r1': 4,
|
815
877
|
'deepseek-reasoner': 4,
|
816
|
-
"deepseek
|
817
|
-
|
818
|
-
"accounts/fireworks/models/deepseek-v3": 1,
|
878
|
+
"deepseek-reasoner-164k": 8,
|
879
|
+
|
819
880
|
"deepseek-chat:function": 4,
|
881
|
+
|
882
|
+
"deepseek-chat-8k": 5,
|
820
883
|
"deepseek-chat-64k": 5,
|
884
|
+
"deepseek-chat-164k": 5,
|
885
|
+
|
821
886
|
"deepseek-v3-128k": 5,
|
887
|
+
|
822
888
|
"deepseek-llm-67b-chat": 4,
|
889
|
+
'deepseek-r1-think': 4,
|
890
|
+
'deepseek-reasoner-think': 4,
|
891
|
+
"deepseek-search": 5,
|
892
|
+
'deepseek-r1-search': 5,
|
893
|
+
'deepseek-reasoner-search': 5,
|
823
894
|
|
824
895
|
"glm-zero": 5,
|
825
896
|
"glm-zero-preview": 5,
|
@@ -992,7 +1063,9 @@ REDIRECT_MODEL = {
|
|
992
1063
|
# "qwen-2.5-72b": "qwen/qwen-2.5-72b",
|
993
1064
|
"tune-blob": "kaushikaakash04/tune-blob",
|
994
1065
|
"tune-mythomax-l2-13b": "rohan/tune-mythomax-l2-13b",
|
995
|
-
"tune-wizardlm-2-8x22b": "rohan/tune-wizardlm-2-8x22b"
|
1066
|
+
"tune-wizardlm-2-8x22b": "rohan/tune-wizardlm-2-8x22b",
|
1067
|
+
|
1068
|
+
"microsoft/phi-4": 2,
|
996
1069
|
|
997
1070
|
}
|
998
1071
|
|
meutils/schemas/openai_types.py
CHANGED
@@ -74,13 +74,13 @@ class ChatCompletionChunk(_ChatCompletionChunk):
|
|
74
74
|
|
75
75
|
|
76
76
|
chat_completion = ChatCompletion(
|
77
|
-
choices=[Choice(message=ChatCompletionMessage(content=""))]
|
77
|
+
choices=[Choice(message=ChatCompletionMessage(reasoning_content="", content=""))]
|
78
78
|
)
|
79
79
|
chat_completion_chunk = ChatCompletionChunk(
|
80
|
-
choices=[ChunkChoice(delta=ChoiceDelta(content=""))]
|
80
|
+
choices=[ChunkChoice(delta=ChoiceDelta(reasoning_content="", content=""))]
|
81
81
|
)
|
82
82
|
chat_completion_chunk_stop = ChatCompletionChunk(
|
83
|
-
choices=[ChunkChoice(delta=ChoiceDelta(content=""), finish_reason="stop")]
|
83
|
+
choices=[ChunkChoice(delta=ChoiceDelta(reasoning_content="", content=""), finish_reason="stop")]
|
84
84
|
)
|
85
85
|
|
86
86
|
|
@@ -352,15 +352,19 @@ if __name__ == '__main__':
|
|
352
352
|
#
|
353
353
|
#
|
354
354
|
# print(A(n=11))
|
355
|
-
messages = [
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
]
|
363
|
-
|
364
|
-
r = ChatCompletionRequest(model="gpt-3.5-turbo", messages=messages)
|
365
|
-
r.messages[-1]['content'] = [{"type": "image_url", "image_url": {"url": r.urls[-1]}}]
|
366
|
-
print(r)
|
355
|
+
# messages = [
|
356
|
+
# {
|
357
|
+
# "role": "user",
|
358
|
+
# "content": [{'role': 'user', 'content': [{"type": "image_url", "image_url": "这是个图片链接"}]}]
|
359
|
+
# },
|
360
|
+
#
|
361
|
+
# # {'role': 'user', 'content': [{"type": "image_url", "image_url": {"url": "这是个图片链接"}}]},
|
362
|
+
# ]
|
363
|
+
#
|
364
|
+
# r = ChatCompletionRequest(model="gpt-3.5-turbo", messages=messages)
|
365
|
+
# r.messages[-1]['content'] = [{"type": "image_url", "image_url": {"url": r.urls[-1]}}]
|
366
|
+
# print(r)
|
367
|
+
|
368
|
+
print(chat_completion_chunk)
|
369
|
+
print(chat_completion)
|
370
|
+
print(chat_completion_chunk_stop)
|
@@ -42,6 +42,7 @@ async def general_exception_handler(request: Request, exc: Exception):
|
|
42
42
|
|
43
43
|
|
44
44
|
async def chatfire_api_exception_handler(request: Request, exc: Exception):
|
45
|
+
|
45
46
|
content = {
|
46
47
|
"error":
|
47
48
|
{
|
@@ -54,7 +55,6 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
|
|
54
55
|
|
55
56
|
# 默认值
|
56
57
|
reps = None
|
57
|
-
request_json = {"body": await request.body()}
|
58
58
|
if isinstance(exc, (HTTPStatusError, APIStatusError)):
|
59
59
|
status_code = exc.response.status_code or 500
|
60
60
|
|
@@ -71,7 +71,7 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
|
|
71
71
|
if any(code in content_detail for code in {'451', }):
|
72
72
|
content_detail = ""
|
73
73
|
|
74
|
-
send_message([
|
74
|
+
send_message([content, content_detail])
|
75
75
|
|
76
76
|
return reps or JSONResponse(
|
77
77
|
content=content,
|
File without changes
|
File without changes
|
{MeUtils-2025.2.6.20.41.23.dist-info → MeUtils-2025.2.11.18.25.28.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|