MeUtils 2024.12.13.15.17.40__py3-none-any.whl → 2024.12.19.9.30.53__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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ---
4
4
  <details markdown="1">
5
- <summary><b>业务范围</b></summary>
5
+ <summary><b>🔥业务经营范围</b></summary>
6
6
 
7
7
  - api服务(没有的找企微客服增加)
8
8
  - 提供主流大模型服务,gpt/claude/gemini/llama/国产大模型等等
@@ -31,6 +31,10 @@
31
31
 
32
32
  </details>
33
33
 
34
+ ## 2024-12-13
35
+ - 新增模型 混元视频(支持高并发,非逆向可商用,限时特价1毛)[接口文档](https://api.chatfire.cn/docs/api-244309840)
36
+ HunyuanVideo 是腾讯推出的开源视频生成基础模型,拥有超过 130 亿参数,是目前最大的开源视频生成模型。该模型采用统一的图像和视频生成架构,集成了数据整理、图像-视频联合模型训练和高效基础设施等关键技术。模型使用多模态大语言模型作为文本编码器,通过 3D VAE 进行空间-时间压缩,并提供提示词重写功能。根据专业人工评估结果,HunyuanVideo 在文本对齐、运动质量和视觉质量等方面的表现优于现有最先进的模型
37
+
34
38
  ## 2024-12-09
35
39
  - 新增模型
36
40
  - meta-llama/Llama-3.3-70B-Instruct: Llama 3.3 是 Llama 系列最先进的多语言开源大型语言模型,以极低成本体验媲美 405B 模型的性能。基于 Transformer 结构,并通过监督微调(SFT)和人类反馈强化学习(RLHF)提升有用性和安全性。其指令调优版本专为多语言对话优化,在多项行业基准上表现优于众多开源和封闭聊天模型。知识截止日期为 2023 年 12 月。
@@ -43,6 +47,13 @@
43
47
  - o1-pro: (官网 200刀 plus 版本 `逆向工程`,有思考过程显示)o1-pro 是OpenAI针对复杂任务的新推理模型,该任务需要广泛的常识。该模型具有 200k 上下文,目前全球最强模型,支持图片识别
44
48
 
45
49
 
50
+
51
+
52
+ ---
53
+
54
+ <details markdown="1">
55
+ <summary><b>历史更新</b></summary>
56
+
46
57
  ## 2024-12-05
47
58
  - 新增模型gpt-4-plus/gpt-4o-plus按倍率计算
48
59
  > OpenAI-plus会员 逆向工程
@@ -59,32 +70,4 @@
59
70
 
60
71
 
61
72
 
62
- ---
63
-
64
- <details markdown="1">
65
- <summary><b>历史更新</b></summary>
66
- ## 2024-11-20
67
-
68
- ### 支持ReplicateAPI,兼容goamz系统
69
-
70
- - [支持的模型列表](https://api.chatfire.cn/docs/doc-5518412)
71
-
72
- | 模型 | 每张图片单价 |
73
- |------------------------------------------|----------------|
74
- | black-forest-labs/flux-1.1-pro | $0.040 |
75
- | black-forest-labs/flux-1.1-pro-ultra | $0.060 |
76
- | black-forest-labs/flux-dev | $0.025 |
77
- | black-forest-labs/flux-pro | $0.055 |
78
- | black-forest-labs/flux-schnell | $0.003 |
79
- | ideogram-ai/ideogram-v2 | $0.080 |
80
- | ideogram-ai/ideogram-v2-turbo | $0.050 |
81
- | recraft-ai/recraft-v3 | $0.040 |
82
- | recraft-ai/recraft-v3-svg | $0.080 |
83
- | stability-ai/stable-diffusion-3 | $0.035 |
84
- | stability-ai/stable-diffusion-3.5-large | $0.065 |
85
- | stability-ai/stable-diffusion-3.5-large-turbo | $0.040 |
86
- | stability-ai/stable-diffusion-3.5-medium | $0.035 |
87
-
88
- - [接口文档](https://api.chatfire.cn/docs/api-235361039)
89
-
90
73
  </details>
meutils/io/files_utils.py CHANGED
@@ -11,6 +11,8 @@
11
11
  import mimetypes
12
12
  from meutils.pipe import *
13
13
  from meutils.decorators.retry import retrying
14
+ from meutils.caches.redis_cache import cache
15
+
14
16
  # from fastapi import UploadFile 有点区别
15
17
  from starlette.datastructures import UploadFile
16
18
  from contextlib import asynccontextmanager
@@ -85,6 +87,33 @@ async def to_tempfile(file: Union[UploadFile, str]):
85
87
  yield temp.name
86
88
 
87
89
 
90
+ @cache(ttl=7 * 24 * 3600)
91
+ async def to_url_fal(
92
+ file: Union[str, bytes],
93
+ filename: Optional[str] = None,
94
+ headers: Optional[dict] = None,
95
+ content_type: str = "application/octet-stream",
96
+ ):
97
+ """对象存储"""
98
+ if not file: return
99
+
100
+ if file.startswith("http"): # 转存: todo: base64
101
+ content_type = mimetypes.guess_type(file)[0] or content_type
102
+
103
+ file = await to_bytes(file, headers=headers)
104
+
105
+ content_type = (
106
+ mimetypes.guess_type(filename or '')[0]
107
+ or mimetypes.guess_type(f"x.{content_type}")[0] # format: image/png
108
+ or content_type
109
+ )
110
+
111
+ import fal_client
112
+
113
+ url = await fal_client.upload_async(data=file, content_type=content_type, file_name=filename)
114
+ return url
115
+
116
+
88
117
  async def to_url(
89
118
  file: Union[UploadFile, str, bytes],
90
119
  filename: Optional[str] = None,
@@ -179,12 +208,14 @@ if __name__ == '__main__':
179
208
 
180
209
  # arun(to_url(file, content_type=None))
181
210
 
182
- print(mimetypes.guess_type("x.jpg"))
211
+ # print(mimetypes.guess_type("x.jpg"))
183
212
  # print(mimetypes.guess_type("x.png"))
184
- print(mimetypes.guess_type("x"))
213
+ # print(mimetypes.guess_type("x.jpg"))
185
214
 
186
- print(mimetypes.guess_extension("x.mp4", False))
215
+ # print(mimetypes.guess_extension("x.mp4", False))
187
216
 
188
217
  # arun(to_url(
189
218
  # "https://cdn.hailuoai.video/moss/prod/2024-11-11-09/video/1731287464150180347-video_raw_8ba15c5c206f8d393a9248f4f9215ed8_312186282087260162.mp4",
190
219
  # content_type=None))
220
+
221
+ arun(to_url_fal(url))
@@ -77,7 +77,8 @@ if __name__ == '__main__':
77
77
  c = Completions()
78
78
 
79
79
  request = ChatCompletionRequest(
80
- model="qwen-turbo-2024-11-01",
80
+ # model="qwen-turbo-2024-11-01",
81
+ model="claude-3-5-sonnet-20241022",
81
82
  messages=[
82
83
  {
83
84
  'role': 'system',
meutils/llm/mappers.py ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : mappers
5
+ # @Time : 2024/12/16 14:49
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+
13
+
14
+ def llm_mapper(model):
15
+ return
@@ -58,4 +58,8 @@ def doc2text(filename):
58
58
 
59
59
  if __name__ == '__main__':
60
60
  with timer():
61
- extract_text('5.1-SNZ413量锐指数增强9号私募证券投资基金私募基金合同--套印版.pdf')
61
+ r = extract_text('x.pdf')
62
+
63
+
64
+ # import tiktoken
65
+ # print(tiktoken.encoding_for_model('gpt-3.5-turbo'))
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : jimeng_types
5
+ # @Time : 2024/12/16 18:20
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+ import uuid
11
+
12
+ from meutils.pipe import *
13
+
14
+ BASE_URL = "https://jimeng.jianying.com"
15
+ FEISHU_URL = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=zkPAHw"
16
+
17
+ MODELS_MAP = {
18
+ "jimeng-2.1": "high_aes_general_v21_L:general_v2.1_L",
19
+
20
+ "jimeng-2.0-pro": "high_aes_general_v20_L:general_v2.0_L",
21
+ "high_aes_general_v20_L:general_v2.0_L": "high_aes_general_v20_L:general_v2.0_L",
22
+
23
+ "jimeng-2.0": "high_aes_general_v20:general_v2.0",
24
+ "jimeng-1.4": "high_aes_general_v14:general_v1.4",
25
+ "jimeng-xl-pro": "text2img_xl_sft",
26
+
27
+ "default": "high_aes_general_v21_L:general_v2.1_L",
28
+ }
@@ -83,6 +83,8 @@ MODEL_PRICE = {
83
83
 
84
84
  "ideogram": 0.3,
85
85
 
86
+ "api-hunyuan-video": 0.1,
87
+
86
88
  # replicate
87
89
  "api-replicate-flux-1.1-pro": 0.040,
88
90
  "api-replicate-flux-1.1-pro-ultra": 0.060,
@@ -197,7 +199,12 @@ MODEL_PRICE = {
197
199
  "cogview-3-plus": 0.02,
198
200
 
199
201
  "glm-4-all": 0.01,
202
+
200
203
  "kimi-all": 0.01,
204
+ "kimi-math": 0.01,
205
+ "kimi-k1": 0.05,
206
+ "kimi-search": 0.01,
207
+ "kimi-research": 0.05,
201
208
 
202
209
  "spark-all": 0.01,
203
210
  "step-1-all": 0.01,
@@ -293,6 +300,7 @@ MODEL_RATIO = {
293
300
  "glm-4v": 2.5,
294
301
  "glm-4v-plus": 1, # 2.5
295
302
  "glm-4v-flash": 0.1,
303
+ "glm-4-plus": 25,
296
304
 
297
305
  # 月之暗面 https://platform.moonshot.cn/docs/price/chat#%E4%BA%A7%E5%93%81%E5%AE%9A%E4%BB%B7
298
306
  "moonshot-v1-8k": 6 / 2, # 特价
@@ -500,6 +508,7 @@ MODEL_RATIO = {
500
508
  "gpt-4o-2024-08-06": 1.25,
501
509
  "gpt-4o-2024-11-20": 1.25,
502
510
 
511
+ "o1": 7.5,
503
512
  "o1-mini": 1.5,
504
513
  "o1-preview": 7.5,
505
514
  "o1-mini-2024-09-12": 1.5,