huaweicloudsdkversatile 3.1.184__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.
- huaweicloudsdkversatile/__init__.py +0 -0
- huaweicloudsdkversatile/v1/__init__.py +32 -0
- huaweicloudsdkversatile/v1/model/__init__.py +29 -0
- huaweicloudsdkversatile/v1/model/agent_run_req.py +302 -0
- huaweicloudsdkversatile/v1/model/conversation.py +129 -0
- huaweicloudsdkversatile/v1/model/feedback_reason.py +136 -0
- huaweicloudsdkversatile/v1/model/knowledge_base_retrieval_req.py +251 -0
- huaweicloudsdkversatile/v1/model/message.py +506 -0
- huaweicloudsdkversatile/v1/model/node_message.py +282 -0
- huaweicloudsdkversatile/v1/model/node_run_info.py +709 -0
- huaweicloudsdkversatile/v1/model/node_run_info_inner_error.py +133 -0
- huaweicloudsdkversatile/v1/model/node_run_info_inner_error_error_body.py +137 -0
- huaweicloudsdkversatile/v1/model/plugin_config.py +137 -0
- huaweicloudsdkversatile/v1/model/retrieval_result_info.py +282 -0
- huaweicloudsdkversatile/v1/model/run_agent_request.py +276 -0
- huaweicloudsdkversatile/v1/model/run_agent_response.py +378 -0
- huaweicloudsdkversatile/v1/model/run_workflow_request.py +247 -0
- huaweicloudsdkversatile/v1/model/run_workflow_response.py +378 -0
- huaweicloudsdkversatile/v1/model/search_knowledge_base_request.py +104 -0
- huaweicloudsdkversatile/v1/model/search_knowledge_base_response.py +141 -0
- huaweicloudsdkversatile/v1/model/status.py +135 -0
- huaweicloudsdkversatile/v1/model/upload_agent_file_request.py +190 -0
- huaweicloudsdkversatile/v1/model/upload_agent_file_request_body.py +107 -0
- huaweicloudsdkversatile/v1/model/upload_agent_file_response.py +170 -0
- huaweicloudsdkversatile/v1/model/user_profile.py +137 -0
- huaweicloudsdkversatile/v1/model/workflow_run_req.py +344 -0
- huaweicloudsdkversatile/v1/model/workflow_run_stream_rsp.py +195 -0
- huaweicloudsdkversatile/v1/region/__init__.py +0 -0
- huaweicloudsdkversatile/v1/region/versatile_region.py +31 -0
- huaweicloudsdkversatile/v1/versatile_async_client.py +378 -0
- huaweicloudsdkversatile/v1/versatile_client.py +375 -0
- huaweicloudsdkversatile-3.1.184.dist-info/METADATA +25 -0
- huaweicloudsdkversatile-3.1.184.dist-info/RECORD +35 -0
- huaweicloudsdkversatile-3.1.184.dist-info/WHEEL +4 -0
- huaweicloudsdkversatile-3.1.184.dist-info/licenses/LICENSE +13 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class KnowledgeBaseRetrievalReq:
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Attributes:
|
|
10
|
+
openapi_types (dict): The key is attribute name
|
|
11
|
+
and the value is attribute type.
|
|
12
|
+
attribute_map (dict): The key is attribute name
|
|
13
|
+
and the value is json key in definition.
|
|
14
|
+
"""
|
|
15
|
+
sensitive_list = []
|
|
16
|
+
|
|
17
|
+
openapi_types = {
|
|
18
|
+
'knowledge_base_ids': 'list[str]',
|
|
19
|
+
'query': 'str',
|
|
20
|
+
'search_mode': 'str',
|
|
21
|
+
'top_k': 'int',
|
|
22
|
+
'similarity_threshold': 'float',
|
|
23
|
+
'image_mask_policy': 'str'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
attribute_map = {
|
|
27
|
+
'knowledge_base_ids': 'knowledge_base_ids',
|
|
28
|
+
'query': 'query',
|
|
29
|
+
'search_mode': 'search_mode',
|
|
30
|
+
'top_k': 'top_k',
|
|
31
|
+
'similarity_threshold': 'similarity_threshold',
|
|
32
|
+
'image_mask_policy': 'image_mask_policy'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def __init__(self, knowledge_base_ids=None, query=None, search_mode=None, top_k=None, similarity_threshold=None, image_mask_policy=None):
|
|
36
|
+
r"""KnowledgeBaseRetrievalReq
|
|
37
|
+
|
|
38
|
+
The model defined in huaweicloud sdk
|
|
39
|
+
|
|
40
|
+
:param knowledge_base_ids: **参数解释**: 知识库ID列表。 **约束限制**: 最多可同时检索3个知识库。 **取值范围**: 不涉及。 **默认取值**: 不涉及。
|
|
41
|
+
:type knowledge_base_ids: list[str]
|
|
42
|
+
:param query: **参数解释**: 用户输入的问题或关键词。 **约束限制**: 不涉及。 **取值范围**: 长度 1 至 4096 字符。 **默认取值**: 不涉及。
|
|
43
|
+
:type query: str
|
|
44
|
+
:param search_mode: **参数解释**: 检索策略模式。 **约束限制**: 不涉及。 **取值范围**: - doc:语义检索。 - keyword:关键词检索。 - mix:混合检索。 - faq:FAQ检索。 **默认取值**: doc。
|
|
45
|
+
:type search_mode: str
|
|
46
|
+
:param top_k: **参数解释**: 每个知识库最多返回的检索结果数量。 **约束限制**: 若传入小数,系统会默认截断小数部分。 **取值范围**: 1 至 100(含)。 **默认取值**: 10。
|
|
47
|
+
:type top_k: int
|
|
48
|
+
:param similarity_threshold: **参数解释**: 检索结果的最低相关度得分,低于此值的片段将被过滤。 **约束限制**: 不涉及。 **取值范围**: [0.0, 1.0],包含两端。 **默认取值**: 0.5。
|
|
49
|
+
:type similarity_threshold: float
|
|
50
|
+
:param image_mask_policy: **参数解释**: 知识检索结果切片中,对图片标签进行处理和保留的具体方式。 **约束限制**: 该功能要求被检索的知识库本身支持返回图片信息。 **取值范围**: - RETAIN_IMAGE_ID:保留图片ID,格式:{KI|imageId}。 - RETAIN_PLACEHOLDER:保留占位符,格式:{KI|N},N为序号。 - REMOVE_IMAGE:移除图片(即替换为空字符串)。 **默认取值**: REMOVE_IMAGE。
|
|
51
|
+
:type image_mask_policy: str
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
self._knowledge_base_ids = None
|
|
57
|
+
self._query = None
|
|
58
|
+
self._search_mode = None
|
|
59
|
+
self._top_k = None
|
|
60
|
+
self._similarity_threshold = None
|
|
61
|
+
self._image_mask_policy = None
|
|
62
|
+
self.discriminator = None
|
|
63
|
+
|
|
64
|
+
self.knowledge_base_ids = knowledge_base_ids
|
|
65
|
+
self.query = query
|
|
66
|
+
if search_mode is not None:
|
|
67
|
+
self.search_mode = search_mode
|
|
68
|
+
if top_k is not None:
|
|
69
|
+
self.top_k = top_k
|
|
70
|
+
if similarity_threshold is not None:
|
|
71
|
+
self.similarity_threshold = similarity_threshold
|
|
72
|
+
if image_mask_policy is not None:
|
|
73
|
+
self.image_mask_policy = image_mask_policy
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def knowledge_base_ids(self):
|
|
77
|
+
r"""Gets the knowledge_base_ids of this KnowledgeBaseRetrievalReq.
|
|
78
|
+
|
|
79
|
+
**参数解释**: 知识库ID列表。 **约束限制**: 最多可同时检索3个知识库。 **取值范围**: 不涉及。 **默认取值**: 不涉及。
|
|
80
|
+
|
|
81
|
+
:return: The knowledge_base_ids of this KnowledgeBaseRetrievalReq.
|
|
82
|
+
:rtype: list[str]
|
|
83
|
+
"""
|
|
84
|
+
return self._knowledge_base_ids
|
|
85
|
+
|
|
86
|
+
@knowledge_base_ids.setter
|
|
87
|
+
def knowledge_base_ids(self, knowledge_base_ids):
|
|
88
|
+
r"""Sets the knowledge_base_ids of this KnowledgeBaseRetrievalReq.
|
|
89
|
+
|
|
90
|
+
**参数解释**: 知识库ID列表。 **约束限制**: 最多可同时检索3个知识库。 **取值范围**: 不涉及。 **默认取值**: 不涉及。
|
|
91
|
+
|
|
92
|
+
:param knowledge_base_ids: The knowledge_base_ids of this KnowledgeBaseRetrievalReq.
|
|
93
|
+
:type knowledge_base_ids: list[str]
|
|
94
|
+
"""
|
|
95
|
+
self._knowledge_base_ids = knowledge_base_ids
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def query(self):
|
|
99
|
+
r"""Gets the query of this KnowledgeBaseRetrievalReq.
|
|
100
|
+
|
|
101
|
+
**参数解释**: 用户输入的问题或关键词。 **约束限制**: 不涉及。 **取值范围**: 长度 1 至 4096 字符。 **默认取值**: 不涉及。
|
|
102
|
+
|
|
103
|
+
:return: The query of this KnowledgeBaseRetrievalReq.
|
|
104
|
+
:rtype: str
|
|
105
|
+
"""
|
|
106
|
+
return self._query
|
|
107
|
+
|
|
108
|
+
@query.setter
|
|
109
|
+
def query(self, query):
|
|
110
|
+
r"""Sets the query of this KnowledgeBaseRetrievalReq.
|
|
111
|
+
|
|
112
|
+
**参数解释**: 用户输入的问题或关键词。 **约束限制**: 不涉及。 **取值范围**: 长度 1 至 4096 字符。 **默认取值**: 不涉及。
|
|
113
|
+
|
|
114
|
+
:param query: The query of this KnowledgeBaseRetrievalReq.
|
|
115
|
+
:type query: str
|
|
116
|
+
"""
|
|
117
|
+
self._query = query
|
|
118
|
+
|
|
119
|
+
@property
|
|
120
|
+
def search_mode(self):
|
|
121
|
+
r"""Gets the search_mode of this KnowledgeBaseRetrievalReq.
|
|
122
|
+
|
|
123
|
+
**参数解释**: 检索策略模式。 **约束限制**: 不涉及。 **取值范围**: - doc:语义检索。 - keyword:关键词检索。 - mix:混合检索。 - faq:FAQ检索。 **默认取值**: doc。
|
|
124
|
+
|
|
125
|
+
:return: The search_mode of this KnowledgeBaseRetrievalReq.
|
|
126
|
+
:rtype: str
|
|
127
|
+
"""
|
|
128
|
+
return self._search_mode
|
|
129
|
+
|
|
130
|
+
@search_mode.setter
|
|
131
|
+
def search_mode(self, search_mode):
|
|
132
|
+
r"""Sets the search_mode of this KnowledgeBaseRetrievalReq.
|
|
133
|
+
|
|
134
|
+
**参数解释**: 检索策略模式。 **约束限制**: 不涉及。 **取值范围**: - doc:语义检索。 - keyword:关键词检索。 - mix:混合检索。 - faq:FAQ检索。 **默认取值**: doc。
|
|
135
|
+
|
|
136
|
+
:param search_mode: The search_mode of this KnowledgeBaseRetrievalReq.
|
|
137
|
+
:type search_mode: str
|
|
138
|
+
"""
|
|
139
|
+
self._search_mode = search_mode
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def top_k(self):
|
|
143
|
+
r"""Gets the top_k of this KnowledgeBaseRetrievalReq.
|
|
144
|
+
|
|
145
|
+
**参数解释**: 每个知识库最多返回的检索结果数量。 **约束限制**: 若传入小数,系统会默认截断小数部分。 **取值范围**: 1 至 100(含)。 **默认取值**: 10。
|
|
146
|
+
|
|
147
|
+
:return: The top_k of this KnowledgeBaseRetrievalReq.
|
|
148
|
+
:rtype: int
|
|
149
|
+
"""
|
|
150
|
+
return self._top_k
|
|
151
|
+
|
|
152
|
+
@top_k.setter
|
|
153
|
+
def top_k(self, top_k):
|
|
154
|
+
r"""Sets the top_k of this KnowledgeBaseRetrievalReq.
|
|
155
|
+
|
|
156
|
+
**参数解释**: 每个知识库最多返回的检索结果数量。 **约束限制**: 若传入小数,系统会默认截断小数部分。 **取值范围**: 1 至 100(含)。 **默认取值**: 10。
|
|
157
|
+
|
|
158
|
+
:param top_k: The top_k of this KnowledgeBaseRetrievalReq.
|
|
159
|
+
:type top_k: int
|
|
160
|
+
"""
|
|
161
|
+
self._top_k = top_k
|
|
162
|
+
|
|
163
|
+
@property
|
|
164
|
+
def similarity_threshold(self):
|
|
165
|
+
r"""Gets the similarity_threshold of this KnowledgeBaseRetrievalReq.
|
|
166
|
+
|
|
167
|
+
**参数解释**: 检索结果的最低相关度得分,低于此值的片段将被过滤。 **约束限制**: 不涉及。 **取值范围**: [0.0, 1.0],包含两端。 **默认取值**: 0.5。
|
|
168
|
+
|
|
169
|
+
:return: The similarity_threshold of this KnowledgeBaseRetrievalReq.
|
|
170
|
+
:rtype: float
|
|
171
|
+
"""
|
|
172
|
+
return self._similarity_threshold
|
|
173
|
+
|
|
174
|
+
@similarity_threshold.setter
|
|
175
|
+
def similarity_threshold(self, similarity_threshold):
|
|
176
|
+
r"""Sets the similarity_threshold of this KnowledgeBaseRetrievalReq.
|
|
177
|
+
|
|
178
|
+
**参数解释**: 检索结果的最低相关度得分,低于此值的片段将被过滤。 **约束限制**: 不涉及。 **取值范围**: [0.0, 1.0],包含两端。 **默认取值**: 0.5。
|
|
179
|
+
|
|
180
|
+
:param similarity_threshold: The similarity_threshold of this KnowledgeBaseRetrievalReq.
|
|
181
|
+
:type similarity_threshold: float
|
|
182
|
+
"""
|
|
183
|
+
self._similarity_threshold = similarity_threshold
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def image_mask_policy(self):
|
|
187
|
+
r"""Gets the image_mask_policy of this KnowledgeBaseRetrievalReq.
|
|
188
|
+
|
|
189
|
+
**参数解释**: 知识检索结果切片中,对图片标签进行处理和保留的具体方式。 **约束限制**: 该功能要求被检索的知识库本身支持返回图片信息。 **取值范围**: - RETAIN_IMAGE_ID:保留图片ID,格式:{KI|imageId}。 - RETAIN_PLACEHOLDER:保留占位符,格式:{KI|N},N为序号。 - REMOVE_IMAGE:移除图片(即替换为空字符串)。 **默认取值**: REMOVE_IMAGE。
|
|
190
|
+
|
|
191
|
+
:return: The image_mask_policy of this KnowledgeBaseRetrievalReq.
|
|
192
|
+
:rtype: str
|
|
193
|
+
"""
|
|
194
|
+
return self._image_mask_policy
|
|
195
|
+
|
|
196
|
+
@image_mask_policy.setter
|
|
197
|
+
def image_mask_policy(self, image_mask_policy):
|
|
198
|
+
r"""Sets the image_mask_policy of this KnowledgeBaseRetrievalReq.
|
|
199
|
+
|
|
200
|
+
**参数解释**: 知识检索结果切片中,对图片标签进行处理和保留的具体方式。 **约束限制**: 该功能要求被检索的知识库本身支持返回图片信息。 **取值范围**: - RETAIN_IMAGE_ID:保留图片ID,格式:{KI|imageId}。 - RETAIN_PLACEHOLDER:保留占位符,格式:{KI|N},N为序号。 - REMOVE_IMAGE:移除图片(即替换为空字符串)。 **默认取值**: REMOVE_IMAGE。
|
|
201
|
+
|
|
202
|
+
:param image_mask_policy: The image_mask_policy of this KnowledgeBaseRetrievalReq.
|
|
203
|
+
:type image_mask_policy: str
|
|
204
|
+
"""
|
|
205
|
+
self._image_mask_policy = image_mask_policy
|
|
206
|
+
|
|
207
|
+
def to_dict(self):
|
|
208
|
+
result = {}
|
|
209
|
+
|
|
210
|
+
for attr, _ in self.openapi_types.items():
|
|
211
|
+
value = getattr(self, attr)
|
|
212
|
+
if isinstance(value, list):
|
|
213
|
+
result[attr] = list(map(
|
|
214
|
+
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
|
215
|
+
value
|
|
216
|
+
))
|
|
217
|
+
elif hasattr(value, "to_dict"):
|
|
218
|
+
result[attr] = value.to_dict()
|
|
219
|
+
elif isinstance(value, dict):
|
|
220
|
+
result[attr] = dict(map(
|
|
221
|
+
lambda item: (item[0], item[1].to_dict())
|
|
222
|
+
if hasattr(item[1], "to_dict") else item,
|
|
223
|
+
value.items()
|
|
224
|
+
))
|
|
225
|
+
else:
|
|
226
|
+
if attr in self.sensitive_list:
|
|
227
|
+
result[attr] = "****"
|
|
228
|
+
else:
|
|
229
|
+
result[attr] = value
|
|
230
|
+
|
|
231
|
+
return result
|
|
232
|
+
|
|
233
|
+
def to_str(self):
|
|
234
|
+
"""Returns the string representation of the model"""
|
|
235
|
+
import simplejson as json
|
|
236
|
+
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
|
|
237
|
+
|
|
238
|
+
def __repr__(self):
|
|
239
|
+
"""For `print`"""
|
|
240
|
+
return self.to_str()
|
|
241
|
+
|
|
242
|
+
def __eq__(self, other):
|
|
243
|
+
"""Returns true if both objects are equal"""
|
|
244
|
+
if not isinstance(other, KnowledgeBaseRetrievalReq):
|
|
245
|
+
return False
|
|
246
|
+
|
|
247
|
+
return self.__dict__ == other.__dict__
|
|
248
|
+
|
|
249
|
+
def __ne__(self, other):
|
|
250
|
+
"""Returns true if both objects are not equal"""
|
|
251
|
+
return not self == other
|