universal-function-zsd 1.8.2__tar.gz → 1.8.3__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.
- {universal_function_zsd-1.8.2/src/universal_function_zsd.egg-info → universal_function_zsd-1.8.3}/PKG-INFO +1 -1
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/pyproject.toml +1 -1
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd/universal_function.py +14 -3
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3/src/universal_function_zsd.egg-info}/PKG-INFO +1 -1
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/LICENSE +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/MANIFEST.in +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/README.md +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/setup.cfg +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd/__init__.py +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd/universal_parameter.py +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd.egg-info/SOURCES.txt +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd.egg-info/dependency_links.txt +0 -0
- {universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd.egg-info/top_level.txt +0 -0
|
@@ -20,6 +20,7 @@ import sys
|
|
|
20
20
|
from openpyxl import load_workbook
|
|
21
21
|
import xlwings as xw
|
|
22
22
|
from openai import OpenAI
|
|
23
|
+
from loguru import logger
|
|
23
24
|
|
|
24
25
|
# 通用参数
|
|
25
26
|
#########################################################################
|
|
@@ -841,9 +842,14 @@ def get_llm_response(
|
|
|
841
842
|
timeout: int = 3000):
|
|
842
843
|
llm_client = OpenAI(api_key=api_key, base_url=base_url, timeout=timeout)
|
|
843
844
|
messages_input = []
|
|
845
|
+
print(f'-'*50)
|
|
846
|
+
print(f'*** 大模型【{llm_model}】解析中...')
|
|
844
847
|
if sys_prompt:
|
|
848
|
+
print(f'*** SYSTEM输入 ***\n{sys_prompt[:1000]}......')
|
|
845
849
|
messages_input.append({"role": "system", "content": sys_prompt})
|
|
846
850
|
messages_input.append({"role": "user", "content": base_prompt})
|
|
851
|
+
print(f'*** USER输入 ***\n{base_prompt[:1000]}......')
|
|
852
|
+
print(f'-'*50)
|
|
847
853
|
if extra_body is None:
|
|
848
854
|
extra_body = {}
|
|
849
855
|
for attempt_idx in range(retry_times + 1):
|
|
@@ -858,17 +864,22 @@ def get_llm_response(
|
|
|
858
864
|
extra_body=extra_body
|
|
859
865
|
)
|
|
860
866
|
if not if_stream:
|
|
867
|
+
print(f'*** 输出结果 ***')
|
|
868
|
+
print(response.choices[0].message.content)
|
|
869
|
+
print(f'-' * 50)
|
|
861
870
|
return response.choices[0].message.content
|
|
862
871
|
else:
|
|
863
872
|
return response # 流式输出需要做特殊处理(增量片段解析)
|
|
864
873
|
except Exception as e:
|
|
865
|
-
print('调用失败,重新尝试...')
|
|
866
874
|
if attempt_idx < retry_times:
|
|
875
|
+
print(f'调用失败,开始第【{attempt_idx}】次尝试...')
|
|
867
876
|
time.sleep(1)
|
|
868
877
|
continue
|
|
869
878
|
else:
|
|
870
|
-
|
|
871
|
-
|
|
879
|
+
print(f'调用失败,尝试次数达上限,返回None...')
|
|
880
|
+
return None
|
|
881
|
+
print(f'调用失败,返回None...')
|
|
882
|
+
return None
|
|
872
883
|
|
|
873
884
|
def extract_dict(text):
|
|
874
885
|
code_block_pattern = re.compile(r"```(?:json)?\s*\n?([\s\S]*?)\n?```")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{universal_function_zsd-1.8.2 → universal_function_zsd-1.8.3}/src/universal_function_zsd/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|