hjxdl 0.1.23__py3-none-any.whl → 0.1.24__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.
- hdl/_version.py +2 -2
- hdl/utils/llm/chat.py +11 -16
- hdl/utils/weather/weather.py +41 -0
- {hjxdl-0.1.23.dist-info → hjxdl-0.1.24.dist-info}/METADATA +1 -1
- {hjxdl-0.1.23.dist-info → hjxdl-0.1.24.dist-info}/RECORD +7 -7
- {hjxdl-0.1.23.dist-info → hjxdl-0.1.24.dist-info}/WHEEL +0 -0
- {hjxdl-0.1.23.dist-info → hjxdl-0.1.24.dist-info}/top_level.txt +0 -0
hdl/_version.py
CHANGED
hdl/utils/llm/chat.py
CHANGED
@@ -332,25 +332,20 @@ class OpenAI_M():
|
|
332
332
|
*args,
|
333
333
|
**kwargs
|
334
334
|
):
|
335
|
-
"""Initialize the OpenAI client.
|
335
|
+
"""Initialize the OpenAI client with the specified parameters.
|
336
336
|
|
337
337
|
Args:
|
338
|
-
model_path (str): Path to the model
|
339
|
-
device (str): Device to use
|
340
|
-
generation_kwargs (dict): Additional
|
341
|
-
server_ip (str): IP address of the server
|
342
|
-
server_port (int): Port
|
343
|
-
api_key (str): API key for authentication
|
344
|
-
|
345
|
-
|
338
|
+
model_path (str): Path to the model (default is "default_model").
|
339
|
+
device (str): Device to use (default is 'gpu').
|
340
|
+
generation_kwargs (dict): Additional generation arguments (default is an empty dictionary).
|
341
|
+
server_ip (str): IP address of the server (default is "172.28.1.2").
|
342
|
+
server_port (int): Port of the server (default is 8000).
|
343
|
+
api_key (str): API key for authentication (default is "dummy_key").
|
344
|
+
tools (list): List of tools.
|
345
|
+
tool_desc (dict): Description of tools.
|
346
346
|
|
347
|
-
|
348
|
-
|
349
|
-
server_ip (str): IP address of the server.
|
350
|
-
server_port (int): Port number of the server.
|
351
|
-
base_url (str): Base URL for API requests.
|
352
|
-
api_key (str): API key for authentication.
|
353
|
-
client (OpenAI): OpenAI client for making API requests.
|
347
|
+
Raises:
|
348
|
+
ValueError: If an invalid argument is provided.
|
354
349
|
"""
|
355
350
|
# self.model_path = model_path
|
356
351
|
self.server_ip = server_ip
|
hdl/utils/weather/weather.py
CHANGED
@@ -10,6 +10,11 @@ from ..llm.embs import HFEmbedder
|
|
10
10
|
|
11
11
|
|
12
12
|
def get_city_codes():
|
13
|
+
"""Get city codes from a JSON file.
|
14
|
+
|
15
|
+
Returns:
|
16
|
+
dict: A dictionary containing city codes.
|
17
|
+
"""
|
13
18
|
# with open('../../city.json', 'r', encoding='utf-8') as f:
|
14
19
|
# code_dic = eval(f.read())
|
15
20
|
# return code_dic
|
@@ -22,6 +27,17 @@ def get_city_codes():
|
|
22
27
|
|
23
28
|
|
24
29
|
def get_html(code):
|
30
|
+
"""Get the HTML content of a weather webpage based on the provided code.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
code (str): The code used to identify the specific weather webpage.
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
str: The HTML content of the weather webpage.
|
37
|
+
|
38
|
+
Example:
|
39
|
+
html_content = get_html('101010100')
|
40
|
+
"""
|
25
41
|
weather_url = f'http://www.weather.com.cn/weather/{code}.shtml'
|
26
42
|
header = {
|
27
43
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"}
|
@@ -32,6 +48,14 @@ def get_html(code):
|
|
32
48
|
|
33
49
|
|
34
50
|
def get_page_data(html):
|
51
|
+
"""Get weather information for the next seven days from the provided HTML content.
|
52
|
+
|
53
|
+
Args:
|
54
|
+
html (str): The HTML content containing weather information.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
str: A formatted string with weather information for the next seven days.
|
58
|
+
"""
|
35
59
|
soup = BeautifulSoup(html, 'html.parser')
|
36
60
|
weather_info = soup.find('div', id='7d')
|
37
61
|
seven_weather = weather_info.find('ul')
|
@@ -62,6 +86,14 @@ def get_page_data(html):
|
|
62
86
|
|
63
87
|
|
64
88
|
def get_weather(city):
|
89
|
+
"""Get the weather information for a specific city.
|
90
|
+
|
91
|
+
Args:
|
92
|
+
city (str): The name of the city to get weather information for.
|
93
|
+
|
94
|
+
Returns:
|
95
|
+
str: A string containing the latest weather information for the specified city.
|
96
|
+
"""
|
65
97
|
code_dic = get_city_codes()
|
66
98
|
city_name = city
|
67
99
|
weather_str = ""
|
@@ -82,6 +114,15 @@ def get_standard_cityname(
|
|
82
114
|
'/home/jhu/dev/models/bge-m3'
|
83
115
|
)
|
84
116
|
):
|
117
|
+
"""Get the standard city name based on the input city name.
|
118
|
+
|
119
|
+
Args:
|
120
|
+
city (str): The input city name.
|
121
|
+
emb_dir (str): The directory path for the embedding model (default is '/home/jhu/dev/models/bge-m3').
|
122
|
+
|
123
|
+
Returns:
|
124
|
+
str: The standard city name.
|
125
|
+
"""
|
85
126
|
code_dic = get_city_codes()
|
86
127
|
city_list = list(code_dic.keys())
|
87
128
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
hdl/__init__.py,sha256=GffnD0jLJdhkd-vo989v40N90sQbofkayRBwxc6TVhQ,72
|
2
|
-
hdl/_version.py,sha256=
|
2
|
+
hdl/_version.py,sha256=T0ojuTgCP2YXC3kbv5ugN5jbqbVjf70YDxvdeIV5kTs,413
|
3
3
|
hdl/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hdl/args/loss_args.py,sha256=s7YzSdd7IjD24rZvvOrxLLFqMZQb9YylxKeyelSdrTk,70
|
5
5
|
hdl/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -125,14 +125,14 @@ hdl/utils/desc/template.py,sha256=uKPGIgYFgSY4uBvfsbh5fZN7s39NdGQ2XSVH3pIpsuc,10
|
|
125
125
|
hdl/utils/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
126
126
|
hdl/utils/general/glob.py,sha256=8-RCnt6L297wMIfn34ZAMCsGCZUjHG3MGglGZI1cX0g,491
|
127
127
|
hdl/utils/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
128
|
-
hdl/utils/llm/chat.py,sha256=
|
128
|
+
hdl/utils/llm/chat.py,sha256=V5c-QPL7-bmJjVQHhjr1AtMoAK3EfxF1A2octVGr_uQ,16577
|
129
129
|
hdl/utils/llm/embs.py,sha256=Tf0FOYrOFZp7qQpEPiSCXzlgyHH0X9HVTUtsup74a9E,7174
|
130
130
|
hdl/utils/llm/extract.py,sha256=2sK_WJzmYIc8iuWaM9DA6Nw3_6q1O4lJ5pKpcZo-bBA,6512
|
131
131
|
hdl/utils/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
132
132
|
hdl/utils/schedulers/norm_lr.py,sha256=bDwCmdEK-WkgxQMFBiMuchv8Mm7C0-GZJ6usm-PQk14,4461
|
133
133
|
hdl/utils/weather/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
|
-
hdl/utils/weather/weather.py,sha256=
|
135
|
-
hjxdl-0.1.
|
136
|
-
hjxdl-0.1.
|
137
|
-
hjxdl-0.1.
|
138
|
-
hjxdl-0.1.
|
134
|
+
hdl/utils/weather/weather.py,sha256=k11o6wM15kF8b9NMlEfrg68ak-SfSYLN3nOOflFUv-I,4381
|
135
|
+
hjxdl-0.1.24.dist-info/METADATA,sha256=7FJ185Z_q90u3aAWiFnlx2nsp-Tbwo3txo4LAU9jYXI,627
|
136
|
+
hjxdl-0.1.24.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
137
|
+
hjxdl-0.1.24.dist-info/top_level.txt,sha256=-kxwTM5JPhylp06z3zAVO3w6_h7wtBfBo2zgM6YZoTk,4
|
138
|
+
hjxdl-0.1.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|