xp3-tool 1.0__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.
- xp3_tool-1.0/PKG-INFO +21 -0
- xp3_tool-1.0/README.md +1 -0
- xp3_tool-1.0/setup.cfg +4 -0
- xp3_tool-1.0/setup.py +131 -0
- xp3_tool-1.0/xp3_tool/__init__.py +8 -0
- xp3_tool-1.0/xp3_tool/xp3_tool.py +35 -0
- xp3_tool-1.0/xp3_tool.egg-info/PKG-INFO +21 -0
- xp3_tool-1.0/xp3_tool.egg-info/SOURCES.txt +9 -0
- xp3_tool-1.0/xp3_tool.egg-info/dependency_links.txt +1 -0
- xp3_tool-1.0/xp3_tool.egg-info/requires.txt +2 -0
- xp3_tool-1.0/xp3_tool.egg-info/top_level.txt +1 -0
xp3_tool-1.0/PKG-INFO
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: xp3_tool
|
3
|
+
Version: 1.0
|
4
|
+
Summary: xp_t3_tool
|
5
|
+
Home-page:
|
6
|
+
Author: XuPeng
|
7
|
+
Author-email: xupeng23456@126.com
|
8
|
+
License: MIT
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
13
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
15
|
+
Requires-Python: >=3.10.0
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
Requires-Dist: openai
|
18
|
+
Requires-Dist: pandas
|
19
|
+
|
20
|
+
|
21
|
+
本模块提供了一个简单的 CallAi 类,用于与 OpenAI 兼容的 API 服务进行交互,支持设置提示词并发送对话请求。同时包含一个随机字符串生成工具函数,可用于生成指定长度的字母数字混合字符串。
|
xp3_tool-1.0/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
本模块提供了一个简单的 CallAi 类,用于与 OpenAI 兼容的 API 服务进行交互,支持设置提示词并发送对话请求。同时包含一个随机字符串生成工具函数,可用于生成指定长度的字母数字混合字符串。
|
xp3_tool-1.0/setup.cfg
ADDED
xp3_tool-1.0/setup.py
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# Note: To use the 'upload' functionality of this file, you must:
|
5
|
+
# $ pipenv install twine --dev
|
6
|
+
|
7
|
+
import io
|
8
|
+
import os
|
9
|
+
import sys
|
10
|
+
from shutil import rmtree
|
11
|
+
|
12
|
+
from setuptools import find_packages, setup, Command
|
13
|
+
|
14
|
+
# Package meta-data.
|
15
|
+
NAME = 'xp3_tool'
|
16
|
+
DESCRIPTION = 'xp_t3_tool'
|
17
|
+
URL = ''
|
18
|
+
EMAIL = 'xupeng23456@126.com'
|
19
|
+
AUTHOR = 'XuPeng'
|
20
|
+
REQUIRES_PYTHON = '>=3.10.0'
|
21
|
+
VERSION = '1.0'
|
22
|
+
|
23
|
+
# What packages are required for this module to be executed?
|
24
|
+
REQUIRED = [
|
25
|
+
'openai', 'pandas'
|
26
|
+
]
|
27
|
+
|
28
|
+
# What packages are optional?
|
29
|
+
EXTRAS = {
|
30
|
+
# 'fancy feature': ['django'],
|
31
|
+
}
|
32
|
+
|
33
|
+
# The rest you shouldn't have to touch too much :)
|
34
|
+
# ------------------------------------------------
|
35
|
+
# Except, perhaps the License and Trove Classifiers!
|
36
|
+
# If you do change the License, remember to change the Trove Classifier for that!
|
37
|
+
|
38
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
39
|
+
|
40
|
+
# Import the README and use it as the long-description.
|
41
|
+
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
|
42
|
+
try:
|
43
|
+
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
|
44
|
+
long_description = '\n' + f.read()
|
45
|
+
except FileNotFoundError:
|
46
|
+
long_description = DESCRIPTION
|
47
|
+
|
48
|
+
# Load the package's __version__.py module as a dictionary.
|
49
|
+
about = {}
|
50
|
+
if not VERSION:
|
51
|
+
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
|
52
|
+
with open(os.path.join(here, project_slug, '__version__.py')) as f:
|
53
|
+
exec(f.read(), about)
|
54
|
+
else:
|
55
|
+
about['__version__'] = VERSION
|
56
|
+
|
57
|
+
|
58
|
+
class UploadCommand(Command):
|
59
|
+
"""Support setup.py upload."""
|
60
|
+
|
61
|
+
description = 'Build and publish the package.'
|
62
|
+
user_options = []
|
63
|
+
|
64
|
+
@staticmethod
|
65
|
+
def status(s):
|
66
|
+
"""Prints things in bold."""
|
67
|
+
print('\033[1m{0}\033[0m'.format(s))
|
68
|
+
|
69
|
+
def initialize_options(self):
|
70
|
+
pass
|
71
|
+
|
72
|
+
def finalize_options(self):
|
73
|
+
pass
|
74
|
+
|
75
|
+
def run(self):
|
76
|
+
try:
|
77
|
+
self.status('Removing previous builds…')
|
78
|
+
rmtree(os.path.join(here, 'dist'))
|
79
|
+
except OSError:
|
80
|
+
pass
|
81
|
+
|
82
|
+
self.status('Building Source and Wheel (universal) distribution…')
|
83
|
+
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
|
84
|
+
|
85
|
+
self.status('Uploading the package to PyPI via Twine…')
|
86
|
+
os.system('twine upload dist/*')
|
87
|
+
|
88
|
+
self.status('Pushing git tags…')
|
89
|
+
os.system('git tag v{0}'.format(about['__version__']))
|
90
|
+
os.system('git push --tags')
|
91
|
+
|
92
|
+
sys.exit()
|
93
|
+
|
94
|
+
|
95
|
+
# Where the magic happens:
|
96
|
+
setup(
|
97
|
+
name=NAME,
|
98
|
+
version=about['__version__'],
|
99
|
+
description=DESCRIPTION,
|
100
|
+
long_description=long_description,
|
101
|
+
long_description_content_type='text/markdown',
|
102
|
+
author=AUTHOR,
|
103
|
+
author_email=EMAIL,
|
104
|
+
python_requires=REQUIRES_PYTHON,
|
105
|
+
url=URL,
|
106
|
+
# packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
|
107
|
+
# If your package is a single module, use this instead of 'packages':
|
108
|
+
packages=['xp3_tool'],
|
109
|
+
|
110
|
+
# entry_points={
|
111
|
+
# 'console_scripts': ['mycli=mymodule:cli'],
|
112
|
+
# },
|
113
|
+
install_requires=REQUIRED,
|
114
|
+
extras_require=EXTRAS,
|
115
|
+
include_package_data=True,
|
116
|
+
license='MIT',
|
117
|
+
classifiers=[
|
118
|
+
# Trove classifiers
|
119
|
+
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
120
|
+
'License :: OSI Approved :: MIT License',
|
121
|
+
'Programming Language :: Python',
|
122
|
+
'Programming Language :: Python :: 3',
|
123
|
+
'Programming Language :: Python :: 3.6',
|
124
|
+
'Programming Language :: Python :: Implementation :: CPython',
|
125
|
+
'Programming Language :: Python :: Implementation :: PyPy'
|
126
|
+
],
|
127
|
+
# $ setup.py publish support.
|
128
|
+
cmdclass={
|
129
|
+
'upload': UploadCommand,
|
130
|
+
},
|
131
|
+
)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
def uuid(length=16):
|
2
|
+
chars = string.ascii_letters + string.digits
|
3
|
+
return ''.join(random.choice(chars) for _ in range(length))
|
4
|
+
|
5
|
+
class CallAi:
|
6
|
+
def __init__(self,api_key,base_url,model=None):
|
7
|
+
self.api_key = api_key
|
8
|
+
self.base_url = base_url
|
9
|
+
self.client = OpenAI(
|
10
|
+
api_key = api_key,
|
11
|
+
base_url= base_url,
|
12
|
+
)
|
13
|
+
self.model = model if model else 'qwen-plus'
|
14
|
+
self._prompt = ""
|
15
|
+
self.inquiry = ""
|
16
|
+
|
17
|
+
@property
|
18
|
+
def prompt(self):
|
19
|
+
return self._prompt
|
20
|
+
|
21
|
+
@prompt.setter
|
22
|
+
def prompt(self,content):
|
23
|
+
self._prompt = content
|
24
|
+
|
25
|
+
def chat(self,text,top_p = 0.9, temperature = 0.7):
|
26
|
+
completion = self.client.chat.completions.create(
|
27
|
+
model= self.model,
|
28
|
+
messages=[
|
29
|
+
{'role': 'system', 'content': f'{self._prompt}'},
|
30
|
+
{'role': 'user', 'content': text}],
|
31
|
+
temperature = temperature,
|
32
|
+
top_p = top_p
|
33
|
+
)
|
34
|
+
reply = completion.choices[0].message.content
|
35
|
+
return reply
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: xp3_tool
|
3
|
+
Version: 1.0
|
4
|
+
Summary: xp_t3_tool
|
5
|
+
Home-page:
|
6
|
+
Author: XuPeng
|
7
|
+
Author-email: xupeng23456@126.com
|
8
|
+
License: MIT
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
13
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
15
|
+
Requires-Python: >=3.10.0
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
Requires-Dist: openai
|
18
|
+
Requires-Dist: pandas
|
19
|
+
|
20
|
+
|
21
|
+
本模块提供了一个简单的 CallAi 类,用于与 OpenAI 兼容的 API 服务进行交互,支持设置提示词并发送对话请求。同时包含一个随机字符串生成工具函数,可用于生成指定长度的字母数字混合字符串。
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
xp3_tool
|