smallestai 2.2.0__py3-none-any.whl → 3.0.1__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.

Potentially problematic release.


This version of smallestai might be problematic. Click here for more details.

Files changed (90) hide show
  1. smallestai/__init__.py +95 -0
  2. smallestai/atoms/__init__.py +182 -0
  3. smallestai/atoms/api/__init__.py +12 -0
  4. smallestai/atoms/api/agent_templates_api.py +573 -0
  5. smallestai/atoms/api/agents_api.py +1465 -0
  6. smallestai/atoms/api/calls_api.py +320 -0
  7. smallestai/atoms/api/campaigns_api.py +1689 -0
  8. smallestai/atoms/api/knowledge_base_api.py +2271 -0
  9. smallestai/atoms/api/logs_api.py +305 -0
  10. smallestai/atoms/api/organization_api.py +285 -0
  11. smallestai/atoms/api/user_api.py +285 -0
  12. smallestai/atoms/api_client.py +797 -0
  13. smallestai/atoms/api_response.py +21 -0
  14. smallestai/atoms/atoms_client.py +560 -0
  15. smallestai/atoms/configuration.py +582 -0
  16. smallestai/atoms/exceptions.py +216 -0
  17. smallestai/atoms/models/__init__.py +72 -0
  18. smallestai/atoms/models/agent_dto.py +130 -0
  19. smallestai/atoms/models/agent_dto_language.py +91 -0
  20. smallestai/atoms/models/agent_dto_synthesizer.py +99 -0
  21. smallestai/atoms/models/agent_dto_synthesizer_voice_config.py +111 -0
  22. smallestai/atoms/models/api_response.py +89 -0
  23. smallestai/atoms/models/bad_request_error_response.py +89 -0
  24. smallestai/atoms/models/create_agent_from_template200_response.py +89 -0
  25. smallestai/atoms/models/create_agent_from_template_request.py +91 -0
  26. smallestai/atoms/models/create_agent_request.py +113 -0
  27. smallestai/atoms/models/create_agent_request_language.py +124 -0
  28. smallestai/atoms/models/create_agent_request_language_synthesizer.py +110 -0
  29. smallestai/atoms/models/create_agent_request_language_synthesizer_voice_config.py +137 -0
  30. smallestai/atoms/models/create_campaign201_response.py +93 -0
  31. smallestai/atoms/models/create_campaign201_response_data.py +104 -0
  32. smallestai/atoms/models/create_campaign_request.py +93 -0
  33. smallestai/atoms/models/create_knowledge_base201_response.py +89 -0
  34. smallestai/atoms/models/create_knowledge_base_request.py +89 -0
  35. smallestai/atoms/models/delete_agent200_response.py +87 -0
  36. smallestai/atoms/models/get_agent_by_id200_response.py +93 -0
  37. smallestai/atoms/models/get_agent_templates200_response.py +97 -0
  38. smallestai/atoms/models/get_agent_templates200_response_data_inner.py +97 -0
  39. smallestai/atoms/models/get_agents200_response.py +93 -0
  40. smallestai/atoms/models/get_agents200_response_data.py +101 -0
  41. smallestai/atoms/models/get_campaign_by_id200_response.py +93 -0
  42. smallestai/atoms/models/get_campaign_by_id200_response_data.py +110 -0
  43. smallestai/atoms/models/get_campaigns200_response.py +97 -0
  44. smallestai/atoms/models/get_campaigns200_response_data_inner.py +118 -0
  45. smallestai/atoms/models/get_campaigns200_response_data_inner_agent.py +89 -0
  46. smallestai/atoms/models/get_campaigns200_response_data_inner_audience.py +89 -0
  47. smallestai/atoms/models/get_campaigns_request.py +89 -0
  48. smallestai/atoms/models/get_conversation_logs200_response.py +93 -0
  49. smallestai/atoms/models/get_conversation_logs200_response_data.py +125 -0
  50. smallestai/atoms/models/get_current_user200_response.py +93 -0
  51. smallestai/atoms/models/get_current_user200_response_data.py +99 -0
  52. smallestai/atoms/models/get_knowledge_base_by_id200_response.py +93 -0
  53. smallestai/atoms/models/get_knowledge_base_items200_response.py +97 -0
  54. smallestai/atoms/models/get_knowledge_bases200_response.py +97 -0
  55. smallestai/atoms/models/get_organization200_response.py +93 -0
  56. smallestai/atoms/models/get_organization200_response_data.py +105 -0
  57. smallestai/atoms/models/get_organization200_response_data_members_inner.py +89 -0
  58. smallestai/atoms/models/get_organization200_response_data_subscription.py +87 -0
  59. smallestai/atoms/models/internal_server_error_response.py +89 -0
  60. smallestai/atoms/models/knowledge_base_dto.py +93 -0
  61. smallestai/atoms/models/knowledge_base_item_dto.py +124 -0
  62. smallestai/atoms/models/start_outbound_call200_response.py +93 -0
  63. smallestai/atoms/models/start_outbound_call200_response_data.py +87 -0
  64. smallestai/atoms/models/start_outbound_call_request.py +89 -0
  65. smallestai/atoms/models/unauthorized_error_reponse.py +89 -0
  66. smallestai/atoms/models/update_agent200_response.py +89 -0
  67. smallestai/atoms/models/update_agent_request.py +119 -0
  68. smallestai/atoms/models/update_agent_request_language.py +99 -0
  69. smallestai/atoms/models/update_agent_request_synthesizer.py +110 -0
  70. smallestai/atoms/models/update_agent_request_synthesizer_voice_config.py +137 -0
  71. smallestai/atoms/models/update_agent_request_synthesizer_voice_config_one_of.py +111 -0
  72. smallestai/atoms/models/update_agent_request_synthesizer_voice_config_one_of1.py +99 -0
  73. smallestai/atoms/models/upload_text_to_knowledge_base_request.py +89 -0
  74. smallestai/atoms/py.typed +0 -0
  75. smallestai/atoms/rest.py +258 -0
  76. smallestai/waves/__init__.py +5 -0
  77. smallest/async_tts.py → smallestai/waves/async_waves_client.py +3 -3
  78. {smallest → smallestai/waves}/stream_tts.py +6 -6
  79. {smallest → smallestai/waves}/utils.py +2 -2
  80. smallest/tts.py → smallestai/waves/waves_client.py +3 -3
  81. {smallestai-2.2.0.dist-info → smallestai-3.0.1.dist-info}/METADATA +182 -43
  82. smallestai-3.0.1.dist-info/RECORD +87 -0
  83. {smallestai-2.2.0.dist-info → smallestai-3.0.1.dist-info}/WHEEL +1 -1
  84. smallestai-3.0.1.dist-info/top_level.txt +1 -0
  85. smallest/__init__.py +0 -5
  86. smallestai-2.2.0.dist-info/RECORD +0 -12
  87. smallestai-2.2.0.dist-info/top_level.txt +0 -1
  88. {smallest → smallestai/waves}/exceptions.py +0 -0
  89. {smallest → smallestai/waves}/models.py +0 -0
  90. {smallestai-2.2.0.dist-info → smallestai-3.0.1.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,2271 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Agent Management API
5
+
6
+ API for managing agents, their templates, and call logs
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictBytes, StrictStr
20
+ from typing import Tuple, Union
21
+ from typing_extensions import Annotated
22
+ from smallestai.atoms.models.create_knowledge_base201_response import CreateKnowledgeBase201Response
23
+ from smallestai.atoms.models.create_knowledge_base_request import CreateKnowledgeBaseRequest
24
+ from smallestai.atoms.models.delete_agent200_response import DeleteAgent200Response
25
+ from smallestai.atoms.models.get_knowledge_base_by_id200_response import GetKnowledgeBaseById200Response
26
+ from smallestai.atoms.models.get_knowledge_base_items200_response import GetKnowledgeBaseItems200Response
27
+ from smallestai.atoms.models.get_knowledge_bases200_response import GetKnowledgeBases200Response
28
+ from smallestai.atoms.models.upload_text_to_knowledge_base_request import UploadTextToKnowledgeBaseRequest
29
+
30
+ from smallestai.atoms.api_client import ApiClient, RequestSerialized
31
+ from smallestai.atoms.api_response import ApiResponse
32
+ from smallestai.atoms.rest import RESTResponseType
33
+
34
+
35
+ class KnowledgeBaseApi:
36
+ """NOTE: This class is auto generated by OpenAPI Generator
37
+ Ref: https://openapi-generator.tech
38
+
39
+ Do not edit the class manually.
40
+ """
41
+
42
+ def __init__(self, api_client=None) -> None:
43
+ if api_client is None:
44
+ api_client = ApiClient.get_default()
45
+ self.api_client = api_client
46
+
47
+
48
+ @validate_call
49
+ def create_knowledge_base(
50
+ self,
51
+ create_knowledge_base_request: CreateKnowledgeBaseRequest,
52
+ _request_timeout: Union[
53
+ None,
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Tuple[
56
+ Annotated[StrictFloat, Field(gt=0)],
57
+ Annotated[StrictFloat, Field(gt=0)]
58
+ ]
59
+ ] = None,
60
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
61
+ _content_type: Optional[StrictStr] = None,
62
+ _headers: Optional[Dict[StrictStr, Any]] = None,
63
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
64
+ ) -> CreateKnowledgeBase201Response:
65
+ """Create a knowledge base
66
+
67
+ Create a knowledge base
68
+
69
+ :param create_knowledge_base_request: (required)
70
+ :type create_knowledge_base_request: CreateKnowledgeBaseRequest
71
+ :param _request_timeout: timeout setting for this request. If one
72
+ number provided, it will be total request
73
+ timeout. It can also be a pair (tuple) of
74
+ (connection, read) timeouts.
75
+ :type _request_timeout: int, tuple(int, int), optional
76
+ :param _request_auth: set to override the auth_settings for an a single
77
+ request; this effectively ignores the
78
+ authentication in the spec for a single request.
79
+ :type _request_auth: dict, optional
80
+ :param _content_type: force content-type for the request.
81
+ :type _content_type: str, Optional
82
+ :param _headers: set to override the headers for a single
83
+ request; this effectively ignores the headers
84
+ in the spec for a single request.
85
+ :type _headers: dict, optional
86
+ :param _host_index: set to override the host_index for a single
87
+ request; this effectively ignores the host_index
88
+ in the spec for a single request.
89
+ :type _host_index: int, optional
90
+ :return: Returns the result object.
91
+ """ # noqa: E501
92
+
93
+ _param = self._create_knowledge_base_serialize(
94
+ create_knowledge_base_request=create_knowledge_base_request,
95
+ _request_auth=_request_auth,
96
+ _content_type=_content_type,
97
+ _headers=_headers,
98
+ _host_index=_host_index
99
+ )
100
+
101
+ _response_types_map: Dict[str, Optional[str]] = {
102
+ '201': "CreateKnowledgeBase201Response",
103
+ '400': "BadRequestErrorResponse",
104
+ '401': "UnauthorizedErrorReponse",
105
+ '500': "InternalServerErrorResponse",
106
+ }
107
+ response_data = self.api_client.call_api(
108
+ *_param,
109
+ _request_timeout=_request_timeout
110
+ )
111
+ response_data.read()
112
+ return self.api_client.response_deserialize(
113
+ response_data=response_data,
114
+ response_types_map=_response_types_map,
115
+ ).data
116
+
117
+
118
+ @validate_call
119
+ def create_knowledge_base_with_http_info(
120
+ self,
121
+ create_knowledge_base_request: CreateKnowledgeBaseRequest,
122
+ _request_timeout: Union[
123
+ None,
124
+ Annotated[StrictFloat, Field(gt=0)],
125
+ Tuple[
126
+ Annotated[StrictFloat, Field(gt=0)],
127
+ Annotated[StrictFloat, Field(gt=0)]
128
+ ]
129
+ ] = None,
130
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
131
+ _content_type: Optional[StrictStr] = None,
132
+ _headers: Optional[Dict[StrictStr, Any]] = None,
133
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
134
+ ) -> ApiResponse[CreateKnowledgeBase201Response]:
135
+ """Create a knowledge base
136
+
137
+ Create a knowledge base
138
+
139
+ :param create_knowledge_base_request: (required)
140
+ :type create_knowledge_base_request: CreateKnowledgeBaseRequest
141
+ :param _request_timeout: timeout setting for this request. If one
142
+ number provided, it will be total request
143
+ timeout. It can also be a pair (tuple) of
144
+ (connection, read) timeouts.
145
+ :type _request_timeout: int, tuple(int, int), optional
146
+ :param _request_auth: set to override the auth_settings for an a single
147
+ request; this effectively ignores the
148
+ authentication in the spec for a single request.
149
+ :type _request_auth: dict, optional
150
+ :param _content_type: force content-type for the request.
151
+ :type _content_type: str, Optional
152
+ :param _headers: set to override the headers for a single
153
+ request; this effectively ignores the headers
154
+ in the spec for a single request.
155
+ :type _headers: dict, optional
156
+ :param _host_index: set to override the host_index for a single
157
+ request; this effectively ignores the host_index
158
+ in the spec for a single request.
159
+ :type _host_index: int, optional
160
+ :return: Returns the result object.
161
+ """ # noqa: E501
162
+
163
+ _param = self._create_knowledge_base_serialize(
164
+ create_knowledge_base_request=create_knowledge_base_request,
165
+ _request_auth=_request_auth,
166
+ _content_type=_content_type,
167
+ _headers=_headers,
168
+ _host_index=_host_index
169
+ )
170
+
171
+ _response_types_map: Dict[str, Optional[str]] = {
172
+ '201': "CreateKnowledgeBase201Response",
173
+ '400': "BadRequestErrorResponse",
174
+ '401': "UnauthorizedErrorReponse",
175
+ '500': "InternalServerErrorResponse",
176
+ }
177
+ response_data = self.api_client.call_api(
178
+ *_param,
179
+ _request_timeout=_request_timeout
180
+ )
181
+ response_data.read()
182
+ return self.api_client.response_deserialize(
183
+ response_data=response_data,
184
+ response_types_map=_response_types_map,
185
+ )
186
+
187
+
188
+ @validate_call
189
+ def create_knowledge_base_without_preload_content(
190
+ self,
191
+ create_knowledge_base_request: CreateKnowledgeBaseRequest,
192
+ _request_timeout: Union[
193
+ None,
194
+ Annotated[StrictFloat, Field(gt=0)],
195
+ Tuple[
196
+ Annotated[StrictFloat, Field(gt=0)],
197
+ Annotated[StrictFloat, Field(gt=0)]
198
+ ]
199
+ ] = None,
200
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
201
+ _content_type: Optional[StrictStr] = None,
202
+ _headers: Optional[Dict[StrictStr, Any]] = None,
203
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
204
+ ) -> RESTResponseType:
205
+ """Create a knowledge base
206
+
207
+ Create a knowledge base
208
+
209
+ :param create_knowledge_base_request: (required)
210
+ :type create_knowledge_base_request: CreateKnowledgeBaseRequest
211
+ :param _request_timeout: timeout setting for this request. If one
212
+ number provided, it will be total request
213
+ timeout. It can also be a pair (tuple) of
214
+ (connection, read) timeouts.
215
+ :type _request_timeout: int, tuple(int, int), optional
216
+ :param _request_auth: set to override the auth_settings for an a single
217
+ request; this effectively ignores the
218
+ authentication in the spec for a single request.
219
+ :type _request_auth: dict, optional
220
+ :param _content_type: force content-type for the request.
221
+ :type _content_type: str, Optional
222
+ :param _headers: set to override the headers for a single
223
+ request; this effectively ignores the headers
224
+ in the spec for a single request.
225
+ :type _headers: dict, optional
226
+ :param _host_index: set to override the host_index for a single
227
+ request; this effectively ignores the host_index
228
+ in the spec for a single request.
229
+ :type _host_index: int, optional
230
+ :return: Returns the result object.
231
+ """ # noqa: E501
232
+
233
+ _param = self._create_knowledge_base_serialize(
234
+ create_knowledge_base_request=create_knowledge_base_request,
235
+ _request_auth=_request_auth,
236
+ _content_type=_content_type,
237
+ _headers=_headers,
238
+ _host_index=_host_index
239
+ )
240
+
241
+ _response_types_map: Dict[str, Optional[str]] = {
242
+ '201': "CreateKnowledgeBase201Response",
243
+ '400': "BadRequestErrorResponse",
244
+ '401': "UnauthorizedErrorReponse",
245
+ '500': "InternalServerErrorResponse",
246
+ }
247
+ response_data = self.api_client.call_api(
248
+ *_param,
249
+ _request_timeout=_request_timeout
250
+ )
251
+ return response_data.response
252
+
253
+
254
+ def _create_knowledge_base_serialize(
255
+ self,
256
+ create_knowledge_base_request,
257
+ _request_auth,
258
+ _content_type,
259
+ _headers,
260
+ _host_index,
261
+ ) -> RequestSerialized:
262
+
263
+ _host = None
264
+
265
+ _collection_formats: Dict[str, str] = {
266
+ }
267
+
268
+ _path_params: Dict[str, str] = {}
269
+ _query_params: List[Tuple[str, str]] = []
270
+ _header_params: Dict[str, Optional[str]] = _headers or {}
271
+ _form_params: List[Tuple[str, str]] = []
272
+ _files: Dict[
273
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
274
+ ] = {}
275
+ _body_params: Optional[bytes] = None
276
+
277
+ # process the path parameters
278
+ # process the query parameters
279
+ # process the header parameters
280
+ # process the form parameters
281
+ # process the body parameter
282
+ if create_knowledge_base_request is not None:
283
+ _body_params = create_knowledge_base_request
284
+
285
+
286
+ # set the HTTP header `Accept`
287
+ if 'Accept' not in _header_params:
288
+ _header_params['Accept'] = self.api_client.select_header_accept(
289
+ [
290
+ 'application/json'
291
+ ]
292
+ )
293
+
294
+ # set the HTTP header `Content-Type`
295
+ if _content_type:
296
+ _header_params['Content-Type'] = _content_type
297
+ else:
298
+ _default_content_type = (
299
+ self.api_client.select_header_content_type(
300
+ [
301
+ 'application/json'
302
+ ]
303
+ )
304
+ )
305
+ if _default_content_type is not None:
306
+ _header_params['Content-Type'] = _default_content_type
307
+
308
+ # authentication setting
309
+ _auth_settings: List[str] = [
310
+ 'BearerAuth'
311
+ ]
312
+
313
+ return self.api_client.param_serialize(
314
+ method='POST',
315
+ resource_path='/knowledgebase',
316
+ path_params=_path_params,
317
+ query_params=_query_params,
318
+ header_params=_header_params,
319
+ body=_body_params,
320
+ post_params=_form_params,
321
+ files=_files,
322
+ auth_settings=_auth_settings,
323
+ collection_formats=_collection_formats,
324
+ _host=_host,
325
+ _request_auth=_request_auth
326
+ )
327
+
328
+
329
+
330
+
331
+ @validate_call
332
+ def delete_knowledge_base(
333
+ self,
334
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
335
+ _request_timeout: Union[
336
+ None,
337
+ Annotated[StrictFloat, Field(gt=0)],
338
+ Tuple[
339
+ Annotated[StrictFloat, Field(gt=0)],
340
+ Annotated[StrictFloat, Field(gt=0)]
341
+ ]
342
+ ] = None,
343
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
344
+ _content_type: Optional[StrictStr] = None,
345
+ _headers: Optional[Dict[StrictStr, Any]] = None,
346
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
347
+ ) -> DeleteAgent200Response:
348
+ """Delete a knowledge base
349
+
350
+ Delete a knowledge base
351
+
352
+ :param id: The ID of the knowledge base (required)
353
+ :type id: str
354
+ :param _request_timeout: timeout setting for this request. If one
355
+ number provided, it will be total request
356
+ timeout. It can also be a pair (tuple) of
357
+ (connection, read) timeouts.
358
+ :type _request_timeout: int, tuple(int, int), optional
359
+ :param _request_auth: set to override the auth_settings for an a single
360
+ request; this effectively ignores the
361
+ authentication in the spec for a single request.
362
+ :type _request_auth: dict, optional
363
+ :param _content_type: force content-type for the request.
364
+ :type _content_type: str, Optional
365
+ :param _headers: set to override the headers for a single
366
+ request; this effectively ignores the headers
367
+ in the spec for a single request.
368
+ :type _headers: dict, optional
369
+ :param _host_index: set to override the host_index for a single
370
+ request; this effectively ignores the host_index
371
+ in the spec for a single request.
372
+ :type _host_index: int, optional
373
+ :return: Returns the result object.
374
+ """ # noqa: E501
375
+
376
+ _param = self._delete_knowledge_base_serialize(
377
+ id=id,
378
+ _request_auth=_request_auth,
379
+ _content_type=_content_type,
380
+ _headers=_headers,
381
+ _host_index=_host_index
382
+ )
383
+
384
+ _response_types_map: Dict[str, Optional[str]] = {
385
+ '200': "DeleteAgent200Response",
386
+ '400': "BadRequestErrorResponse",
387
+ '401': "UnauthorizedErrorReponse",
388
+ '500': "InternalServerErrorResponse",
389
+ }
390
+ response_data = self.api_client.call_api(
391
+ *_param,
392
+ _request_timeout=_request_timeout
393
+ )
394
+ response_data.read()
395
+ return self.api_client.response_deserialize(
396
+ response_data=response_data,
397
+ response_types_map=_response_types_map,
398
+ ).data
399
+
400
+
401
+ @validate_call
402
+ def delete_knowledge_base_with_http_info(
403
+ self,
404
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
405
+ _request_timeout: Union[
406
+ None,
407
+ Annotated[StrictFloat, Field(gt=0)],
408
+ Tuple[
409
+ Annotated[StrictFloat, Field(gt=0)],
410
+ Annotated[StrictFloat, Field(gt=0)]
411
+ ]
412
+ ] = None,
413
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
414
+ _content_type: Optional[StrictStr] = None,
415
+ _headers: Optional[Dict[StrictStr, Any]] = None,
416
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
417
+ ) -> ApiResponse[DeleteAgent200Response]:
418
+ """Delete a knowledge base
419
+
420
+ Delete a knowledge base
421
+
422
+ :param id: The ID of the knowledge base (required)
423
+ :type id: str
424
+ :param _request_timeout: timeout setting for this request. If one
425
+ number provided, it will be total request
426
+ timeout. It can also be a pair (tuple) of
427
+ (connection, read) timeouts.
428
+ :type _request_timeout: int, tuple(int, int), optional
429
+ :param _request_auth: set to override the auth_settings for an a single
430
+ request; this effectively ignores the
431
+ authentication in the spec for a single request.
432
+ :type _request_auth: dict, optional
433
+ :param _content_type: force content-type for the request.
434
+ :type _content_type: str, Optional
435
+ :param _headers: set to override the headers for a single
436
+ request; this effectively ignores the headers
437
+ in the spec for a single request.
438
+ :type _headers: dict, optional
439
+ :param _host_index: set to override the host_index for a single
440
+ request; this effectively ignores the host_index
441
+ in the spec for a single request.
442
+ :type _host_index: int, optional
443
+ :return: Returns the result object.
444
+ """ # noqa: E501
445
+
446
+ _param = self._delete_knowledge_base_serialize(
447
+ id=id,
448
+ _request_auth=_request_auth,
449
+ _content_type=_content_type,
450
+ _headers=_headers,
451
+ _host_index=_host_index
452
+ )
453
+
454
+ _response_types_map: Dict[str, Optional[str]] = {
455
+ '200': "DeleteAgent200Response",
456
+ '400': "BadRequestErrorResponse",
457
+ '401': "UnauthorizedErrorReponse",
458
+ '500': "InternalServerErrorResponse",
459
+ }
460
+ response_data = self.api_client.call_api(
461
+ *_param,
462
+ _request_timeout=_request_timeout
463
+ )
464
+ response_data.read()
465
+ return self.api_client.response_deserialize(
466
+ response_data=response_data,
467
+ response_types_map=_response_types_map,
468
+ )
469
+
470
+
471
+ @validate_call
472
+ def delete_knowledge_base_without_preload_content(
473
+ self,
474
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
475
+ _request_timeout: Union[
476
+ None,
477
+ Annotated[StrictFloat, Field(gt=0)],
478
+ Tuple[
479
+ Annotated[StrictFloat, Field(gt=0)],
480
+ Annotated[StrictFloat, Field(gt=0)]
481
+ ]
482
+ ] = None,
483
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
484
+ _content_type: Optional[StrictStr] = None,
485
+ _headers: Optional[Dict[StrictStr, Any]] = None,
486
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
487
+ ) -> RESTResponseType:
488
+ """Delete a knowledge base
489
+
490
+ Delete a knowledge base
491
+
492
+ :param id: The ID of the knowledge base (required)
493
+ :type id: str
494
+ :param _request_timeout: timeout setting for this request. If one
495
+ number provided, it will be total request
496
+ timeout. It can also be a pair (tuple) of
497
+ (connection, read) timeouts.
498
+ :type _request_timeout: int, tuple(int, int), optional
499
+ :param _request_auth: set to override the auth_settings for an a single
500
+ request; this effectively ignores the
501
+ authentication in the spec for a single request.
502
+ :type _request_auth: dict, optional
503
+ :param _content_type: force content-type for the request.
504
+ :type _content_type: str, Optional
505
+ :param _headers: set to override the headers for a single
506
+ request; this effectively ignores the headers
507
+ in the spec for a single request.
508
+ :type _headers: dict, optional
509
+ :param _host_index: set to override the host_index for a single
510
+ request; this effectively ignores the host_index
511
+ in the spec for a single request.
512
+ :type _host_index: int, optional
513
+ :return: Returns the result object.
514
+ """ # noqa: E501
515
+
516
+ _param = self._delete_knowledge_base_serialize(
517
+ id=id,
518
+ _request_auth=_request_auth,
519
+ _content_type=_content_type,
520
+ _headers=_headers,
521
+ _host_index=_host_index
522
+ )
523
+
524
+ _response_types_map: Dict[str, Optional[str]] = {
525
+ '200': "DeleteAgent200Response",
526
+ '400': "BadRequestErrorResponse",
527
+ '401': "UnauthorizedErrorReponse",
528
+ '500': "InternalServerErrorResponse",
529
+ }
530
+ response_data = self.api_client.call_api(
531
+ *_param,
532
+ _request_timeout=_request_timeout
533
+ )
534
+ return response_data.response
535
+
536
+
537
+ def _delete_knowledge_base_serialize(
538
+ self,
539
+ id,
540
+ _request_auth,
541
+ _content_type,
542
+ _headers,
543
+ _host_index,
544
+ ) -> RequestSerialized:
545
+
546
+ _host = None
547
+
548
+ _collection_formats: Dict[str, str] = {
549
+ }
550
+
551
+ _path_params: Dict[str, str] = {}
552
+ _query_params: List[Tuple[str, str]] = []
553
+ _header_params: Dict[str, Optional[str]] = _headers or {}
554
+ _form_params: List[Tuple[str, str]] = []
555
+ _files: Dict[
556
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
557
+ ] = {}
558
+ _body_params: Optional[bytes] = None
559
+
560
+ # process the path parameters
561
+ if id is not None:
562
+ _path_params['id'] = id
563
+ # process the query parameters
564
+ # process the header parameters
565
+ # process the form parameters
566
+ # process the body parameter
567
+
568
+
569
+ # set the HTTP header `Accept`
570
+ if 'Accept' not in _header_params:
571
+ _header_params['Accept'] = self.api_client.select_header_accept(
572
+ [
573
+ 'application/json'
574
+ ]
575
+ )
576
+
577
+
578
+ # authentication setting
579
+ _auth_settings: List[str] = [
580
+ 'BearerAuth'
581
+ ]
582
+
583
+ return self.api_client.param_serialize(
584
+ method='DELETE',
585
+ resource_path='/knowledgebase/{id}',
586
+ path_params=_path_params,
587
+ query_params=_query_params,
588
+ header_params=_header_params,
589
+ body=_body_params,
590
+ post_params=_form_params,
591
+ files=_files,
592
+ auth_settings=_auth_settings,
593
+ collection_formats=_collection_formats,
594
+ _host=_host,
595
+ _request_auth=_request_auth
596
+ )
597
+
598
+
599
+
600
+
601
+ @validate_call
602
+ def delete_knowledge_base_item(
603
+ self,
604
+ knowledge_base_id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
605
+ knowledge_base_item_id: Annotated[StrictStr, Field(description="The ID of the knowledge base item")],
606
+ _request_timeout: Union[
607
+ None,
608
+ Annotated[StrictFloat, Field(gt=0)],
609
+ Tuple[
610
+ Annotated[StrictFloat, Field(gt=0)],
611
+ Annotated[StrictFloat, Field(gt=0)]
612
+ ]
613
+ ] = None,
614
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
615
+ _content_type: Optional[StrictStr] = None,
616
+ _headers: Optional[Dict[StrictStr, Any]] = None,
617
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
618
+ ) -> DeleteAgent200Response:
619
+ """Delete a knowledge base item
620
+
621
+ Delete a knowledge base item
622
+
623
+ :param knowledge_base_id: The ID of the knowledge base (required)
624
+ :type knowledge_base_id: str
625
+ :param knowledge_base_item_id: The ID of the knowledge base item (required)
626
+ :type knowledge_base_item_id: str
627
+ :param _request_timeout: timeout setting for this request. If one
628
+ number provided, it will be total request
629
+ timeout. It can also be a pair (tuple) of
630
+ (connection, read) timeouts.
631
+ :type _request_timeout: int, tuple(int, int), optional
632
+ :param _request_auth: set to override the auth_settings for an a single
633
+ request; this effectively ignores the
634
+ authentication in the spec for a single request.
635
+ :type _request_auth: dict, optional
636
+ :param _content_type: force content-type for the request.
637
+ :type _content_type: str, Optional
638
+ :param _headers: set to override the headers for a single
639
+ request; this effectively ignores the headers
640
+ in the spec for a single request.
641
+ :type _headers: dict, optional
642
+ :param _host_index: set to override the host_index for a single
643
+ request; this effectively ignores the host_index
644
+ in the spec for a single request.
645
+ :type _host_index: int, optional
646
+ :return: Returns the result object.
647
+ """ # noqa: E501
648
+
649
+ _param = self._delete_knowledge_base_item_serialize(
650
+ knowledge_base_id=knowledge_base_id,
651
+ knowledge_base_item_id=knowledge_base_item_id,
652
+ _request_auth=_request_auth,
653
+ _content_type=_content_type,
654
+ _headers=_headers,
655
+ _host_index=_host_index
656
+ )
657
+
658
+ _response_types_map: Dict[str, Optional[str]] = {
659
+ '200': "DeleteAgent200Response",
660
+ '400': "BadRequestErrorResponse",
661
+ '401': "UnauthorizedErrorReponse",
662
+ '500': "InternalServerErrorResponse",
663
+ }
664
+ response_data = self.api_client.call_api(
665
+ *_param,
666
+ _request_timeout=_request_timeout
667
+ )
668
+ response_data.read()
669
+ return self.api_client.response_deserialize(
670
+ response_data=response_data,
671
+ response_types_map=_response_types_map,
672
+ ).data
673
+
674
+
675
+ @validate_call
676
+ def delete_knowledge_base_item_with_http_info(
677
+ self,
678
+ knowledge_base_id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
679
+ knowledge_base_item_id: Annotated[StrictStr, Field(description="The ID of the knowledge base item")],
680
+ _request_timeout: Union[
681
+ None,
682
+ Annotated[StrictFloat, Field(gt=0)],
683
+ Tuple[
684
+ Annotated[StrictFloat, Field(gt=0)],
685
+ Annotated[StrictFloat, Field(gt=0)]
686
+ ]
687
+ ] = None,
688
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
689
+ _content_type: Optional[StrictStr] = None,
690
+ _headers: Optional[Dict[StrictStr, Any]] = None,
691
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
692
+ ) -> ApiResponse[DeleteAgent200Response]:
693
+ """Delete a knowledge base item
694
+
695
+ Delete a knowledge base item
696
+
697
+ :param knowledge_base_id: The ID of the knowledge base (required)
698
+ :type knowledge_base_id: str
699
+ :param knowledge_base_item_id: The ID of the knowledge base item (required)
700
+ :type knowledge_base_item_id: str
701
+ :param _request_timeout: timeout setting for this request. If one
702
+ number provided, it will be total request
703
+ timeout. It can also be a pair (tuple) of
704
+ (connection, read) timeouts.
705
+ :type _request_timeout: int, tuple(int, int), optional
706
+ :param _request_auth: set to override the auth_settings for an a single
707
+ request; this effectively ignores the
708
+ authentication in the spec for a single request.
709
+ :type _request_auth: dict, optional
710
+ :param _content_type: force content-type for the request.
711
+ :type _content_type: str, Optional
712
+ :param _headers: set to override the headers for a single
713
+ request; this effectively ignores the headers
714
+ in the spec for a single request.
715
+ :type _headers: dict, optional
716
+ :param _host_index: set to override the host_index for a single
717
+ request; this effectively ignores the host_index
718
+ in the spec for a single request.
719
+ :type _host_index: int, optional
720
+ :return: Returns the result object.
721
+ """ # noqa: E501
722
+
723
+ _param = self._delete_knowledge_base_item_serialize(
724
+ knowledge_base_id=knowledge_base_id,
725
+ knowledge_base_item_id=knowledge_base_item_id,
726
+ _request_auth=_request_auth,
727
+ _content_type=_content_type,
728
+ _headers=_headers,
729
+ _host_index=_host_index
730
+ )
731
+
732
+ _response_types_map: Dict[str, Optional[str]] = {
733
+ '200': "DeleteAgent200Response",
734
+ '400': "BadRequestErrorResponse",
735
+ '401': "UnauthorizedErrorReponse",
736
+ '500': "InternalServerErrorResponse",
737
+ }
738
+ response_data = self.api_client.call_api(
739
+ *_param,
740
+ _request_timeout=_request_timeout
741
+ )
742
+ response_data.read()
743
+ return self.api_client.response_deserialize(
744
+ response_data=response_data,
745
+ response_types_map=_response_types_map,
746
+ )
747
+
748
+
749
+ @validate_call
750
+ def delete_knowledge_base_item_without_preload_content(
751
+ self,
752
+ knowledge_base_id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
753
+ knowledge_base_item_id: Annotated[StrictStr, Field(description="The ID of the knowledge base item")],
754
+ _request_timeout: Union[
755
+ None,
756
+ Annotated[StrictFloat, Field(gt=0)],
757
+ Tuple[
758
+ Annotated[StrictFloat, Field(gt=0)],
759
+ Annotated[StrictFloat, Field(gt=0)]
760
+ ]
761
+ ] = None,
762
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
763
+ _content_type: Optional[StrictStr] = None,
764
+ _headers: Optional[Dict[StrictStr, Any]] = None,
765
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
766
+ ) -> RESTResponseType:
767
+ """Delete a knowledge base item
768
+
769
+ Delete a knowledge base item
770
+
771
+ :param knowledge_base_id: The ID of the knowledge base (required)
772
+ :type knowledge_base_id: str
773
+ :param knowledge_base_item_id: The ID of the knowledge base item (required)
774
+ :type knowledge_base_item_id: str
775
+ :param _request_timeout: timeout setting for this request. If one
776
+ number provided, it will be total request
777
+ timeout. It can also be a pair (tuple) of
778
+ (connection, read) timeouts.
779
+ :type _request_timeout: int, tuple(int, int), optional
780
+ :param _request_auth: set to override the auth_settings for an a single
781
+ request; this effectively ignores the
782
+ authentication in the spec for a single request.
783
+ :type _request_auth: dict, optional
784
+ :param _content_type: force content-type for the request.
785
+ :type _content_type: str, Optional
786
+ :param _headers: set to override the headers for a single
787
+ request; this effectively ignores the headers
788
+ in the spec for a single request.
789
+ :type _headers: dict, optional
790
+ :param _host_index: set to override the host_index for a single
791
+ request; this effectively ignores the host_index
792
+ in the spec for a single request.
793
+ :type _host_index: int, optional
794
+ :return: Returns the result object.
795
+ """ # noqa: E501
796
+
797
+ _param = self._delete_knowledge_base_item_serialize(
798
+ knowledge_base_id=knowledge_base_id,
799
+ knowledge_base_item_id=knowledge_base_item_id,
800
+ _request_auth=_request_auth,
801
+ _content_type=_content_type,
802
+ _headers=_headers,
803
+ _host_index=_host_index
804
+ )
805
+
806
+ _response_types_map: Dict[str, Optional[str]] = {
807
+ '200': "DeleteAgent200Response",
808
+ '400': "BadRequestErrorResponse",
809
+ '401': "UnauthorizedErrorReponse",
810
+ '500': "InternalServerErrorResponse",
811
+ }
812
+ response_data = self.api_client.call_api(
813
+ *_param,
814
+ _request_timeout=_request_timeout
815
+ )
816
+ return response_data.response
817
+
818
+
819
+ def _delete_knowledge_base_item_serialize(
820
+ self,
821
+ knowledge_base_id,
822
+ knowledge_base_item_id,
823
+ _request_auth,
824
+ _content_type,
825
+ _headers,
826
+ _host_index,
827
+ ) -> RequestSerialized:
828
+
829
+ _host = None
830
+
831
+ _collection_formats: Dict[str, str] = {
832
+ }
833
+
834
+ _path_params: Dict[str, str] = {}
835
+ _query_params: List[Tuple[str, str]] = []
836
+ _header_params: Dict[str, Optional[str]] = _headers or {}
837
+ _form_params: List[Tuple[str, str]] = []
838
+ _files: Dict[
839
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
840
+ ] = {}
841
+ _body_params: Optional[bytes] = None
842
+
843
+ # process the path parameters
844
+ if knowledge_base_id is not None:
845
+ _path_params['knowledgeBaseId'] = knowledge_base_id
846
+ if knowledge_base_item_id is not None:
847
+ _path_params['knowledgeBaseItemId'] = knowledge_base_item_id
848
+ # process the query parameters
849
+ # process the header parameters
850
+ # process the form parameters
851
+ # process the body parameter
852
+
853
+
854
+ # set the HTTP header `Accept`
855
+ if 'Accept' not in _header_params:
856
+ _header_params['Accept'] = self.api_client.select_header_accept(
857
+ [
858
+ 'application/json'
859
+ ]
860
+ )
861
+
862
+
863
+ # authentication setting
864
+ _auth_settings: List[str] = [
865
+ 'BearerAuth'
866
+ ]
867
+
868
+ return self.api_client.param_serialize(
869
+ method='DELETE',
870
+ resource_path='/knowledgebase/{knowledgeBaseId}/items/{knowledgeBaseItemId}',
871
+ path_params=_path_params,
872
+ query_params=_query_params,
873
+ header_params=_header_params,
874
+ body=_body_params,
875
+ post_params=_form_params,
876
+ files=_files,
877
+ auth_settings=_auth_settings,
878
+ collection_formats=_collection_formats,
879
+ _host=_host,
880
+ _request_auth=_request_auth
881
+ )
882
+
883
+
884
+
885
+
886
+ @validate_call
887
+ def get_knowledge_base_by_id(
888
+ self,
889
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
890
+ _request_timeout: Union[
891
+ None,
892
+ Annotated[StrictFloat, Field(gt=0)],
893
+ Tuple[
894
+ Annotated[StrictFloat, Field(gt=0)],
895
+ Annotated[StrictFloat, Field(gt=0)]
896
+ ]
897
+ ] = None,
898
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
899
+ _content_type: Optional[StrictStr] = None,
900
+ _headers: Optional[Dict[StrictStr, Any]] = None,
901
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
902
+ ) -> GetKnowledgeBaseById200Response:
903
+ """Get a knowledge base
904
+
905
+ Get a knowledge base
906
+
907
+ :param id: The ID of the knowledge base (required)
908
+ :type id: str
909
+ :param _request_timeout: timeout setting for this request. If one
910
+ number provided, it will be total request
911
+ timeout. It can also be a pair (tuple) of
912
+ (connection, read) timeouts.
913
+ :type _request_timeout: int, tuple(int, int), optional
914
+ :param _request_auth: set to override the auth_settings for an a single
915
+ request; this effectively ignores the
916
+ authentication in the spec for a single request.
917
+ :type _request_auth: dict, optional
918
+ :param _content_type: force content-type for the request.
919
+ :type _content_type: str, Optional
920
+ :param _headers: set to override the headers for a single
921
+ request; this effectively ignores the headers
922
+ in the spec for a single request.
923
+ :type _headers: dict, optional
924
+ :param _host_index: set to override the host_index for a single
925
+ request; this effectively ignores the host_index
926
+ in the spec for a single request.
927
+ :type _host_index: int, optional
928
+ :return: Returns the result object.
929
+ """ # noqa: E501
930
+
931
+ _param = self._get_knowledge_base_by_id_serialize(
932
+ id=id,
933
+ _request_auth=_request_auth,
934
+ _content_type=_content_type,
935
+ _headers=_headers,
936
+ _host_index=_host_index
937
+ )
938
+
939
+ _response_types_map: Dict[str, Optional[str]] = {
940
+ '200': "GetKnowledgeBaseById200Response",
941
+ '400': "BadRequestErrorResponse",
942
+ '401': "UnauthorizedErrorReponse",
943
+ '500': "InternalServerErrorResponse",
944
+ }
945
+ response_data = self.api_client.call_api(
946
+ *_param,
947
+ _request_timeout=_request_timeout
948
+ )
949
+ response_data.read()
950
+ return self.api_client.response_deserialize(
951
+ response_data=response_data,
952
+ response_types_map=_response_types_map,
953
+ ).data
954
+
955
+
956
+ @validate_call
957
+ def get_knowledge_base_by_id_with_http_info(
958
+ self,
959
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
960
+ _request_timeout: Union[
961
+ None,
962
+ Annotated[StrictFloat, Field(gt=0)],
963
+ Tuple[
964
+ Annotated[StrictFloat, Field(gt=0)],
965
+ Annotated[StrictFloat, Field(gt=0)]
966
+ ]
967
+ ] = None,
968
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
969
+ _content_type: Optional[StrictStr] = None,
970
+ _headers: Optional[Dict[StrictStr, Any]] = None,
971
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
972
+ ) -> ApiResponse[GetKnowledgeBaseById200Response]:
973
+ """Get a knowledge base
974
+
975
+ Get a knowledge base
976
+
977
+ :param id: The ID of the knowledge base (required)
978
+ :type id: str
979
+ :param _request_timeout: timeout setting for this request. If one
980
+ number provided, it will be total request
981
+ timeout. It can also be a pair (tuple) of
982
+ (connection, read) timeouts.
983
+ :type _request_timeout: int, tuple(int, int), optional
984
+ :param _request_auth: set to override the auth_settings for an a single
985
+ request; this effectively ignores the
986
+ authentication in the spec for a single request.
987
+ :type _request_auth: dict, optional
988
+ :param _content_type: force content-type for the request.
989
+ :type _content_type: str, Optional
990
+ :param _headers: set to override the headers for a single
991
+ request; this effectively ignores the headers
992
+ in the spec for a single request.
993
+ :type _headers: dict, optional
994
+ :param _host_index: set to override the host_index for a single
995
+ request; this effectively ignores the host_index
996
+ in the spec for a single request.
997
+ :type _host_index: int, optional
998
+ :return: Returns the result object.
999
+ """ # noqa: E501
1000
+
1001
+ _param = self._get_knowledge_base_by_id_serialize(
1002
+ id=id,
1003
+ _request_auth=_request_auth,
1004
+ _content_type=_content_type,
1005
+ _headers=_headers,
1006
+ _host_index=_host_index
1007
+ )
1008
+
1009
+ _response_types_map: Dict[str, Optional[str]] = {
1010
+ '200': "GetKnowledgeBaseById200Response",
1011
+ '400': "BadRequestErrorResponse",
1012
+ '401': "UnauthorizedErrorReponse",
1013
+ '500': "InternalServerErrorResponse",
1014
+ }
1015
+ response_data = self.api_client.call_api(
1016
+ *_param,
1017
+ _request_timeout=_request_timeout
1018
+ )
1019
+ response_data.read()
1020
+ return self.api_client.response_deserialize(
1021
+ response_data=response_data,
1022
+ response_types_map=_response_types_map,
1023
+ )
1024
+
1025
+
1026
+ @validate_call
1027
+ def get_knowledge_base_by_id_without_preload_content(
1028
+ self,
1029
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1030
+ _request_timeout: Union[
1031
+ None,
1032
+ Annotated[StrictFloat, Field(gt=0)],
1033
+ Tuple[
1034
+ Annotated[StrictFloat, Field(gt=0)],
1035
+ Annotated[StrictFloat, Field(gt=0)]
1036
+ ]
1037
+ ] = None,
1038
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1039
+ _content_type: Optional[StrictStr] = None,
1040
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1041
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1042
+ ) -> RESTResponseType:
1043
+ """Get a knowledge base
1044
+
1045
+ Get a knowledge base
1046
+
1047
+ :param id: The ID of the knowledge base (required)
1048
+ :type id: str
1049
+ :param _request_timeout: timeout setting for this request. If one
1050
+ number provided, it will be total request
1051
+ timeout. It can also be a pair (tuple) of
1052
+ (connection, read) timeouts.
1053
+ :type _request_timeout: int, tuple(int, int), optional
1054
+ :param _request_auth: set to override the auth_settings for an a single
1055
+ request; this effectively ignores the
1056
+ authentication in the spec for a single request.
1057
+ :type _request_auth: dict, optional
1058
+ :param _content_type: force content-type for the request.
1059
+ :type _content_type: str, Optional
1060
+ :param _headers: set to override the headers for a single
1061
+ request; this effectively ignores the headers
1062
+ in the spec for a single request.
1063
+ :type _headers: dict, optional
1064
+ :param _host_index: set to override the host_index for a single
1065
+ request; this effectively ignores the host_index
1066
+ in the spec for a single request.
1067
+ :type _host_index: int, optional
1068
+ :return: Returns the result object.
1069
+ """ # noqa: E501
1070
+
1071
+ _param = self._get_knowledge_base_by_id_serialize(
1072
+ id=id,
1073
+ _request_auth=_request_auth,
1074
+ _content_type=_content_type,
1075
+ _headers=_headers,
1076
+ _host_index=_host_index
1077
+ )
1078
+
1079
+ _response_types_map: Dict[str, Optional[str]] = {
1080
+ '200': "GetKnowledgeBaseById200Response",
1081
+ '400': "BadRequestErrorResponse",
1082
+ '401': "UnauthorizedErrorReponse",
1083
+ '500': "InternalServerErrorResponse",
1084
+ }
1085
+ response_data = self.api_client.call_api(
1086
+ *_param,
1087
+ _request_timeout=_request_timeout
1088
+ )
1089
+ return response_data.response
1090
+
1091
+
1092
+ def _get_knowledge_base_by_id_serialize(
1093
+ self,
1094
+ id,
1095
+ _request_auth,
1096
+ _content_type,
1097
+ _headers,
1098
+ _host_index,
1099
+ ) -> RequestSerialized:
1100
+
1101
+ _host = None
1102
+
1103
+ _collection_formats: Dict[str, str] = {
1104
+ }
1105
+
1106
+ _path_params: Dict[str, str] = {}
1107
+ _query_params: List[Tuple[str, str]] = []
1108
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1109
+ _form_params: List[Tuple[str, str]] = []
1110
+ _files: Dict[
1111
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1112
+ ] = {}
1113
+ _body_params: Optional[bytes] = None
1114
+
1115
+ # process the path parameters
1116
+ if id is not None:
1117
+ _path_params['id'] = id
1118
+ # process the query parameters
1119
+ # process the header parameters
1120
+ # process the form parameters
1121
+ # process the body parameter
1122
+
1123
+
1124
+ # set the HTTP header `Accept`
1125
+ if 'Accept' not in _header_params:
1126
+ _header_params['Accept'] = self.api_client.select_header_accept(
1127
+ [
1128
+ 'application/json'
1129
+ ]
1130
+ )
1131
+
1132
+
1133
+ # authentication setting
1134
+ _auth_settings: List[str] = [
1135
+ 'BearerAuth'
1136
+ ]
1137
+
1138
+ return self.api_client.param_serialize(
1139
+ method='GET',
1140
+ resource_path='/knowledgebase/{id}',
1141
+ path_params=_path_params,
1142
+ query_params=_query_params,
1143
+ header_params=_header_params,
1144
+ body=_body_params,
1145
+ post_params=_form_params,
1146
+ files=_files,
1147
+ auth_settings=_auth_settings,
1148
+ collection_formats=_collection_formats,
1149
+ _host=_host,
1150
+ _request_auth=_request_auth
1151
+ )
1152
+
1153
+
1154
+
1155
+
1156
+ @validate_call
1157
+ def get_knowledge_base_items(
1158
+ self,
1159
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1160
+ _request_timeout: Union[
1161
+ None,
1162
+ Annotated[StrictFloat, Field(gt=0)],
1163
+ Tuple[
1164
+ Annotated[StrictFloat, Field(gt=0)],
1165
+ Annotated[StrictFloat, Field(gt=0)]
1166
+ ]
1167
+ ] = None,
1168
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1169
+ _content_type: Optional[StrictStr] = None,
1170
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1171
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1172
+ ) -> GetKnowledgeBaseItems200Response:
1173
+ """Get all knowledge base items
1174
+
1175
+ Get all knowledge base items
1176
+
1177
+ :param id: The ID of the knowledge base (required)
1178
+ :type id: str
1179
+ :param _request_timeout: timeout setting for this request. If one
1180
+ number provided, it will be total request
1181
+ timeout. It can also be a pair (tuple) of
1182
+ (connection, read) timeouts.
1183
+ :type _request_timeout: int, tuple(int, int), optional
1184
+ :param _request_auth: set to override the auth_settings for an a single
1185
+ request; this effectively ignores the
1186
+ authentication in the spec for a single request.
1187
+ :type _request_auth: dict, optional
1188
+ :param _content_type: force content-type for the request.
1189
+ :type _content_type: str, Optional
1190
+ :param _headers: set to override the headers for a single
1191
+ request; this effectively ignores the headers
1192
+ in the spec for a single request.
1193
+ :type _headers: dict, optional
1194
+ :param _host_index: set to override the host_index for a single
1195
+ request; this effectively ignores the host_index
1196
+ in the spec for a single request.
1197
+ :type _host_index: int, optional
1198
+ :return: Returns the result object.
1199
+ """ # noqa: E501
1200
+
1201
+ _param = self._get_knowledge_base_items_serialize(
1202
+ id=id,
1203
+ _request_auth=_request_auth,
1204
+ _content_type=_content_type,
1205
+ _headers=_headers,
1206
+ _host_index=_host_index
1207
+ )
1208
+
1209
+ _response_types_map: Dict[str, Optional[str]] = {
1210
+ '200': "GetKnowledgeBaseItems200Response",
1211
+ '400': "BadRequestErrorResponse",
1212
+ '401': "UnauthorizedErrorReponse",
1213
+ '500': "InternalServerErrorResponse",
1214
+ }
1215
+ response_data = self.api_client.call_api(
1216
+ *_param,
1217
+ _request_timeout=_request_timeout
1218
+ )
1219
+ response_data.read()
1220
+ return self.api_client.response_deserialize(
1221
+ response_data=response_data,
1222
+ response_types_map=_response_types_map,
1223
+ ).data
1224
+
1225
+
1226
+ @validate_call
1227
+ def get_knowledge_base_items_with_http_info(
1228
+ self,
1229
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1230
+ _request_timeout: Union[
1231
+ None,
1232
+ Annotated[StrictFloat, Field(gt=0)],
1233
+ Tuple[
1234
+ Annotated[StrictFloat, Field(gt=0)],
1235
+ Annotated[StrictFloat, Field(gt=0)]
1236
+ ]
1237
+ ] = None,
1238
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1239
+ _content_type: Optional[StrictStr] = None,
1240
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1241
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1242
+ ) -> ApiResponse[GetKnowledgeBaseItems200Response]:
1243
+ """Get all knowledge base items
1244
+
1245
+ Get all knowledge base items
1246
+
1247
+ :param id: The ID of the knowledge base (required)
1248
+ :type id: str
1249
+ :param _request_timeout: timeout setting for this request. If one
1250
+ number provided, it will be total request
1251
+ timeout. It can also be a pair (tuple) of
1252
+ (connection, read) timeouts.
1253
+ :type _request_timeout: int, tuple(int, int), optional
1254
+ :param _request_auth: set to override the auth_settings for an a single
1255
+ request; this effectively ignores the
1256
+ authentication in the spec for a single request.
1257
+ :type _request_auth: dict, optional
1258
+ :param _content_type: force content-type for the request.
1259
+ :type _content_type: str, Optional
1260
+ :param _headers: set to override the headers for a single
1261
+ request; this effectively ignores the headers
1262
+ in the spec for a single request.
1263
+ :type _headers: dict, optional
1264
+ :param _host_index: set to override the host_index for a single
1265
+ request; this effectively ignores the host_index
1266
+ in the spec for a single request.
1267
+ :type _host_index: int, optional
1268
+ :return: Returns the result object.
1269
+ """ # noqa: E501
1270
+
1271
+ _param = self._get_knowledge_base_items_serialize(
1272
+ id=id,
1273
+ _request_auth=_request_auth,
1274
+ _content_type=_content_type,
1275
+ _headers=_headers,
1276
+ _host_index=_host_index
1277
+ )
1278
+
1279
+ _response_types_map: Dict[str, Optional[str]] = {
1280
+ '200': "GetKnowledgeBaseItems200Response",
1281
+ '400': "BadRequestErrorResponse",
1282
+ '401': "UnauthorizedErrorReponse",
1283
+ '500': "InternalServerErrorResponse",
1284
+ }
1285
+ response_data = self.api_client.call_api(
1286
+ *_param,
1287
+ _request_timeout=_request_timeout
1288
+ )
1289
+ response_data.read()
1290
+ return self.api_client.response_deserialize(
1291
+ response_data=response_data,
1292
+ response_types_map=_response_types_map,
1293
+ )
1294
+
1295
+
1296
+ @validate_call
1297
+ def get_knowledge_base_items_without_preload_content(
1298
+ self,
1299
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1300
+ _request_timeout: Union[
1301
+ None,
1302
+ Annotated[StrictFloat, Field(gt=0)],
1303
+ Tuple[
1304
+ Annotated[StrictFloat, Field(gt=0)],
1305
+ Annotated[StrictFloat, Field(gt=0)]
1306
+ ]
1307
+ ] = None,
1308
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1309
+ _content_type: Optional[StrictStr] = None,
1310
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1311
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1312
+ ) -> RESTResponseType:
1313
+ """Get all knowledge base items
1314
+
1315
+ Get all knowledge base items
1316
+
1317
+ :param id: The ID of the knowledge base (required)
1318
+ :type id: str
1319
+ :param _request_timeout: timeout setting for this request. If one
1320
+ number provided, it will be total request
1321
+ timeout. It can also be a pair (tuple) of
1322
+ (connection, read) timeouts.
1323
+ :type _request_timeout: int, tuple(int, int), optional
1324
+ :param _request_auth: set to override the auth_settings for an a single
1325
+ request; this effectively ignores the
1326
+ authentication in the spec for a single request.
1327
+ :type _request_auth: dict, optional
1328
+ :param _content_type: force content-type for the request.
1329
+ :type _content_type: str, Optional
1330
+ :param _headers: set to override the headers for a single
1331
+ request; this effectively ignores the headers
1332
+ in the spec for a single request.
1333
+ :type _headers: dict, optional
1334
+ :param _host_index: set to override the host_index for a single
1335
+ request; this effectively ignores the host_index
1336
+ in the spec for a single request.
1337
+ :type _host_index: int, optional
1338
+ :return: Returns the result object.
1339
+ """ # noqa: E501
1340
+
1341
+ _param = self._get_knowledge_base_items_serialize(
1342
+ id=id,
1343
+ _request_auth=_request_auth,
1344
+ _content_type=_content_type,
1345
+ _headers=_headers,
1346
+ _host_index=_host_index
1347
+ )
1348
+
1349
+ _response_types_map: Dict[str, Optional[str]] = {
1350
+ '200': "GetKnowledgeBaseItems200Response",
1351
+ '400': "BadRequestErrorResponse",
1352
+ '401': "UnauthorizedErrorReponse",
1353
+ '500': "InternalServerErrorResponse",
1354
+ }
1355
+ response_data = self.api_client.call_api(
1356
+ *_param,
1357
+ _request_timeout=_request_timeout
1358
+ )
1359
+ return response_data.response
1360
+
1361
+
1362
+ def _get_knowledge_base_items_serialize(
1363
+ self,
1364
+ id,
1365
+ _request_auth,
1366
+ _content_type,
1367
+ _headers,
1368
+ _host_index,
1369
+ ) -> RequestSerialized:
1370
+
1371
+ _host = None
1372
+
1373
+ _collection_formats: Dict[str, str] = {
1374
+ }
1375
+
1376
+ _path_params: Dict[str, str] = {}
1377
+ _query_params: List[Tuple[str, str]] = []
1378
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1379
+ _form_params: List[Tuple[str, str]] = []
1380
+ _files: Dict[
1381
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1382
+ ] = {}
1383
+ _body_params: Optional[bytes] = None
1384
+
1385
+ # process the path parameters
1386
+ if id is not None:
1387
+ _path_params['id'] = id
1388
+ # process the query parameters
1389
+ # process the header parameters
1390
+ # process the form parameters
1391
+ # process the body parameter
1392
+
1393
+
1394
+ # set the HTTP header `Accept`
1395
+ if 'Accept' not in _header_params:
1396
+ _header_params['Accept'] = self.api_client.select_header_accept(
1397
+ [
1398
+ 'application/json'
1399
+ ]
1400
+ )
1401
+
1402
+
1403
+ # authentication setting
1404
+ _auth_settings: List[str] = [
1405
+ 'BearerAuth'
1406
+ ]
1407
+
1408
+ return self.api_client.param_serialize(
1409
+ method='GET',
1410
+ resource_path='/knowledgebase/{id}/items',
1411
+ path_params=_path_params,
1412
+ query_params=_query_params,
1413
+ header_params=_header_params,
1414
+ body=_body_params,
1415
+ post_params=_form_params,
1416
+ files=_files,
1417
+ auth_settings=_auth_settings,
1418
+ collection_formats=_collection_formats,
1419
+ _host=_host,
1420
+ _request_auth=_request_auth
1421
+ )
1422
+
1423
+
1424
+
1425
+
1426
+ @validate_call
1427
+ def get_knowledge_bases(
1428
+ self,
1429
+ _request_timeout: Union[
1430
+ None,
1431
+ Annotated[StrictFloat, Field(gt=0)],
1432
+ Tuple[
1433
+ Annotated[StrictFloat, Field(gt=0)],
1434
+ Annotated[StrictFloat, Field(gt=0)]
1435
+ ]
1436
+ ] = None,
1437
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1438
+ _content_type: Optional[StrictStr] = None,
1439
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1440
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1441
+ ) -> GetKnowledgeBases200Response:
1442
+ """Get all knowledge bases
1443
+
1444
+ Get all knowledge bases
1445
+
1446
+ :param _request_timeout: timeout setting for this request. If one
1447
+ number provided, it will be total request
1448
+ timeout. It can also be a pair (tuple) of
1449
+ (connection, read) timeouts.
1450
+ :type _request_timeout: int, tuple(int, int), optional
1451
+ :param _request_auth: set to override the auth_settings for an a single
1452
+ request; this effectively ignores the
1453
+ authentication in the spec for a single request.
1454
+ :type _request_auth: dict, optional
1455
+ :param _content_type: force content-type for the request.
1456
+ :type _content_type: str, Optional
1457
+ :param _headers: set to override the headers for a single
1458
+ request; this effectively ignores the headers
1459
+ in the spec for a single request.
1460
+ :type _headers: dict, optional
1461
+ :param _host_index: set to override the host_index for a single
1462
+ request; this effectively ignores the host_index
1463
+ in the spec for a single request.
1464
+ :type _host_index: int, optional
1465
+ :return: Returns the result object.
1466
+ """ # noqa: E501
1467
+
1468
+ _param = self._get_knowledge_bases_serialize(
1469
+ _request_auth=_request_auth,
1470
+ _content_type=_content_type,
1471
+ _headers=_headers,
1472
+ _host_index=_host_index
1473
+ )
1474
+
1475
+ _response_types_map: Dict[str, Optional[str]] = {
1476
+ '200': "GetKnowledgeBases200Response",
1477
+ '401': "UnauthorizedErrorReponse",
1478
+ '500': "InternalServerErrorResponse",
1479
+ }
1480
+ response_data = self.api_client.call_api(
1481
+ *_param,
1482
+ _request_timeout=_request_timeout
1483
+ )
1484
+ response_data.read()
1485
+ return self.api_client.response_deserialize(
1486
+ response_data=response_data,
1487
+ response_types_map=_response_types_map,
1488
+ ).data
1489
+
1490
+
1491
+ @validate_call
1492
+ def get_knowledge_bases_with_http_info(
1493
+ self,
1494
+ _request_timeout: Union[
1495
+ None,
1496
+ Annotated[StrictFloat, Field(gt=0)],
1497
+ Tuple[
1498
+ Annotated[StrictFloat, Field(gt=0)],
1499
+ Annotated[StrictFloat, Field(gt=0)]
1500
+ ]
1501
+ ] = None,
1502
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1503
+ _content_type: Optional[StrictStr] = None,
1504
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1505
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1506
+ ) -> ApiResponse[GetKnowledgeBases200Response]:
1507
+ """Get all knowledge bases
1508
+
1509
+ Get all knowledge bases
1510
+
1511
+ :param _request_timeout: timeout setting for this request. If one
1512
+ number provided, it will be total request
1513
+ timeout. It can also be a pair (tuple) of
1514
+ (connection, read) timeouts.
1515
+ :type _request_timeout: int, tuple(int, int), optional
1516
+ :param _request_auth: set to override the auth_settings for an a single
1517
+ request; this effectively ignores the
1518
+ authentication in the spec for a single request.
1519
+ :type _request_auth: dict, optional
1520
+ :param _content_type: force content-type for the request.
1521
+ :type _content_type: str, Optional
1522
+ :param _headers: set to override the headers for a single
1523
+ request; this effectively ignores the headers
1524
+ in the spec for a single request.
1525
+ :type _headers: dict, optional
1526
+ :param _host_index: set to override the host_index for a single
1527
+ request; this effectively ignores the host_index
1528
+ in the spec for a single request.
1529
+ :type _host_index: int, optional
1530
+ :return: Returns the result object.
1531
+ """ # noqa: E501
1532
+
1533
+ _param = self._get_knowledge_bases_serialize(
1534
+ _request_auth=_request_auth,
1535
+ _content_type=_content_type,
1536
+ _headers=_headers,
1537
+ _host_index=_host_index
1538
+ )
1539
+
1540
+ _response_types_map: Dict[str, Optional[str]] = {
1541
+ '200': "GetKnowledgeBases200Response",
1542
+ '401': "UnauthorizedErrorReponse",
1543
+ '500': "InternalServerErrorResponse",
1544
+ }
1545
+ response_data = self.api_client.call_api(
1546
+ *_param,
1547
+ _request_timeout=_request_timeout
1548
+ )
1549
+ response_data.read()
1550
+ return self.api_client.response_deserialize(
1551
+ response_data=response_data,
1552
+ response_types_map=_response_types_map,
1553
+ )
1554
+
1555
+
1556
+ @validate_call
1557
+ def get_knowledge_bases_without_preload_content(
1558
+ self,
1559
+ _request_timeout: Union[
1560
+ None,
1561
+ Annotated[StrictFloat, Field(gt=0)],
1562
+ Tuple[
1563
+ Annotated[StrictFloat, Field(gt=0)],
1564
+ Annotated[StrictFloat, Field(gt=0)]
1565
+ ]
1566
+ ] = None,
1567
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1568
+ _content_type: Optional[StrictStr] = None,
1569
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1570
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1571
+ ) -> RESTResponseType:
1572
+ """Get all knowledge bases
1573
+
1574
+ Get all knowledge bases
1575
+
1576
+ :param _request_timeout: timeout setting for this request. If one
1577
+ number provided, it will be total request
1578
+ timeout. It can also be a pair (tuple) of
1579
+ (connection, read) timeouts.
1580
+ :type _request_timeout: int, tuple(int, int), optional
1581
+ :param _request_auth: set to override the auth_settings for an a single
1582
+ request; this effectively ignores the
1583
+ authentication in the spec for a single request.
1584
+ :type _request_auth: dict, optional
1585
+ :param _content_type: force content-type for the request.
1586
+ :type _content_type: str, Optional
1587
+ :param _headers: set to override the headers for a single
1588
+ request; this effectively ignores the headers
1589
+ in the spec for a single request.
1590
+ :type _headers: dict, optional
1591
+ :param _host_index: set to override the host_index for a single
1592
+ request; this effectively ignores the host_index
1593
+ in the spec for a single request.
1594
+ :type _host_index: int, optional
1595
+ :return: Returns the result object.
1596
+ """ # noqa: E501
1597
+
1598
+ _param = self._get_knowledge_bases_serialize(
1599
+ _request_auth=_request_auth,
1600
+ _content_type=_content_type,
1601
+ _headers=_headers,
1602
+ _host_index=_host_index
1603
+ )
1604
+
1605
+ _response_types_map: Dict[str, Optional[str]] = {
1606
+ '200': "GetKnowledgeBases200Response",
1607
+ '401': "UnauthorizedErrorReponse",
1608
+ '500': "InternalServerErrorResponse",
1609
+ }
1610
+ response_data = self.api_client.call_api(
1611
+ *_param,
1612
+ _request_timeout=_request_timeout
1613
+ )
1614
+ return response_data.response
1615
+
1616
+
1617
+ def _get_knowledge_bases_serialize(
1618
+ self,
1619
+ _request_auth,
1620
+ _content_type,
1621
+ _headers,
1622
+ _host_index,
1623
+ ) -> RequestSerialized:
1624
+
1625
+ _host = None
1626
+
1627
+ _collection_formats: Dict[str, str] = {
1628
+ }
1629
+
1630
+ _path_params: Dict[str, str] = {}
1631
+ _query_params: List[Tuple[str, str]] = []
1632
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1633
+ _form_params: List[Tuple[str, str]] = []
1634
+ _files: Dict[
1635
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1636
+ ] = {}
1637
+ _body_params: Optional[bytes] = None
1638
+
1639
+ # process the path parameters
1640
+ # process the query parameters
1641
+ # process the header parameters
1642
+ # process the form parameters
1643
+ # process the body parameter
1644
+
1645
+
1646
+ # set the HTTP header `Accept`
1647
+ if 'Accept' not in _header_params:
1648
+ _header_params['Accept'] = self.api_client.select_header_accept(
1649
+ [
1650
+ 'application/json'
1651
+ ]
1652
+ )
1653
+
1654
+
1655
+ # authentication setting
1656
+ _auth_settings: List[str] = [
1657
+ 'BearerAuth'
1658
+ ]
1659
+
1660
+ return self.api_client.param_serialize(
1661
+ method='GET',
1662
+ resource_path='/knowledgebase',
1663
+ path_params=_path_params,
1664
+ query_params=_query_params,
1665
+ header_params=_header_params,
1666
+ body=_body_params,
1667
+ post_params=_form_params,
1668
+ files=_files,
1669
+ auth_settings=_auth_settings,
1670
+ collection_formats=_collection_formats,
1671
+ _host=_host,
1672
+ _request_auth=_request_auth
1673
+ )
1674
+
1675
+
1676
+
1677
+
1678
+ @validate_call
1679
+ def upload_media_to_knowledge_base(
1680
+ self,
1681
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1682
+ media: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]],
1683
+ _request_timeout: Union[
1684
+ None,
1685
+ Annotated[StrictFloat, Field(gt=0)],
1686
+ Tuple[
1687
+ Annotated[StrictFloat, Field(gt=0)],
1688
+ Annotated[StrictFloat, Field(gt=0)]
1689
+ ]
1690
+ ] = None,
1691
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1692
+ _content_type: Optional[StrictStr] = None,
1693
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1694
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1695
+ ) -> DeleteAgent200Response:
1696
+ """Upload a media to a knowledge base
1697
+
1698
+ Upload a media to a knowledge base
1699
+
1700
+ :param id: The ID of the knowledge base (required)
1701
+ :type id: str
1702
+ :param media: (required)
1703
+ :type media: bytearray
1704
+ :param _request_timeout: timeout setting for this request. If one
1705
+ number provided, it will be total request
1706
+ timeout. It can also be a pair (tuple) of
1707
+ (connection, read) timeouts.
1708
+ :type _request_timeout: int, tuple(int, int), optional
1709
+ :param _request_auth: set to override the auth_settings for an a single
1710
+ request; this effectively ignores the
1711
+ authentication in the spec for a single request.
1712
+ :type _request_auth: dict, optional
1713
+ :param _content_type: force content-type for the request.
1714
+ :type _content_type: str, Optional
1715
+ :param _headers: set to override the headers for a single
1716
+ request; this effectively ignores the headers
1717
+ in the spec for a single request.
1718
+ :type _headers: dict, optional
1719
+ :param _host_index: set to override the host_index for a single
1720
+ request; this effectively ignores the host_index
1721
+ in the spec for a single request.
1722
+ :type _host_index: int, optional
1723
+ :return: Returns the result object.
1724
+ """ # noqa: E501
1725
+
1726
+ _param = self._upload_media_to_knowledge_base_serialize(
1727
+ id=id,
1728
+ media=media,
1729
+ _request_auth=_request_auth,
1730
+ _content_type=_content_type,
1731
+ _headers=_headers,
1732
+ _host_index=_host_index
1733
+ )
1734
+
1735
+ _response_types_map: Dict[str, Optional[str]] = {
1736
+ '201': "DeleteAgent200Response",
1737
+ '400': "BadRequestErrorResponse",
1738
+ '401': "UnauthorizedErrorReponse",
1739
+ '500': "InternalServerErrorResponse",
1740
+ }
1741
+ response_data = self.api_client.call_api(
1742
+ *_param,
1743
+ _request_timeout=_request_timeout
1744
+ )
1745
+ response_data.read()
1746
+ return self.api_client.response_deserialize(
1747
+ response_data=response_data,
1748
+ response_types_map=_response_types_map,
1749
+ ).data
1750
+
1751
+
1752
+ @validate_call
1753
+ def upload_media_to_knowledge_base_with_http_info(
1754
+ self,
1755
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1756
+ media: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]],
1757
+ _request_timeout: Union[
1758
+ None,
1759
+ Annotated[StrictFloat, Field(gt=0)],
1760
+ Tuple[
1761
+ Annotated[StrictFloat, Field(gt=0)],
1762
+ Annotated[StrictFloat, Field(gt=0)]
1763
+ ]
1764
+ ] = None,
1765
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1766
+ _content_type: Optional[StrictStr] = None,
1767
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1768
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1769
+ ) -> ApiResponse[DeleteAgent200Response]:
1770
+ """Upload a media to a knowledge base
1771
+
1772
+ Upload a media to a knowledge base
1773
+
1774
+ :param id: The ID of the knowledge base (required)
1775
+ :type id: str
1776
+ :param media: (required)
1777
+ :type media: bytearray
1778
+ :param _request_timeout: timeout setting for this request. If one
1779
+ number provided, it will be total request
1780
+ timeout. It can also be a pair (tuple) of
1781
+ (connection, read) timeouts.
1782
+ :type _request_timeout: int, tuple(int, int), optional
1783
+ :param _request_auth: set to override the auth_settings for an a single
1784
+ request; this effectively ignores the
1785
+ authentication in the spec for a single request.
1786
+ :type _request_auth: dict, optional
1787
+ :param _content_type: force content-type for the request.
1788
+ :type _content_type: str, Optional
1789
+ :param _headers: set to override the headers for a single
1790
+ request; this effectively ignores the headers
1791
+ in the spec for a single request.
1792
+ :type _headers: dict, optional
1793
+ :param _host_index: set to override the host_index for a single
1794
+ request; this effectively ignores the host_index
1795
+ in the spec for a single request.
1796
+ :type _host_index: int, optional
1797
+ :return: Returns the result object.
1798
+ """ # noqa: E501
1799
+
1800
+ _param = self._upload_media_to_knowledge_base_serialize(
1801
+ id=id,
1802
+ media=media,
1803
+ _request_auth=_request_auth,
1804
+ _content_type=_content_type,
1805
+ _headers=_headers,
1806
+ _host_index=_host_index
1807
+ )
1808
+
1809
+ _response_types_map: Dict[str, Optional[str]] = {
1810
+ '201': "DeleteAgent200Response",
1811
+ '400': "BadRequestErrorResponse",
1812
+ '401': "UnauthorizedErrorReponse",
1813
+ '500': "InternalServerErrorResponse",
1814
+ }
1815
+ response_data = self.api_client.call_api(
1816
+ *_param,
1817
+ _request_timeout=_request_timeout
1818
+ )
1819
+ response_data.read()
1820
+ return self.api_client.response_deserialize(
1821
+ response_data=response_data,
1822
+ response_types_map=_response_types_map,
1823
+ )
1824
+
1825
+
1826
+ @validate_call
1827
+ def upload_media_to_knowledge_base_without_preload_content(
1828
+ self,
1829
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1830
+ media: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]],
1831
+ _request_timeout: Union[
1832
+ None,
1833
+ Annotated[StrictFloat, Field(gt=0)],
1834
+ Tuple[
1835
+ Annotated[StrictFloat, Field(gt=0)],
1836
+ Annotated[StrictFloat, Field(gt=0)]
1837
+ ]
1838
+ ] = None,
1839
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1840
+ _content_type: Optional[StrictStr] = None,
1841
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1842
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1843
+ ) -> RESTResponseType:
1844
+ """Upload a media to a knowledge base
1845
+
1846
+ Upload a media to a knowledge base
1847
+
1848
+ :param id: The ID of the knowledge base (required)
1849
+ :type id: str
1850
+ :param media: (required)
1851
+ :type media: bytearray
1852
+ :param _request_timeout: timeout setting for this request. If one
1853
+ number provided, it will be total request
1854
+ timeout. It can also be a pair (tuple) of
1855
+ (connection, read) timeouts.
1856
+ :type _request_timeout: int, tuple(int, int), optional
1857
+ :param _request_auth: set to override the auth_settings for an a single
1858
+ request; this effectively ignores the
1859
+ authentication in the spec for a single request.
1860
+ :type _request_auth: dict, optional
1861
+ :param _content_type: force content-type for the request.
1862
+ :type _content_type: str, Optional
1863
+ :param _headers: set to override the headers for a single
1864
+ request; this effectively ignores the headers
1865
+ in the spec for a single request.
1866
+ :type _headers: dict, optional
1867
+ :param _host_index: set to override the host_index for a single
1868
+ request; this effectively ignores the host_index
1869
+ in the spec for a single request.
1870
+ :type _host_index: int, optional
1871
+ :return: Returns the result object.
1872
+ """ # noqa: E501
1873
+
1874
+ _param = self._upload_media_to_knowledge_base_serialize(
1875
+ id=id,
1876
+ media=media,
1877
+ _request_auth=_request_auth,
1878
+ _content_type=_content_type,
1879
+ _headers=_headers,
1880
+ _host_index=_host_index
1881
+ )
1882
+
1883
+ _response_types_map: Dict[str, Optional[str]] = {
1884
+ '201': "DeleteAgent200Response",
1885
+ '400': "BadRequestErrorResponse",
1886
+ '401': "UnauthorizedErrorReponse",
1887
+ '500': "InternalServerErrorResponse",
1888
+ }
1889
+ response_data = self.api_client.call_api(
1890
+ *_param,
1891
+ _request_timeout=_request_timeout
1892
+ )
1893
+ return response_data.response
1894
+
1895
+
1896
+ def _upload_media_to_knowledge_base_serialize(
1897
+ self,
1898
+ id,
1899
+ media,
1900
+ _request_auth,
1901
+ _content_type,
1902
+ _headers,
1903
+ _host_index,
1904
+ ) -> RequestSerialized:
1905
+
1906
+ _host = None
1907
+
1908
+ _collection_formats: Dict[str, str] = {
1909
+ }
1910
+
1911
+ _path_params: Dict[str, str] = {}
1912
+ _query_params: List[Tuple[str, str]] = []
1913
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1914
+ _form_params: List[Tuple[str, str]] = []
1915
+ _files: Dict[
1916
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1917
+ ] = {}
1918
+ _body_params: Optional[bytes] = None
1919
+
1920
+ # process the path parameters
1921
+ if id is not None:
1922
+ _path_params['id'] = id
1923
+ # process the query parameters
1924
+ # process the header parameters
1925
+ # process the form parameters
1926
+ if media is not None:
1927
+ _files['media'] = media
1928
+ # process the body parameter
1929
+
1930
+
1931
+ # set the HTTP header `Accept`
1932
+ if 'Accept' not in _header_params:
1933
+ _header_params['Accept'] = self.api_client.select_header_accept(
1934
+ [
1935
+ 'application/json'
1936
+ ]
1937
+ )
1938
+
1939
+ # set the HTTP header `Content-Type`
1940
+ if _content_type:
1941
+ _header_params['Content-Type'] = _content_type
1942
+ else:
1943
+ _default_content_type = (
1944
+ self.api_client.select_header_content_type(
1945
+ [
1946
+ 'multipart/form-data'
1947
+ ]
1948
+ )
1949
+ )
1950
+ if _default_content_type is not None:
1951
+ _header_params['Content-Type'] = _default_content_type
1952
+
1953
+ # authentication setting
1954
+ _auth_settings: List[str] = [
1955
+ 'BearerAuth'
1956
+ ]
1957
+
1958
+ return self.api_client.param_serialize(
1959
+ method='POST',
1960
+ resource_path='/knowledgebase/{id}/items/upload-media',
1961
+ path_params=_path_params,
1962
+ query_params=_query_params,
1963
+ header_params=_header_params,
1964
+ body=_body_params,
1965
+ post_params=_form_params,
1966
+ files=_files,
1967
+ auth_settings=_auth_settings,
1968
+ collection_formats=_collection_formats,
1969
+ _host=_host,
1970
+ _request_auth=_request_auth
1971
+ )
1972
+
1973
+
1974
+
1975
+
1976
+ @validate_call
1977
+ def upload_text_to_knowledge_base(
1978
+ self,
1979
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
1980
+ upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest,
1981
+ _request_timeout: Union[
1982
+ None,
1983
+ Annotated[StrictFloat, Field(gt=0)],
1984
+ Tuple[
1985
+ Annotated[StrictFloat, Field(gt=0)],
1986
+ Annotated[StrictFloat, Field(gt=0)]
1987
+ ]
1988
+ ] = None,
1989
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1990
+ _content_type: Optional[StrictStr] = None,
1991
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1992
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1993
+ ) -> DeleteAgent200Response:
1994
+ """Upload a text to a knowledge base
1995
+
1996
+ Upload a text to a knowledge base
1997
+
1998
+ :param id: The ID of the knowledge base (required)
1999
+ :type id: str
2000
+ :param upload_text_to_knowledge_base_request: (required)
2001
+ :type upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest
2002
+ :param _request_timeout: timeout setting for this request. If one
2003
+ number provided, it will be total request
2004
+ timeout. It can also be a pair (tuple) of
2005
+ (connection, read) timeouts.
2006
+ :type _request_timeout: int, tuple(int, int), optional
2007
+ :param _request_auth: set to override the auth_settings for an a single
2008
+ request; this effectively ignores the
2009
+ authentication in the spec for a single request.
2010
+ :type _request_auth: dict, optional
2011
+ :param _content_type: force content-type for the request.
2012
+ :type _content_type: str, Optional
2013
+ :param _headers: set to override the headers for a single
2014
+ request; this effectively ignores the headers
2015
+ in the spec for a single request.
2016
+ :type _headers: dict, optional
2017
+ :param _host_index: set to override the host_index for a single
2018
+ request; this effectively ignores the host_index
2019
+ in the spec for a single request.
2020
+ :type _host_index: int, optional
2021
+ :return: Returns the result object.
2022
+ """ # noqa: E501
2023
+
2024
+ _param = self._upload_text_to_knowledge_base_serialize(
2025
+ id=id,
2026
+ upload_text_to_knowledge_base_request=upload_text_to_knowledge_base_request,
2027
+ _request_auth=_request_auth,
2028
+ _content_type=_content_type,
2029
+ _headers=_headers,
2030
+ _host_index=_host_index
2031
+ )
2032
+
2033
+ _response_types_map: Dict[str, Optional[str]] = {
2034
+ '201': "DeleteAgent200Response",
2035
+ '400': "BadRequestErrorResponse",
2036
+ '401': "UnauthorizedErrorReponse",
2037
+ '500': "InternalServerErrorResponse",
2038
+ }
2039
+ response_data = self.api_client.call_api(
2040
+ *_param,
2041
+ _request_timeout=_request_timeout
2042
+ )
2043
+ response_data.read()
2044
+ return self.api_client.response_deserialize(
2045
+ response_data=response_data,
2046
+ response_types_map=_response_types_map,
2047
+ ).data
2048
+
2049
+
2050
+ @validate_call
2051
+ def upload_text_to_knowledge_base_with_http_info(
2052
+ self,
2053
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
2054
+ upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest,
2055
+ _request_timeout: Union[
2056
+ None,
2057
+ Annotated[StrictFloat, Field(gt=0)],
2058
+ Tuple[
2059
+ Annotated[StrictFloat, Field(gt=0)],
2060
+ Annotated[StrictFloat, Field(gt=0)]
2061
+ ]
2062
+ ] = None,
2063
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2064
+ _content_type: Optional[StrictStr] = None,
2065
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2066
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2067
+ ) -> ApiResponse[DeleteAgent200Response]:
2068
+ """Upload a text to a knowledge base
2069
+
2070
+ Upload a text to a knowledge base
2071
+
2072
+ :param id: The ID of the knowledge base (required)
2073
+ :type id: str
2074
+ :param upload_text_to_knowledge_base_request: (required)
2075
+ :type upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest
2076
+ :param _request_timeout: timeout setting for this request. If one
2077
+ number provided, it will be total request
2078
+ timeout. It can also be a pair (tuple) of
2079
+ (connection, read) timeouts.
2080
+ :type _request_timeout: int, tuple(int, int), optional
2081
+ :param _request_auth: set to override the auth_settings for an a single
2082
+ request; this effectively ignores the
2083
+ authentication in the spec for a single request.
2084
+ :type _request_auth: dict, optional
2085
+ :param _content_type: force content-type for the request.
2086
+ :type _content_type: str, Optional
2087
+ :param _headers: set to override the headers for a single
2088
+ request; this effectively ignores the headers
2089
+ in the spec for a single request.
2090
+ :type _headers: dict, optional
2091
+ :param _host_index: set to override the host_index for a single
2092
+ request; this effectively ignores the host_index
2093
+ in the spec for a single request.
2094
+ :type _host_index: int, optional
2095
+ :return: Returns the result object.
2096
+ """ # noqa: E501
2097
+
2098
+ _param = self._upload_text_to_knowledge_base_serialize(
2099
+ id=id,
2100
+ upload_text_to_knowledge_base_request=upload_text_to_knowledge_base_request,
2101
+ _request_auth=_request_auth,
2102
+ _content_type=_content_type,
2103
+ _headers=_headers,
2104
+ _host_index=_host_index
2105
+ )
2106
+
2107
+ _response_types_map: Dict[str, Optional[str]] = {
2108
+ '201': "DeleteAgent200Response",
2109
+ '400': "BadRequestErrorResponse",
2110
+ '401': "UnauthorizedErrorReponse",
2111
+ '500': "InternalServerErrorResponse",
2112
+ }
2113
+ response_data = self.api_client.call_api(
2114
+ *_param,
2115
+ _request_timeout=_request_timeout
2116
+ )
2117
+ response_data.read()
2118
+ return self.api_client.response_deserialize(
2119
+ response_data=response_data,
2120
+ response_types_map=_response_types_map,
2121
+ )
2122
+
2123
+
2124
+ @validate_call
2125
+ def upload_text_to_knowledge_base_without_preload_content(
2126
+ self,
2127
+ id: Annotated[StrictStr, Field(description="The ID of the knowledge base")],
2128
+ upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest,
2129
+ _request_timeout: Union[
2130
+ None,
2131
+ Annotated[StrictFloat, Field(gt=0)],
2132
+ Tuple[
2133
+ Annotated[StrictFloat, Field(gt=0)],
2134
+ Annotated[StrictFloat, Field(gt=0)]
2135
+ ]
2136
+ ] = None,
2137
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2138
+ _content_type: Optional[StrictStr] = None,
2139
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2140
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2141
+ ) -> RESTResponseType:
2142
+ """Upload a text to a knowledge base
2143
+
2144
+ Upload a text to a knowledge base
2145
+
2146
+ :param id: The ID of the knowledge base (required)
2147
+ :type id: str
2148
+ :param upload_text_to_knowledge_base_request: (required)
2149
+ :type upload_text_to_knowledge_base_request: UploadTextToKnowledgeBaseRequest
2150
+ :param _request_timeout: timeout setting for this request. If one
2151
+ number provided, it will be total request
2152
+ timeout. It can also be a pair (tuple) of
2153
+ (connection, read) timeouts.
2154
+ :type _request_timeout: int, tuple(int, int), optional
2155
+ :param _request_auth: set to override the auth_settings for an a single
2156
+ request; this effectively ignores the
2157
+ authentication in the spec for a single request.
2158
+ :type _request_auth: dict, optional
2159
+ :param _content_type: force content-type for the request.
2160
+ :type _content_type: str, Optional
2161
+ :param _headers: set to override the headers for a single
2162
+ request; this effectively ignores the headers
2163
+ in the spec for a single request.
2164
+ :type _headers: dict, optional
2165
+ :param _host_index: set to override the host_index for a single
2166
+ request; this effectively ignores the host_index
2167
+ in the spec for a single request.
2168
+ :type _host_index: int, optional
2169
+ :return: Returns the result object.
2170
+ """ # noqa: E501
2171
+
2172
+ _param = self._upload_text_to_knowledge_base_serialize(
2173
+ id=id,
2174
+ upload_text_to_knowledge_base_request=upload_text_to_knowledge_base_request,
2175
+ _request_auth=_request_auth,
2176
+ _content_type=_content_type,
2177
+ _headers=_headers,
2178
+ _host_index=_host_index
2179
+ )
2180
+
2181
+ _response_types_map: Dict[str, Optional[str]] = {
2182
+ '201': "DeleteAgent200Response",
2183
+ '400': "BadRequestErrorResponse",
2184
+ '401': "UnauthorizedErrorReponse",
2185
+ '500': "InternalServerErrorResponse",
2186
+ }
2187
+ response_data = self.api_client.call_api(
2188
+ *_param,
2189
+ _request_timeout=_request_timeout
2190
+ )
2191
+ return response_data.response
2192
+
2193
+
2194
+ def _upload_text_to_knowledge_base_serialize(
2195
+ self,
2196
+ id,
2197
+ upload_text_to_knowledge_base_request,
2198
+ _request_auth,
2199
+ _content_type,
2200
+ _headers,
2201
+ _host_index,
2202
+ ) -> RequestSerialized:
2203
+
2204
+ _host = None
2205
+
2206
+ _collection_formats: Dict[str, str] = {
2207
+ }
2208
+
2209
+ _path_params: Dict[str, str] = {}
2210
+ _query_params: List[Tuple[str, str]] = []
2211
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2212
+ _form_params: List[Tuple[str, str]] = []
2213
+ _files: Dict[
2214
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2215
+ ] = {}
2216
+ _body_params: Optional[bytes] = None
2217
+
2218
+ # process the path parameters
2219
+ if id is not None:
2220
+ _path_params['id'] = id
2221
+ # process the query parameters
2222
+ # process the header parameters
2223
+ # process the form parameters
2224
+ # process the body parameter
2225
+ if upload_text_to_knowledge_base_request is not None:
2226
+ _body_params = upload_text_to_knowledge_base_request
2227
+
2228
+
2229
+ # set the HTTP header `Accept`
2230
+ if 'Accept' not in _header_params:
2231
+ _header_params['Accept'] = self.api_client.select_header_accept(
2232
+ [
2233
+ 'application/json'
2234
+ ]
2235
+ )
2236
+
2237
+ # set the HTTP header `Content-Type`
2238
+ if _content_type:
2239
+ _header_params['Content-Type'] = _content_type
2240
+ else:
2241
+ _default_content_type = (
2242
+ self.api_client.select_header_content_type(
2243
+ [
2244
+ 'application/json'
2245
+ ]
2246
+ )
2247
+ )
2248
+ if _default_content_type is not None:
2249
+ _header_params['Content-Type'] = _default_content_type
2250
+
2251
+ # authentication setting
2252
+ _auth_settings: List[str] = [
2253
+ 'BearerAuth'
2254
+ ]
2255
+
2256
+ return self.api_client.param_serialize(
2257
+ method='POST',
2258
+ resource_path='/knowledgebase/{id}/items/upload-text',
2259
+ path_params=_path_params,
2260
+ query_params=_query_params,
2261
+ header_params=_header_params,
2262
+ body=_body_params,
2263
+ post_params=_form_params,
2264
+ files=_files,
2265
+ auth_settings=_auth_settings,
2266
+ collection_formats=_collection_formats,
2267
+ _host=_host,
2268
+ _request_auth=_request_auth
2269
+ )
2270
+
2271
+