bella-openapi 1.0.2.2__tar.gz → 1.0.2.4__tar.gz

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.
Files changed (32) hide show
  1. {bella_openapi-1.0.2.2/src/bella_openapi.egg-info → bella_openapi-1.0.2.4}/PKG-INFO +2 -1
  2. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/setup.py +2 -1
  3. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/__init__.py +23 -2
  4. bella_openapi-1.0.2.4/src/bella_openapi/entity/__init__.py +27 -0
  5. {bella_openapi-1.0.2.2/src/bella_openapi/domtree → bella_openapi-1.0.2.4/src/bella_openapi/entity}/standard_domtree.py +12 -1
  6. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4/src/bella_openapi.egg-info}/PKG-INFO +2 -1
  7. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi.egg-info/SOURCES.txt +2 -3
  8. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi.egg-info/requires.txt +1 -0
  9. bella_openapi-1.0.2.2/src/bella_openapi/domtree/__init__.py +0 -3
  10. bella_openapi-1.0.2.2/src/bella_openapi/domtree/utils.py +0 -12
  11. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/LICENSE +0 -0
  12. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/README.md +0 -0
  13. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/setup.cfg +0 -0
  14. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/auth_billing.py +0 -0
  15. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/authorize.py +0 -0
  16. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/bella_trace/__init__.py +0 -0
  17. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/bella_trace/_context.py +0 -0
  18. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/bella_trace/fastapi_interceptor.py +0 -0
  19. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/bella_trace/record_log.py +0 -0
  20. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/bella_trace/trace_requests.py +0 -0
  21. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/config.py +0 -0
  22. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/console/__init__.py +0 -0
  23. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/console/models.py +0 -0
  24. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/exception.py +0 -0
  25. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/log.py +0 -0
  26. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/middleware/__init__.py +0 -0
  27. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/middleware/context_middleware.py +0 -0
  28. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/openapi_contexvar.py +0 -0
  29. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi/schema.py +0 -0
  30. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi.egg-info/dependency_links.txt +0 -0
  31. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi.egg-info/not-zip-safe +0 -0
  32. {bella_openapi-1.0.2.2 → bella_openapi-1.0.2.4}/src/bella_openapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bella-openapi
3
- Version: 1.0.2.2
3
+ Version: 1.0.2.4
4
4
  Summary: client for openapi service.
5
5
  Home-page:
6
6
  Author: ['tangxiaolong', 'fanqiangwei', 'zhangxiaojia', 'liumin', 'wangyukun']
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: httpx<=0.26.0,>=0.10.0
13
13
  Requires-Dist: Werkzeug==3.0.1
14
+ Requires-Dist: tiktoken>=0.5.0
14
15
  Dynamic: author
15
16
  Dynamic: classifier
16
17
  Dynamic: description
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  SHORT = "client for openapi service."
5
5
 
6
- __version__ = "1.0.2.2"
6
+ __version__ = "1.0.2.4"
7
7
  __author__ = ["tangxiaolong", "fanqiangwei", "zhangxiaojia", 'liumin', 'wangyukun']
8
8
  __email__ = ''
9
9
  readme_path = 'README.md'
