MeUtils 2025.1.6.14.2.0__py3-none-any.whl → 2025.1.10.20.14.42__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.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/METADATA +28 -28
- {MeUtils-2025.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/RECORD +67 -59
- examples/_openaisdk/openai_chatfire.py +11 -4
- examples/_openaisdk/openai_images.py +3 -1
- examples/_openaisdk/openai_lingyi.py +59 -0
- examples/_openaisdk/openai_ppu.py +47 -0
- examples/_openaisdk/openai_test.py +2 -2
- examples/_openaisdk/openai_together.py +57 -0
- examples/_openaisdk/openai_zhipu.py +4 -3
- meutils/ai_audio/asr/openai_asr.py +2 -2
- meutils/apis/audio/deepinfra.py +2 -2
- meutils/apis/chatglm/glm_video_api.py +1 -1
- meutils/apis/common.py +5 -1
- meutils/apis/hailuoai/videos.py +14 -5
- meutils/apis/images/eidt.py +36 -0
- meutils/apis/images/gitee_kolors.py +49 -0
- meutils/apis/images/recraft.py +24 -6
- meutils/apis/niutrans.py +27 -8
- meutils/apis/oneapi/utils.py +24 -9
- meutils/apis/translator/deeplx.py +4 -3
- meutils/caches/redis_cache.py +5 -0
- meutils/common.py +1 -0
- meutils/config_utils/lark_utils/common.py +0 -1
- meutils/data/VERSION +1 -1
- meutils/io/files_utils.py +11 -5
- meutils/io/image.py +28 -2
- meutils/llm/clients.py +38 -0
- meutils/llm/completions/agents/file.py +124 -0
- meutils/llm/openai_utils/common.py +2 -2
- meutils/llm/utils.py +79 -0
- meutils/llm/x.py +75 -0
- meutils/notice/feishu.py +1 -0
- meutils/parsers/__init__.py +10 -0
- meutils/parsers/file_parsers.py +107 -0
- meutils/schemas/db/oneapi_types.py +3 -0
- meutils/schemas/image_types.py +28 -2
- meutils/schemas/kuaishou_types.py +1 -1
- meutils/schemas/oneapi/common.py +22 -12
- meutils/serving/fastapi/exceptions/http_error.py +2 -6
- meutils/str_utils/regular_expression.py +29 -6
- meutils/llm/completions/agents/files.py +0 -18
- meutils/llm/openai_client.py +0 -15
- {MeUtils-2025.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/LICENSE +0 -0
- {MeUtils-2025.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/WHEEL +0 -0
- {MeUtils-2025.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/entry_points.txt +0 -0
- {MeUtils-2025.1.6.14.2.0.dist-info → MeUtils-2025.1.10.20.14.42.dist-info}/top_level.txt +0 -0
- /meutils/{fileparser → parsers/fileparser}/PDF/346/212/275/345/217/226.py" +0 -0
- /meutils/{fileparser → parsers/fileparser}/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/common.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/demo.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/__main__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/filetype.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/helpers.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/match.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/application.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/archive.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/audio.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/base.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/document.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/font.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/image.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/isobmff.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/video.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/utils.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/pdf.py +0 -0
- /meutils/{fileparser → parsers/fileparser}//350/241/250/346/240/274/346/212/275/345/217/226.py" +0 -0
meutils/schemas/oneapi/common.py
CHANGED
@@ -17,6 +17,14 @@ FREE = 0.001
|
|
17
17
|
MJ = 1.5
|
18
18
|
|
19
19
|
MODEL_PRICE = {
|
20
|
+
# rix
|
21
|
+
"kling_image": 0.02,
|
22
|
+
"kling_virtual_try_on": 1,
|
23
|
+
|
24
|
+
"kling_video": 1,
|
25
|
+
"kling_extend": 1,
|
26
|
+
"kling_lip_sync": 1,
|
27
|
+
|
20
28
|
# chatfire
|
21
29
|
"ppu-0001": 0.0001,
|
22
30
|
"ppu-001": 0.001,
|
@@ -276,12 +284,9 @@ MODEL_RATIO = {
|
|
276
284
|
"claude-3-5-haiku-20241022": 4,
|
277
285
|
"anthropic/claude-3-5-haiku-20241022:beta": 4,
|
278
286
|
|
279
|
-
"grok":
|
280
|
-
"grok-
|
281
|
-
|
282
|
-
# "grok-2": 1,
|
283
|
-
"x-ai/grok-beta": 2.5,
|
284
|
-
"grok-vision-beta": 2.5,
|
287
|
+
"grok-2": 1,
|
288
|
+
"grok-2-1212": 1,
|
289
|
+
"grok-2-vision-1212": 1,
|
285
290
|
|
286
291
|
# 定制
|
287
292
|
"lingxi-all": 1,
|
@@ -299,7 +304,7 @@ MODEL_RATIO = {
|
|
299
304
|
"glm-4-0520": 2.5,
|
300
305
|
"glm-4-airx": 10,
|
301
306
|
"glm-4v": 2.5,
|
302
|
-
"glm-4v-plus":
|
307
|
+
"glm-4v-plus": 2,
|
303
308
|
"glm-4v-flash": 0.1,
|
304
309
|
"glm-4-plus": 25,
|
305
310
|
|
@@ -367,12 +372,14 @@ MODEL_RATIO = {
|
|
367
372
|
"yi-1.5-34b-chat-16k": 0.63,
|
368
373
|
|
369
374
|
"yi-lightning": 0.5,
|
375
|
+
"yi-vision-v2": 3,
|
376
|
+
|
377
|
+
"yi-vision": 3,
|
370
378
|
"yi-large": 10,
|
371
379
|
"yi-large-turbo": 6,
|
372
380
|
"yi-large-rag": 12.5,
|
373
381
|
"yi-medium": 1.25,
|
374
382
|
"yi-medium-200k": 6,
|
375
|
-
"yi-vision": 3,
|
376
383
|
|
377
384
|
# minimax https://platform.minimaxi.com/document/price?id=6433f32294878d408fc8293e
|
378
385
|
"abab6.5-chat": 15 / 7.5,
|
@@ -389,6 +396,7 @@ MODEL_RATIO = {
|
|
389
396
|
"deepseek-v3": 0.5,
|
390
397
|
"deepseek/deepseek-chat": 0.5,
|
391
398
|
"deepseek-ai/DeepSeek-V3": 0.5,
|
399
|
+
"accounts/fireworks/models/deepseek-v3": 0.5,
|
392
400
|
|
393
401
|
'deepseek-r1': 0.5,
|
394
402
|
'deepseek-think': 0.5,
|
@@ -484,6 +492,7 @@ MODEL_RATIO = {
|
|
484
492
|
"google/gemini-flash-1.5-8b-exp": 0.1, # openrouter免费
|
485
493
|
"gemini-2.0-flash": 0.5,
|
486
494
|
"gemini-2.0-flash-exp": 0.5,
|
495
|
+
"gemini-2.0-flash-thinking-exp": 1,
|
487
496
|
"gemini-2.0-flash-thinking-exp-1219": 1,
|
488
497
|
|
489
498
|
"gemini-1.5-pro-001": 1,
|
@@ -590,10 +599,9 @@ COMPLETION_RATIO = {
|
|
590
599
|
"gpt-4-plus": 5,
|
591
600
|
"gpt-4o-plus": 5,
|
592
601
|
|
593
|
-
"grok":
|
594
|
-
"grok-
|
595
|
-
"
|
596
|
-
"grok-vision-beta": 3,
|
602
|
+
"grok-2": 5,
|
603
|
+
"grok-2-1212": 5,
|
604
|
+
"grok-2-vision-1212": 5,
|
597
605
|
|
598
606
|
"claude-3-5-haiku-20241022": 5,
|
599
607
|
"anthropic/claude-3-5-haiku-20241022:beta": 5,
|
@@ -649,6 +657,7 @@ COMPLETION_RATIO = {
|
|
649
657
|
|
650
658
|
"gemini-2.0-flash": 5,
|
651
659
|
"gemini-2.0-flash-exp": 5,
|
660
|
+
"gemini-2.0-flash-thinking-exp": 5,
|
652
661
|
"gemini-2.0-flash-thinking-exp-1219": 5,
|
653
662
|
|
654
663
|
"hunyuan-a52b-instruct": 5,
|
@@ -675,6 +684,7 @@ COMPLETION_RATIO = {
|
|
675
684
|
"deepseek-search": 1,
|
676
685
|
"deepseek/deepseek-chat": 1,
|
677
686
|
"deepseek-ai/DeepSeek-V3": 1,
|
687
|
+
"accounts/fireworks/models/deepseek-v3": 1,
|
678
688
|
|
679
689
|
"glm-zero": 5,
|
680
690
|
"glm-zero-preview": 5,
|
@@ -15,7 +15,7 @@ from meutils.notice.feishu import send_message as _send_message
|
|
15
15
|
send_message = partial(
|
16
16
|
_send_message,
|
17
17
|
title=__name__,
|
18
|
-
url="https://open.feishu.cn/open-apis/bot/v2/hook/
|
18
|
+
url="https://open.feishu.cn/open-apis/bot/v2/hook/d1c7b67d-b0f8-4067-a2f5-109f20eeb696"
|
19
19
|
)
|
20
20
|
|
21
21
|
|
@@ -54,7 +54,7 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
|
|
54
54
|
|
55
55
|
# 默认值
|
56
56
|
reps = None
|
57
|
-
request_json = {}
|
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
|
|
@@ -65,10 +65,6 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
|
|
65
65
|
content=content,
|
66
66
|
status_code=status_code,
|
67
67
|
)
|
68
|
-
try:
|
69
|
-
request_json = await request.json()
|
70
|
-
except Exception as e:
|
71
|
-
request_json = {"error": f"json parse error: {e}"}
|
72
68
|
|
73
69
|
# send_message
|
74
70
|
content_detail = f"{traceback.format_exc()}"
|
@@ -9,6 +9,7 @@
|
|
9
9
|
# @Description :
|
10
10
|
|
11
11
|
from meutils.pipe import *
|
12
|
+
from urllib.parse import unquote, unquote_plus
|
12
13
|
|
13
14
|
zh = re.compile('[a-zA-Z\u4e00-\u9fa5]+') # 中文 + 字母
|
14
15
|
nozh = re.compile('[^a-zA-Z\u4e00-\u9fa5]+') # 中文 + 字母
|
@@ -58,11 +59,13 @@ def get_parse_and_index(text, pattern):
|
|
58
59
|
|
59
60
|
@lru_cache()
|
60
61
|
def parse_url(text: str, for_image=False):
|
62
|
+
|
61
63
|
# url_pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
|
62
64
|
url_pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+|#]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
|
63
65
|
|
64
66
|
# url_pattern = 'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+'
|
65
67
|
if for_image:
|
68
|
+
text = unquote_plus(text)
|
66
69
|
# suffix = [
|
67
70
|
# ".jpg",
|
68
71
|
# ".jpeg",
|
@@ -78,15 +81,26 @@ def parse_url(text: str, for_image=False):
|
|
78
81
|
# ".raw",
|
79
82
|
# ".dng"
|
80
83
|
# ]
|
81
|
-
url_pattern = r'https?://[\w\-\.]+/\S+\.(?:png|jpg|jpeg|gif)'
|
82
|
-
url_pattern = r
|
84
|
+
# url_pattern = r'https?://[\w\-\.]+/\S+\.(?:png|jpg|jpeg|gif)'
|
85
|
+
url_pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[#]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+\.(?:jpg|jpeg|png|gif|svg|webp)'
|
86
|
+
|
83
87
|
|
84
|
-
urls = re.findall(url_pattern,
|
88
|
+
urls = re.findall(url_pattern, text)
|
85
89
|
|
86
90
|
return urls
|
87
91
|
|
88
92
|
|
89
93
|
if __name__ == '__main__':
|
94
|
+
# from urllib.parse import urlparse
|
95
|
+
#
|
96
|
+
#
|
97
|
+
# def is_valid_url(url):
|
98
|
+
# try:
|
99
|
+
# result = urlparse(url)
|
100
|
+
# return all([result.scheme, result.netloc])
|
101
|
+
# except:
|
102
|
+
# return False
|
103
|
+
|
90
104
|
text = """7个正规url
|
91
105
|
这是一段包含URL的文本,https://www.google.com 是一个URL,另一个URL是http://www.baidu.com
|
92
106
|
解读这个文本https://www.url1.com
|
@@ -100,13 +114,22 @@ if __name__ == '__main__':
|
|
100
114
|
总结 https://waptianqi.2345.com/wea_history/58238.htm
|
101
115
|
解释下这张照片 https://img-home.csdnimg.cn/images/20201124032511.png
|
102
116
|
解释下这张https://img-home.csdnimg.cn/images/x.png
|
103
|
-
|
117
|
+
|
104
118
|
img-home.csdnimg.cn/images/20201124032511.png
|
119
|
+
|
120
|
+
|
121
|
+
https://oss.ffire.cc/files/百炼系列手机产品介绍.docx
|
122
|
+
|
123
|
+
https://oss.ffire.cc/files/%E6%8B%9B%E6%A0%87%E6%96%87%E4%BB%B6%E5%A4%87%E6%A1%88%E8%A1%A8%EF%BC%88%E7%AC%AC%E4%BA%8C%E6%AC%A1%EF%BC%89.pdf 这个文件讲了什么?
|
124
|
+
|
105
125
|
"""
|
126
|
+
# https://oss.ffire.cc/files/%E6%8B%9B%E6%A0%87%E6%96%87%E4%BB%B6%E5%A4%87%E6%A1%88%E8%A1%A8%EF%BC%88%E7%AC%AC%E4%BA%8C%E6%AC%A1%EF%BC%89.pdf 正则匹配会卡死
|
106
127
|
# from urllib3.util import parse_url
|
107
|
-
text = "@firebot /换衣 https://oss.ffire.cc/files/try-on.png"
|
128
|
+
# text = "@firebot /换衣 https://oss.ffire.cc/files/try-on.png"
|
129
|
+
# text = "@firebot /换衣 https://oss.ffire.cc/files/try-on.pn"
|
108
130
|
|
109
|
-
print(parse_url(text))
|
131
|
+
# print(parse_url(text))
|
132
|
+
print(parse_url(text, for_image=True))
|
110
133
|
|
111
134
|
# print(parse_url("http://154.3.0.117:39666/docs#/default/get_content_preview_spider_playwright_get"))
|
112
135
|
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# @Project : AI. @by PyCharm
|
4
|
-
# @File : files
|
5
|
-
# @Time : 2025/1/3 15:38
|
6
|
-
# @Author : betterme
|
7
|
-
# @WeChat : meutils
|
8
|
-
# @Software : PyCharm
|
9
|
-
# @Description : 支持文档、图片、音频、视频问答
|
10
|
-
"""单一智能体
|
11
|
-
任意模型支持文档、图片、音频、视频问答
|
12
|
-
api形式
|
13
|
-
- /agents/v1
|
14
|
-
- /v1 前缀区分 agents-{model}【底层调用 /agents/v1】
|
15
|
-
|
16
|
-
"""
|
17
|
-
|
18
|
-
from meutils.pipe import *
|
meutils/llm/openai_client.py
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# @Project : AI. @by PyCharm
|
4
|
-
# @File : chat
|
5
|
-
# @Time : 2024/8/19 14:23
|
6
|
-
# @Author : betterme
|
7
|
-
# @WeChat : meutils
|
8
|
-
# @Software : PyCharm
|
9
|
-
# @Description :
|
10
|
-
|
11
|
-
|
12
|
-
from openai import OpenAI, AsyncOpenAI
|
13
|
-
|
14
|
-
chat = OpenAI().chat.completions.create
|
15
|
-
achat = AsyncOpenAI().chat.completions.create
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/meutils/{fileparser → parsers/fileparser}//350/241/250/346/240/274/346/212/275/345/217/226.py"
RENAMED
File without changes
|