MeUtils 2025.3.26.18.50.26__py3-none-any.whl → 2025.4.1.18.47.48__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.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/METADATA +262 -262
- {MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/RECORD +27 -21
- examples/_openaisdk/openai_ark_bots.py +82 -0
- examples/_openaisdk/openai_google.py +93 -27
- examples/_openaisdk/openai_kindo.py +1 -1
- examples/_openaisdk/zhipu_/346/231/272/350/203/275/344/275/223.py +7 -4
- meutils/ai_audio/tts/minimax.py +34 -0
- meutils/apis/images/google/__init__.py +11 -0
- meutils/apis/images/google/images.py +32 -0
- meutils/apis/images/recraft.py +5 -5
- meutils/apis/search/ark_web_search.py +65 -0
- meutils/apis/search/{web_search.py → zhipu_web_search.py} +16 -28
- meutils/caches/common.py +2 -0
- meutils/data/VERSION +1 -1
- meutils/io/openai_files.py +4 -1
- meutils/llm/check_utils.py +2 -2
- meutils/llm/clients.py +6 -8
- meutils/llm/completions/chat_gemini.py +1 -1
- meutils/llm/completions/deep2x.py +16 -6
- meutils/llm/completions/google2openai.py +75 -0
- meutils/llm/completions/qwenllm.py +37 -35
- meutils/llm/openai_utils/common.py +5 -0
- meutils/schemas/oneapi/common.py +16 -4
- {MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/LICENSE +0 -0
- {MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/WHEEL +0 -0
- {MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/entry_points.txt +0 -0
- {MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/top_level.txt +0 -0
@@ -6,10 +6,11 @@
|
|
6
6
|
# @Author : betterme
|
7
7
|
# @WeChat : meutils
|
8
8
|
# @Software : PyCharm
|
9
|
-
# @Description :
|
9
|
+
# @Description :
|
10
10
|
|
11
|
-
from aiostream import stream
|
12
11
|
from meutils.pipe import *
|
12
|
+
from meutils.caches import rcache
|
13
|
+
|
13
14
|
from meutils.async_utils import sync_to_async
|
14
15
|
|
15
16
|
from meutils.llm.clients import zhipuai_sdk_client
|
@@ -39,17 +40,14 @@ class Completions(object):
|
|
39
40
|
def __init__(self, api_key: Optional[str] = None):
|
40
41
|
self.api_key = api_key
|
41
42
|
|
42
|
-
@
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# return _
|
43
|
+
# @rcache(noself=True, ttl=15 * 60)
|
44
|
+
@sync_to_async
|
45
|
+
def query(self, q: str):
|
46
|
+
data = list(self.create(q))
|
47
|
+
return {"data": data}
|
48
48
|
|
49
|
-
|
50
|
-
return list(self._create(q))
|
49
|
+
def create(self, request: Union[CompletionRequest, str]):
|
51
50
|
|
52
|
-
def _create(self, request: Union[CompletionRequest, str]):
|
53
51
|
chunks = zhipuai_sdk_client.assistant.conversation(
|
54
52
|
|
55
53
|
assistant_id="659e54b1b8006379b4b2abd6", # 搜索智能体
|
@@ -73,14 +71,17 @@ class Completions(object):
|
|
73
71
|
)
|
74
72
|
|
75
73
|
references = []
|
76
|
-
buffer = []
|
77
74
|
for chunk in chunks:
|
75
|
+
# logger.debug(chunk)
|
76
|
+
|
78
77
|
delta = chunk.choices[0].delta
|
79
78
|
if hasattr(delta, "tool_calls") and delta.tool_calls:
|
80
79
|
tool_call = delta.tool_calls[0].model_dump()
|
81
80
|
# logger.debug(tool_call)
|
82
81
|
tool_type = tool_call.get("type", "") # web_browser
|
83
82
|
references += tool_call.get(tool_type, {}).get("outputs") or [] # title link content
|
83
|
+
|
84
|
+
# logger.debug(f"references: {references}")
|
84
85
|
continue
|
85
86
|
|
86
87
|
if isinstance(request, CompletionRequest):
|
@@ -89,16 +90,6 @@ class Completions(object):
|
|
89
90
|
yield from urls
|
90
91
|
references = []
|
91
92
|
|
92
|
-
# logger.debug(delta)
|
93
|
-
# if delta.content.startswith('【') or buffer: # hasattr(delta, "content")
|
94
|
-
# buffer.append(delta.content)
|
95
|
-
# if len(buffer) < 20:
|
96
|
-
# continue
|
97
|
-
#
|
98
|
-
# if delta.content.endswith('】'):
|
99
|
-
# delta.content = convert_citations(''.join(buffer))
|
100
|
-
# if len(buffer) > 25: buffer = []
|
101
|
-
|
102
93
|
delta = chat_completion_chunk.choices[0].delta.model_construct(**delta.model_dump())
|
103
94
|
chat_completion_chunk.choices[0].delta = delta
|
104
95
|
yield chat_completion_chunk
|
@@ -109,24 +100,21 @@ class Completions(object):
|
|
109
100
|
|
110
101
|
|
111
102
|
if __name__ == '__main__':
|
112
|
-
model = "web-search-pro"
|
113
|
-
# model = "tencent-search"
|
114
|
-
|
115
103
|
request = CompletionRequest(
|
116
104
|
# model="baichuan4-turbo",
|
117
105
|
# model="xx",
|
118
106
|
# model="deepseek-r1",
|
119
107
|
# model="deepseek-r1:1.5b",
|
120
|
-
model=model,
|
108
|
+
model="model",
|
121
109
|
|
122
110
|
# model="moonshot-v1-8k",
|
123
111
|
# model="doubao",
|
124
112
|
|
125
113
|
messages=[
|
126
|
-
{"role": "user", "content": "
|
114
|
+
{"role": "user", "content": "周杰伦"}
|
127
115
|
],
|
128
116
|
|
129
117
|
stream=True
|
130
118
|
)
|
131
119
|
# arun(Completions().search('周杰伦'))
|
132
|
-
arun(Completions().
|
120
|
+
arun(Completions().query(request.last_user_content))
|
meutils/caches/common.py
CHANGED
@@ -18,6 +18,8 @@ cache = memory_cache = cached
|
|
18
18
|
|
19
19
|
def rcache(**kwargs):
|
20
20
|
"""serializer="pickle"
|
21
|
+
|
22
|
+
noself: bool = False,
|
21
23
|
:param endpoint: str with the endpoint to connect to. Default is "127.0.0.1".
|
22
24
|
:param port: int with the port to connect to. Default is 6379.
|
23
25
|
:param db: int indicating database to use. Default is 0.
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2025.
|
1
|
+
2025.04.01.18.47.48
|
meutils/io/openai_files.py
CHANGED
@@ -150,9 +150,12 @@ if __name__ == '__main__':
|
|
150
150
|
|
151
151
|
with timer():
|
152
152
|
file = "https://top.baidu.com/board?tab=realtime"
|
153
|
-
|
153
|
+
file = "http://admin.ilovechatgpt.top/file/yuzhicaizaibutongnianlingquntixiaofeixingweijishichangdiaochawenjuanweishanjianbanpptx_59787479.pptx"
|
154
|
+
file = "https://oss.ffire.cc/files/百炼系列手机产品介绍.docx"
|
154
155
|
# file = "https://app.yinxiang.com/fx/8b8bba1e-b254-40ff-81e1-fa3427429efe"
|
155
156
|
|
157
|
+
print(guess_mime_type(file))
|
158
|
+
|
156
159
|
arun(file_extract(file))
|
157
160
|
|
158
161
|
# arun(file_extract("/Users/betterme/PycharmProjects/AI/data/041【精选】海门招商重工5G+智慧工厂解决方案.pptx"))
|
meutils/llm/check_utils.py
CHANGED
@@ -146,7 +146,7 @@ if __name__ == '__main__':
|
|
146
146
|
|
147
147
|
# arun(check_token_for_jina(["jina_c8da77fed9704d558c8def39837960edplTLkNYrsPTJHBF1HcYg_RkRVh0X"]*10))
|
148
148
|
|
149
|
-
|
149
|
+
arun(check_token_for_siliconflow("sk-vpeietyomqjvizlzfuztzthggcqvutowgbmhjggsmwuhsomg"))
|
150
150
|
"https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=79272d"
|
151
151
|
|
152
|
-
arun(check_token_for_moonshot("sk-Qnr87vtf2Q6MEfc2mVNkVZ4qaoZg3smH9527I25QgcFe7HrT"))
|
152
|
+
# arun(check_token_for_moonshot("sk-Qnr87vtf2Q6MEfc2mVNkVZ4qaoZg3smH9527I25QgcFe7HrT"))
|
meutils/llm/clients.py
CHANGED
@@ -33,19 +33,17 @@ zhipuai_sdk_client = ZhipuAI(
|
|
33
33
|
base_url=os.getenv("ZHIPUAI_BASE_URL")
|
34
34
|
)
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
qwen_client = AsyncOpenAI(
|
40
|
-
base_url="https://all.chatfire.cn/qwen/v1",
|
41
|
-
api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMGNiZGFmLTM3NTQtNDYxYy1hM2ZmLTllYzgwMDUzMjljOSIsImV4cCI6MTc0MzAzNTk4OH0.GVAoSFtK94a9CgxqHCEnxzAnRi7gafIvYyH9mIJUh4s"
|
42
|
-
)
|
43
|
-
|
44
36
|
# zhipuai_client = OpenAI(
|
45
37
|
# api_key=os.getenv("ZHIPUAI_API_KEY"),
|
46
38
|
# base_url=os.getenv("ZHIPUAI_BASE_URL")
|
47
39
|
# )
|
48
40
|
|
41
|
+
# ark_bots_client = AsyncOpenAI(
|
42
|
+
# api_key=os.getenv("ZHIPUAI_API_KEY"),
|
43
|
+
# base_url="https://ark.cn-beijing.volces.com/api/v3/bots"
|
44
|
+
# )
|
45
|
+
|
46
|
+
|
49
47
|
if __name__ == '__main__':
|
50
48
|
from meutils.pipe import *
|
51
49
|
|
@@ -20,7 +20,6 @@ from meutils.io.files_utils import to_bytes
|
|
20
20
|
from meutils.io.openai_files import file_extract, guess_mime_type
|
21
21
|
from meutils.str_utils.json_utils import json_path
|
22
22
|
from meutils.apis.search import metaso
|
23
|
-
# from meutils.apis.chatglm import glm_video_api
|
24
23
|
|
25
24
|
from meutils.llm.clients import chatfire_client, zhipuai_client, AsyncOpenAI
|
26
25
|
from meutils.llm.openai_utils import to_openai_params
|
@@ -28,7 +27,12 @@ from meutils.llm.openai_utils import to_openai_params
|
|
28
27
|
from meutils.schemas.openai_types import ChatCompletionRequest
|
29
28
|
from meutils.schemas.openai_types import chat_completion, chat_completion_chunk, CompletionRequest, ImageRequest
|
30
29
|
|
31
|
-
|
30
|
+
"""
|
31
|
+
delta = chunk.choices[0].delta
|
32
|
+
| │ └ []
|
33
|
+
| └ ChatCompletionChunk(id='02174299556532927e9140493fc1cd076b4fe1b883ff101a83257', choices=[], created=1742995565, model='deep-d...
|
34
|
+
|
|
35
|
+
"""
|
32
36
|
class Completions(object):
|
33
37
|
|
34
38
|
def __init__(self, api_key: Optional[str] = None):
|
@@ -47,10 +51,14 @@ class Completions(object):
|
|
47
51
|
reasoning_content = ""
|
48
52
|
completions = await chatfire_client.chat.completions.create(**data)
|
49
53
|
async for chunk in completions:
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
if chunk.choices: # 自定义没问题,todo:openai通道报错
|
55
|
+
# logger.debug(chunk)
|
56
|
+
yield chunk
|
57
|
+
delta = chunk.choices[0].delta
|
58
|
+
if hasattr(delta, "reasoning_content"):
|
59
|
+
reasoning_content += delta.reasoning_content
|
60
|
+
else:
|
61
|
+
logger.error(chunk)
|
54
62
|
|
55
63
|
request.messages = [
|
56
64
|
{
|
@@ -58,8 +66,10 @@ class Completions(object):
|
|
58
66
|
'content': f"""<think>\n\n{reasoning_content}\n\n</think>\n\n{request.last_user_content}"""
|
59
67
|
}
|
60
68
|
]
|
69
|
+
logger.debug(request)
|
61
70
|
data = to_openai_params(request)
|
62
71
|
async for chunk in await self.client.chat.completions.create(**data):
|
72
|
+
# logger.debug(chunk)
|
63
73
|
yield chunk
|
64
74
|
else:
|
65
75
|
reasoning_content = ""
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : google2openai
|
5
|
+
# @Time : 2025/4/1 13:38
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
"""
|
11
|
+
1. 生图 编辑图 多轮
|
12
|
+
2. 文件上传、大文件问答
|
13
|
+
|
14
|
+
注意 :借助 File API,您最多可为每个项目存储 20 GB 的文件,每个文件的大小上限为 2 GB。文件会存储 48 小时。您可以在该时间段内使用 API 密钥访问这些数据,但无法从 API 下载这些数据。在已推出 Gemini API 的所有地区,此功能均可免费使用。
|
15
|
+
|
16
|
+
"""
|
17
|
+
from meutils.pipe import *
|
18
|
+
|
19
|
+
from google import genai
|
20
|
+
from google.genai.types import HttpOptions, GenerateContentConfig, Content, HarmCategory, HarmBlockThreshold, Part
|
21
|
+
|
22
|
+
# Content(role="user", parts=[Part.from_text(text=prompt)]),
|
23
|
+
# Content(role="model", parts=[Part.from_text(text="Ok")]),
|
24
|
+
|
25
|
+
config = GenerateContentConfig(
|
26
|
+
|
27
|
+
temperature=0.7,
|
28
|
+
top_p=0.8,
|
29
|
+
# response_modalities=['Text', 'Image'],
|
30
|
+
|
31
|
+
# 公民诚信类别的默认屏蔽阈值为 Block none(对于别名为 gemini-2.0-flash、gemini-2.0-pro-exp-02-05 和 gemini-2.0-flash-lite 的 gemini-2.0-flash-001),适用于 Google AI Studio 和 Gemini API;仅适用于 Google AI Studio 中的所有其他模型的 Block most。
|
32
|
+
# safety_settings=[
|
33
|
+
# SafetySetting(
|
34
|
+
# category=HarmCategory.HARM_CATEGORY_HATE_SPEECH,
|
35
|
+
# threshold=HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
|
36
|
+
# ),
|
37
|
+
# ]
|
38
|
+
)
|
39
|
+
|
40
|
+
# self._http_options.base_url = 'https://generativelanguage.googleapis.com/'
|
41
|
+
# self._http_options.api_version = 'v1beta'
|
42
|
+
client = genai.Client(
|
43
|
+
api_key="AIzaSyD19pv1qsYjx4ZKbfH6qvNdYzHMV2TxmPU",
|
44
|
+
http_options=HttpOptions(
|
45
|
+
base_url="https://all.chatfire.cc/genai"
|
46
|
+
)
|
47
|
+
)
|
48
|
+
|
49
|
+
file = "/Users/betterme/PycharmProjects/AI/QR.png"
|
50
|
+
#
|
51
|
+
# file_object = client.files.upload(file=file)
|
52
|
+
# prompt = "一句话总结"
|
53
|
+
|
54
|
+
file_object = client.aio.files.upload(file=file)
|
55
|
+
# https://generativelanguage.googleapis.com/v1beta/files/ickgffcfb9zl
|
56
|
+
#
|
57
|
+
# contents = ('Hi, can you create a 3d rendered image of a pig '
|
58
|
+
# 'with wings and a top hat flying over a happy '
|
59
|
+
# 'futuristic scifi city with lots of greenery?')
|
60
|
+
#
|
61
|
+
# prompt = "9.11 9.8哪个大呢"
|
62
|
+
#
|
63
|
+
response = client.models.generate_content(
|
64
|
+
# model="gemini-2.0-flash-exp-image-generation",
|
65
|
+
|
66
|
+
model = "gemini-2.5-pro-exp-03-25",
|
67
|
+
|
68
|
+
contents=prompt,
|
69
|
+
# config=config
|
70
|
+
)
|
71
|
+
# client.aio.
|
72
|
+
# client.aio.chats.create()
|
73
|
+
|
74
|
+
if __name__ == '__main__':
|
75
|
+
arun(file_object)
|
@@ -21,7 +21,6 @@ from meutils.decorators.retry import retrying
|
|
21
21
|
from meutils.io.files_utils import to_bytes, guess_mime_type
|
22
22
|
from meutils.caches import rcache
|
23
23
|
|
24
|
-
from meutils.llm.clients import qwen_client
|
25
24
|
from meutils.llm.openai_utils import to_openai_params
|
26
25
|
|
27
26
|
from meutils.config_utils.lark_utils import get_next_token_for_polling
|
@@ -38,8 +37,15 @@ cookie = "_gcl_au=1.1.1784604298.1740443944;xlly_s=1;isg=BNHREY3fUiqB6r5JMj56XbB
|
|
38
37
|
|
39
38
|
|
40
39
|
@retrying()
|
41
|
-
|
42
|
-
|
40
|
+
async def to_file(file, api_key):
|
41
|
+
qwen_client = AsyncOpenAI(
|
42
|
+
base_url="https://all.chatfire.cn/qwen/v1",
|
43
|
+
api_key=api_key,
|
44
|
+
default_headers={
|
45
|
+
'User-Agent': ua.random,
|
46
|
+
'Cookie': cookie
|
47
|
+
}
|
48
|
+
)
|
43
49
|
filename = Path(file).name if isinstance(file, str) else 'untitled'
|
44
50
|
mime_type = guess_mime_type(file)
|
45
51
|
file_bytes: bytes = await to_bytes(file)
|
@@ -71,7 +77,7 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
|
|
71
77
|
request.model = "qwen-max-latest"
|
72
78
|
request.messages[-1]['chat_type'] = "search"
|
73
79
|
|
74
|
-
if any(i in model for i in ("qwq", "think")): # qwq-max-search
|
80
|
+
if any(i in model for i in ("qwq", "qvq", "think", "thinking")): # qwq-max-search
|
75
81
|
request.model = "qwen-max-latest"
|
76
82
|
request.messages[-1]['feature_config'] = {"thinking_enabled": True}
|
77
83
|
|
@@ -87,13 +93,13 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
|
|
87
93
|
for i, content in enumerate(user_content):
|
88
94
|
if content.get("type") == 'file_url': # image_url file_url video_url
|
89
95
|
url = content.get(content.get("type")).get("url")
|
90
|
-
file_object = await to_file(url)
|
96
|
+
file_object = await to_file(url, client)
|
91
97
|
|
92
98
|
user_content[i] = {"type": "file", "file": file_object.id}
|
93
99
|
|
94
100
|
elif content.get("type") == 'image_url':
|
95
101
|
url = content.get(content.get("type")).get("url")
|
96
|
-
file_object = await to_file(url)
|
102
|
+
file_object = await to_file(url, client)
|
97
103
|
|
98
104
|
user_content[i] = {"type": "image", "image": file_object.id}
|
99
105
|
|
@@ -102,7 +108,7 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
|
|
102
108
|
|
103
109
|
user_content = [{"type": "text", "text": user_content}]
|
104
110
|
|
105
|
-
file_object = await to_file(file_url)
|
111
|
+
file_object = await to_file(file_url, client)
|
106
112
|
|
107
113
|
content_type = file_object.meta.get("content_type", "")
|
108
114
|
if content_type.startswith("image"):
|
@@ -130,13 +136,6 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
|
|
130
136
|
if not isinstance(response, str):
|
131
137
|
yield response.choices[0].message.content # isinstance(response, str)
|
132
138
|
|
133
|
-
# for i in range(3):
|
134
|
-
# if not isinstance(response, str): # 报错
|
135
|
-
# yield response.choices[0].message.content
|
136
|
-
# break
|
137
|
-
# else:
|
138
|
-
# logger.warning(f"重试 {i}\n{response}")
|
139
|
-
|
140
139
|
|
141
140
|
if __name__ == '__main__':
|
142
141
|
# [
|
@@ -150,36 +149,39 @@ if __name__ == '__main__':
|
|
150
149
|
# "qwen2.5-32b-instruct"
|
151
150
|
# ]
|
152
151
|
|
153
|
-
# user_content = [
|
154
|
-
# {
|
155
|
-
# "type": "text",
|
156
|
-
# "text": "解读图片"
|
157
|
-
# },
|
158
|
-
# {
|
159
|
-
# "type": "image_url",
|
160
|
-
# "image_url": {
|
161
|
-
# "url": "https://fyb-pc-static.cdn.bcebos.com/static/asset/homepage@2x_daaf4f0f6cf971ed6d9329b30afdf438.png"
|
162
|
-
# }
|
163
|
-
# }
|
164
|
-
# ]
|
165
|
-
|
166
152
|
user_content = [
|
167
153
|
{
|
168
154
|
"type": "text",
|
169
|
-
"text": "
|
155
|
+
"text": "一句话总结"
|
170
156
|
},
|
171
157
|
{
|
172
|
-
"type": "
|
173
|
-
"
|
174
|
-
"url": "https://
|
158
|
+
"type": "image_url",
|
159
|
+
"image_url": {
|
160
|
+
"url": "https://fyb-pc-static.cdn.bcebos.com/static/asset/homepage@2x_daaf4f0f6cf971ed6d9329b30afdf438.png"
|
175
161
|
}
|
176
162
|
}
|
177
|
-
|
178
163
|
]
|
179
164
|
|
165
|
+
# user_content = [
|
166
|
+
# {
|
167
|
+
# "type": "text",
|
168
|
+
# "text": "总结下"
|
169
|
+
# },
|
170
|
+
# {
|
171
|
+
# "type": "file_url",
|
172
|
+
# "file_url": {
|
173
|
+
# "url": "https://oss.ffire.cc/files/AIGC.pdf"
|
174
|
+
# }
|
175
|
+
# }
|
176
|
+
#
|
177
|
+
# ]
|
178
|
+
|
180
179
|
request = CompletionRequest(
|
181
180
|
# model="qwen-turbo-2024-11-01",
|
182
|
-
model="qwen-max-latest",
|
181
|
+
# model="qwen-max-latest",
|
182
|
+
# model="qvq-max-2025-03-25",
|
183
|
+
model="qvq-72b-preview-0310",
|
184
|
+
|
183
185
|
# model="qwen-max-latest-search",
|
184
186
|
# model="qwq-max",
|
185
187
|
# model="qwq-32b-preview",
|
@@ -195,12 +197,12 @@ if __name__ == '__main__':
|
|
195
197
|
{
|
196
198
|
'role': 'user',
|
197
199
|
# 'content': '今天南京天气',
|
198
|
-
'content': "9.8 9.11哪个大",
|
200
|
+
# 'content': "9.8 9.11哪个大",
|
199
201
|
# 'content': 'https://oss.ffire.cc/files/AIGC.pdf 总结下',
|
200
202
|
|
201
203
|
# "chat_type": "search",
|
202
204
|
|
203
|
-
|
205
|
+
'content': user_content,
|
204
206
|
|
205
207
|
# "content": [
|
206
208
|
# {
|
@@ -62,6 +62,11 @@ def to_openai_params(
|
|
62
62
|
data['extra_body'] = extra_body # 拓展字段
|
63
63
|
data['model'] = redirect_model or data['model']
|
64
64
|
|
65
|
+
if request.model.startswith(("gemini",)):
|
66
|
+
data.pop("extra_body", None)
|
67
|
+
data.pop("presence_penalty", None)
|
68
|
+
data.pop("frequency_penalty", None)
|
69
|
+
|
65
70
|
return data
|
66
71
|
|
67
72
|
|
meutils/schemas/oneapi/common.py
CHANGED
@@ -248,6 +248,7 @@ MODEL_PRICE = {
|
|
248
248
|
|
249
249
|
"gpt-4-all": 0.1,
|
250
250
|
"gpt-4o-all": 0.1,
|
251
|
+
"gpt-4o-image": 0.06,
|
251
252
|
|
252
253
|
"gpt-4-gizmo-*": 0.1,
|
253
254
|
"advanced-voice": 1,
|
@@ -427,6 +428,10 @@ MODEL_RATIO = {
|
|
427
428
|
"qwen-vl-max-latest": 1.5,
|
428
429
|
"qwen-vl-plus-latest": 0.75,
|
429
430
|
|
431
|
+
"qwen2.5-vl-7b-instruct": 0.15,
|
432
|
+
"qwen2.5-vl-32b-instruct": 0.5,
|
433
|
+
"qwen2.5-vl-72b-instruct": 1.5,
|
434
|
+
|
430
435
|
"qwen2.5-coder-7b-instruct": 0.05,
|
431
436
|
"qwen2.5-7b-instruct": 0.05,
|
432
437
|
"qwen2.5-14b-instruct": 0.25,
|
@@ -436,12 +441,13 @@ MODEL_RATIO = {
|
|
436
441
|
"qwen2.5-coder-32b-instruct": 0.5,
|
437
442
|
|
438
443
|
"qwq-32b": 1,
|
439
|
-
"qwq-
|
444
|
+
"qwq-plus": 0.8,
|
445
|
+
"qwq-max": 0.8,
|
440
446
|
"qwq-max-search": 2,
|
441
447
|
"qwen-max-search": 2,
|
442
448
|
|
443
449
|
"qvq-72b-preview": 2,
|
444
|
-
"
|
450
|
+
"qvq-max-2025-03-25": 4,
|
445
451
|
|
446
452
|
"qwen1.5-7b-chat": 0.05, # 特价
|
447
453
|
"qwen1.5-14b-chat": 0.7,
|
@@ -904,6 +910,11 @@ COMPLETION_RATIO = {
|
|
904
910
|
"qwen-max": 4,
|
905
911
|
"qwen-vl-max-latest": 3,
|
906
912
|
"qwen-vl-plus-latest": 3,
|
913
|
+
|
914
|
+
"qwen2.5-vl-7b-instruct": 4,
|
915
|
+
"qwen2.5-vl-32b-instruct": 4,
|
916
|
+
"qwen2.5-vl-72b-instruct": 4,
|
917
|
+
|
907
918
|
"qwen2-vl-7b-instruct": 5,
|
908
919
|
"qwen2-vl-72b-instruct": 5,
|
909
920
|
"qwen-max-latest": 4,
|
@@ -912,16 +923,17 @@ COMPLETION_RATIO = {
|
|
912
923
|
|
913
924
|
"qwen-plus": 2.5,
|
914
925
|
|
915
|
-
"qwq-
|
926
|
+
"qwq-plus": 2.5,
|
927
|
+
"qwq-max": 2.5,
|
916
928
|
"qwq-max-search": 4,
|
917
929
|
"qwen-max-search": 4,
|
930
|
+
"qvq-max-2025-03-25": 4,
|
918
931
|
|
919
932
|
"qwen2.5-7b-instruct": 4,
|
920
933
|
"qwen2.5-14b-instruct": 4,
|
921
934
|
"qwen2.5-32b-instruct": 4,
|
922
935
|
"qwen2.5-72b-instruct": 4,
|
923
936
|
"qwen2.5-math-72b-instruct": 4,
|
924
|
-
"qwen2.5-vl-72b-instruct": 3,
|
925
937
|
|
926
938
|
"deepseek-vl2": 4,
|
927
939
|
"deepseek-ai/deepseek-vl2": 4,
|
File without changes
|
File without changes
|
{MeUtils-2025.3.26.18.50.26.dist-info → MeUtils-2025.4.1.18.47.48.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|