isa-model 0.2.8__py3-none-any.whl → 0.2.9__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.
- isa_model/inference/services/llm/openai_llm_service.py +22 -4
- {isa_model-0.2.8.dist-info → isa_model-0.2.9.dist-info}/METADATA +1 -1
- {isa_model-0.2.8.dist-info → isa_model-0.2.9.dist-info}/RECORD +5 -5
- {isa_model-0.2.8.dist-info → isa_model-0.2.9.dist-info}/WHEEL +0 -0
- {isa_model-0.2.8.dist-info → isa_model-0.2.9.dist-info}/top_level.txt +0 -0
@@ -70,12 +70,16 @@ class OpenAILLMService(BaseLLMService):
|
|
70
70
|
if isinstance(prompt, str):
|
71
71
|
return await self.acompletion(prompt)
|
72
72
|
elif isinstance(prompt, list):
|
73
|
+
if not prompt:
|
74
|
+
raise ValueError("Empty message list provided")
|
75
|
+
|
73
76
|
# 检查是否是 LangGraph 消息对象
|
74
|
-
|
77
|
+
first_msg = prompt[0]
|
78
|
+
if hasattr(first_msg, 'content') and hasattr(first_msg, 'type'):
|
75
79
|
# 转换 LangGraph 消息对象为标准格式
|
76
80
|
converted_messages = []
|
77
81
|
for msg in prompt:
|
78
|
-
if hasattr(msg, 'type'):
|
82
|
+
if hasattr(msg, 'type') and hasattr(msg, 'content'):
|
79
83
|
# LangGraph 消息对象
|
80
84
|
msg_dict = {"content": msg.content}
|
81
85
|
|
@@ -106,14 +110,28 @@ class OpenAILLMService(BaseLLMService):
|
|
106
110
|
msg_dict["role"] = "user" # 默认为用户消息
|
107
111
|
|
108
112
|
converted_messages.append(msg_dict)
|
109
|
-
|
113
|
+
elif isinstance(msg, dict):
|
110
114
|
# 已经是字典格式
|
111
115
|
converted_messages.append(msg)
|
116
|
+
else:
|
117
|
+
# 处理其他类型(如字符串)
|
118
|
+
converted_messages.append({"role": "user", "content": str(msg)})
|
112
119
|
|
113
120
|
return await self.achat(converted_messages)
|
114
|
-
|
121
|
+
elif isinstance(first_msg, dict):
|
115
122
|
# 标准字典格式的消息
|
116
123
|
return await self.achat(prompt)
|
124
|
+
else:
|
125
|
+
# 处理其他格式,如字符串列表
|
126
|
+
converted_messages = []
|
127
|
+
for msg in prompt:
|
128
|
+
if isinstance(msg, str):
|
129
|
+
converted_messages.append({"role": "user", "content": msg})
|
130
|
+
elif isinstance(msg, dict):
|
131
|
+
converted_messages.append(msg)
|
132
|
+
else:
|
133
|
+
converted_messages.append({"role": "user", "content": str(msg)})
|
134
|
+
return await self.achat(converted_messages)
|
117
135
|
else:
|
118
136
|
raise ValueError("Prompt must be a string or a list of messages")
|
119
137
|
|
@@ -40,7 +40,7 @@ isa_model/inference/services/embedding/openai_embed_service.py,sha256=47DEQpj8HB
|
|
40
40
|
isa_model/inference/services/llm/__init__.py,sha256=C6t9w33j3Ap4oGcJal9-htifKe0rxwws_kC3F-_B_Ps,341
|
41
41
|
isa_model/inference/services/llm/base_llm_service.py,sha256=hf4egO9_s3rOQYwyhDS6O_8ECIAltkj4Ir89PTosraE,8381
|
42
42
|
isa_model/inference/services/llm/ollama_llm_service.py,sha256=EfLdoovyrChYBlGreQukpSZt5l6DkfXwjjmPPovmm70,12934
|
43
|
-
isa_model/inference/services/llm/openai_llm_service.py,sha256=
|
43
|
+
isa_model/inference/services/llm/openai_llm_service.py,sha256=k2sETG7qaMfYMR_THP_dh_wQS3zvXu4zJp27kc09-K4,15168
|
44
44
|
isa_model/inference/services/llm/triton_llm_service.py,sha256=ZFo7JoZ799Nvyi8Cz1jfWOa6TUn0hDRJtBrotadMAd4,17673
|
45
45
|
isa_model/inference/services/ml/base_ml_service.py,sha256=mLBA6ENowa3KVzNqHyhWxf_Pr-cJJj84lDE4TniPzYI,2894
|
46
46
|
isa_model/inference/services/ml/sklearn_ml_service.py,sha256=Lf9JrwvI25lca7JBbjB_e66eAUtXFbwxZ3Hs13dVGkA,5512
|
@@ -80,7 +80,7 @@ isa_model/training/core/config.py,sha256=oqgKpBvtzrN6jwLIQYQ2707lH6nmjrktRiSxp9i
|
|
80
80
|
isa_model/training/core/dataset.py,sha256=XCFsnf0NUMU1dJpdvo_CAMyvXB-9_RCUEiy8TU50e20,7802
|
81
81
|
isa_model/training/core/trainer.py,sha256=h5TjqjdFr0Fsv5y4-0siy1KmOlqLfliVaUXybvuoeXU,26932
|
82
82
|
isa_model/training/core/utils.py,sha256=Nik0M2ssfNbWqP6fKO0Kfyhzr_H6Q19ioxB-qCYbn5E,8387
|
83
|
-
isa_model-0.2.
|
84
|
-
isa_model-0.2.
|
85
|
-
isa_model-0.2.
|
86
|
-
isa_model-0.2.
|
83
|
+
isa_model-0.2.9.dist-info/METADATA,sha256=3Ba9NXgqR5OFKe-XCx3plV4TbevfFuyoj6Rspxc-ibA,12226
|
84
|
+
isa_model-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
85
|
+
isa_model-0.2.9.dist-info/top_level.txt,sha256=eHSy_Xb3kNkh2kK11mi1mZh0Wz91AQ5b8k2KFYO-rE8,10
|
86
|
+
isa_model-0.2.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|