@@ -16,6 +16,7 @@ setup(
16
16
  install_requires=[
17
17
  'httpx>=0.10.0,<=0.26.0',
18
18
  'Werkzeug==3.0.1',
19
+ 'tiktoken>=0.5.0',
19
20
  ],
20
21
  url='',
21
22
  author=__author__,
@@ -3,7 +3,19 @@ from .log import operation_log, submit_log
3
3
  from .openapi_contexvar import trace_id_context, caller_id_context, request_url_context
4
4
  from .auth_billing import ErrorInfo, async_authenticate_decorator_args, authenticate_user, print_context, \
5
5
  get_context, set_context, clean_context, report
6
- from .domtree import StandardDomTree, StandardNode
6
+ from .entity import (
7
+ StandardDomTree,
8
+ StandardNode,
9
+ SourceFile,
10
+ StandardPosition,
11
+ StandardImage,
12
+ Cell,
13
+ StandardRow,
14
+ StandardBaseElement,
15
+ StandardElement,
16
+ StandardTableElement,
17
+ StandardImageElement
18
+ )
7
19
 
8
20
  __all__ = ["validate_token", "operation_log",
9
21
  "support_model",
@@ -22,5 +34,14 @@ __all__ = ["validate_token", "operation_log",
22
34
  "clean_context",
23
35
  "report",
24
36
  "StandardDomTree",
25
- "StandardNode"
37
+ "StandardNode",
38
+ "SourceFile",
39
+ "StandardPosition",
40
+ "StandardImage",
41
+ "Cell",
42
+ "StandardRow",
43
+ "StandardBaseElement",
44
+ "StandardElement",
45
+ "StandardTableElement",
46
+ "StandardImageElement"
26
47
  ]
@@ -0,0 +1,27 @@
1
+ from .standard_domtree import (
2
+ StandardDomTree,
3
+ StandardNode,
4
+ SourceFile,
5
+ StandardPosition,
6
+ StandardImage,
7
+ Cell,
8
+ StandardRow,
9
+ StandardBaseElement,
10
+ StandardElement,
11
+ StandardTableElement,
12
+ StandardImageElement
13
+ )
14
+
15
+ __all__ = [
16
+ "StandardDomTree",
17
+ "StandardNode",
18
+ "SourceFile",
19
+ "StandardPosition",
20
+ "StandardImage",
21
+ "Cell",
22
+ "StandardRow",
23
+ "StandardBaseElement",
24
+ "StandardElement",
25
+ "StandardTableElement",
26
+ "StandardImageElement"
27
+ ]
@@ -10,7 +10,7 @@ StandardDomTree - 新的DOM树协议定义
10
10
 
11
11
  from typing import List, Optional, Literal, Any, Union
12
12
  from pydantic import BaseModel, Field
13
-
13
+ import tiktoken
14
14
 
15
15
  # 布局类型映射表:将旧解析器的布局类型映射到新的标准类型
16
16
  # 注意:这个映射表是临时的,后续计划统一布局类型定义
@@ -31,6 +31,16 @@ layout_type_mapping = {
31
31
  "TableNote": "Text", # 目前实际解析出来没有
32
32
  }
33
33
 
34
+ # 自研模型均用gpt-4计算(可能有误差,可忽略)
35
+ def count_tokens(text: str, model: str = "gpt-4") -> int:
36
+ if not text:
37
+ return 0
38
+ encoding = tiktoken.encoding_for_model(model)
39
+ tokens = encoding.encode(text)
40
+ # 计算标记列表的长度,即标记的数量
41
+ token_count = len(tokens)
42
+ # 返回标记的数量
43
+ return token_count
34
44
 
35
45
  class SourceFile(BaseModel):
36
46
  id: str # 文件ID,唯一标识符,类型为string
@@ -489,3 +499,4 @@ class StandardDomTree(BaseModel):
489
499
  standard_node.tokens = tokens
490
500
 
491
501
  return standard_node
502
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bella-openapi
3
- Version: 1.0.2.2
3
+ Version: 1.0.2.4
4
4
  Summary: client for openapi service.
5
5
  Home-page:
6
6
  Author: ['tangxiaolong', 'fanqiangwei', 'zhangxiaojia', 'liumin', 'wangyukun']
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: httpx<=0.26.0,>=0.10.0
13
13
  Requires-Dist: Werkzeug==3.0.1
14
+ Requires-Dist: tiktoken>=0.5.0
14
15
  Dynamic: author
15
16
  Dynamic: classifier
16
17
  Dynamic: description
@@ -22,8 +22,7 @@ src/bella_openapi/bella_trace/record_log.py
22
22
  src/bella_openapi/bella_trace/trace_requests.py
23
23
  src/bella_openapi/console/__init__.py
24
24
  src/bella_openapi/console/models.py
25
- src/bella_openapi/domtree/__init__.py
26
- src/bella_openapi/domtree/standard_domtree.py
27
- src/bella_openapi/domtree/utils.py
25
+ src/bella_openapi/entity/__init__.py
26
+ src/bella_openapi/entity/standard_domtree.py
28
27
  src/bella_openapi/middleware/__init__.py
29
28
  src/bella_openapi/middleware/context_middleware.py
@@ -1,2 +1,3 @@
1
1
  httpx<=0.26.0,>=0.10.0
2
2
  Werkzeug==3.0.1
3
+ tiktoken>=0.5.0
@@ -1,3 +0,0 @@
1
- from .standard_domtree import StandardDomTree, StandardNode
2
-
3
- __all__ = ["StandardDomTree", "StandardNode"]
@@ -1,12 +0,0 @@
1
- import tiktoken
2
-
3
- # 自研模型均用gpt-4计算(可能有误差,可忽略)
4
- def count_tokens(text: str, model: str = "gpt-4") -> int:
5
- if not text:
6
- return 0
7
- encoding = tiktoken.encoding_for_model(model)
8
- tokens = encoding.encode(text)
9
- # 计算标记列表的长度,即标记的数量
10
- token_count = len(tokens)
11
- # 返回标记的数量
12
- return token_count
File without changes