egain-api-python 0.1.9__py3-none-any.whl → 0.2.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.
- egain_api_python/_version.py +2 -2
- egain_api_python/aiservices.py +5 -0
- egain_api_python/aiservices_prompt.py +279 -0
- egain_api_python/answers.py +20 -14
- egain_api_python/content.py +0 -3
- egain_api_python/errors/__init__.py +5 -5
- egain_api_python/errors/executepromptop.py +35 -0
- egain_api_python/errors/schemas_wserrorcommon.py +1 -1
- egain_api_python/export.py +46 -20
- egain_api_python/general.py +2 -2
- egain_api_python/import_.py +48 -78
- egain_api_python/models/__init__.py +170 -185
- egain_api_python/models/additionalsnippets.py +17 -9
- egain_api_python/models/aisearchop.py +20 -10
- egain_api_python/models/aisearchresponse.py +6 -33
- egain_api_python/models/aispaginationinfo.py +32 -0
- egain_api_python/models/aitopicbreadcrumb.py +24 -0
- egain_api_python/models/aitopicsummary.py +25 -0
- egain_api_python/models/answersrequest.py +9 -2
- egain_api_python/models/answersresponse.py +15 -4
- egain_api_python/models/articleaisearchresult.py +31 -54
- egain_api_python/models/articlewitheditions.py +4 -2
- egain_api_python/models/cancelimportop.py +1 -1
- egain_api_python/models/createimportjobop.py +1 -1
- egain_api_python/models/createimportvalidationjobop.py +1 -1
- egain_api_python/models/createsuggestion.py +13 -1
- egain_api_python/models/datasourcecredentials.py +32 -0
- egain_api_python/models/edition.py +2 -8
- egain_api_python/models/executeprompt.py +92 -0
- egain_api_python/models/executepromptop.py +35 -0
- egain_api_python/models/executepromptresponse.py +58 -0
- egain_api_python/models/exportcontentop.py +25 -1
- egain_api_python/models/getalltopicsop.py +9 -0
- egain_api_python/models/getarticleeditiondetailsop.py +2 -2
- egain_api_python/models/getbestanswerop.py +23 -13
- egain_api_python/models/getimportstatusop.py +1 -1
- egain_api_python/models/getmyportalsop.py +2 -2
- egain_api_python/models/getprompttemplatebyidop.py +95 -0
- egain_api_python/models/getprompttemplatesop.py +121 -0
- egain_api_python/models/importcontent.py +3 -13
- egain_api_python/models/knowledgeexport.py +19 -16
- egain_api_python/models/languagecode_parameter.py +11 -0
- egain_api_python/models/languagequeryparameter.py +11 -0
- egain_api_python/models/mandatorylanguagequeryparameter.py +12 -0
- egain_api_python/models/portal.py +2 -2
- egain_api_python/models/prompttemplate.py +150 -0
- egain_api_python/models/publishprofile.py +2 -8
- egain_api_python/models/referenceresponse.py +3 -3
- egain_api_python/models/replacement.py +16 -0
- egain_api_python/models/requiredlanguagecode.py +40 -0
- egain_api_python/models/retrievechunksop.py +23 -13
- egain_api_python/models/retrieverequest.py +9 -2
- egain_api_python/models/retrieveresponse.py +15 -4
- egain_api_python/models/searchreplacement.py +36 -0
- egain_api_python/models/searchresult.py +29 -7
- egain_api_python/models/searchsuggestionop.py +2 -2
- egain_api_python/models/shorturl.py +2 -2
- egain_api_python/models/staticreplacement.py +30 -0
- egain_api_python/models/suggestion.py +24 -1
- egain_api_python/models/validateimportcontent.py +3 -13
- egain_api_python/portal_article.py +6 -4
- egain_api_python/portal_attachment.py +1 -246
- egain_api_python/portal_sdk.py +0 -3
- egain_api_python/portal_suggestion.py +2 -2
- egain_api_python/portal_topic.py +6 -0
- egain_api_python/prompt.py +447 -0
- egain_api_python/retrieve.py +16 -10
- egain_api_python/sdk.py +4 -0
- egain_api_python/search.py +43 -21
- {egain_api_python-0.1.9.dist-info → egain_api_python-0.2.1.dist-info}/METADATA +118 -208
- {egain_api_python-0.1.9.dist-info → egain_api_python-0.2.1.dist-info}/RECORD +74 -74
- {egain_api_python-0.1.9.dist-info → egain_api_python-0.2.1.dist-info}/WHEEL +1 -1
- egain_api_python/errors/gethealthop.py +0 -88
- egain_api_python/escalation.py +0 -955
- egain_api_python/health.py +0 -247
- egain_api_python/models/articlesearchresult.py +0 -243
- egain_api_python/models/articlesearchresults.py +0 -32
- egain_api_python/models/avertcustomerescalationop.py +0 -44
- egain_api_python/models/completecustomerescalationop.py +0 -44
- egain_api_python/models/contactperson.py +0 -43
- egain_api_python/models/contacts.py +0 -21
- egain_api_python/models/email.py +0 -21
- egain_api_python/models/gethealthop.py +0 -257
- egain_api_python/models/optionalarticleattributes.py +0 -20
- egain_api_python/models/phone.py +0 -21
- egain_api_python/models/searchpriortoescalationop.py +0 -108
- egain_api_python/models/startcustomerescalationop.py +0 -66
- egain_api_python/models/startescalationrequest.py +0 -94
- egain_api_python/models/uploadattachmentop.py +0 -36
- {egain_api_python-0.1.9.dist-info → egain_api_python-0.2.1.dist-info}/licenses/LICENSE +0 -0
- {egain_api_python-0.1.9.dist-info → egain_api_python-0.2.1.dist-info}/top_level.txt +0 -0
egain_api_python/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "egain-api-python"
|
|
6
|
-
__version__: str = "0.1
|
|
6
|
+
__version__: str = "0.2.1"
|
|
7
7
|
__openapi_doc_version__: str = "4.0.0"
|
|
8
8
|
__gen_version__: str = "2.723.11"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.1
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.2.1 2.723.11 4.0.0 egain-api-python"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
egain_api_python/aiservices.py
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from .sdkconfiguration import SDKConfiguration
|
|
5
|
+
from egain_api_python.aiservices_prompt import AiservicesPrompt
|
|
5
6
|
from egain_api_python.answers import Answers
|
|
6
7
|
from egain_api_python.retrieve import Retrieve
|
|
7
8
|
from typing import Optional
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Aiservices(BaseSDK):
|
|
12
|
+
prompt: AiservicesPrompt
|
|
11
13
|
retrieve: Retrieve
|
|
12
14
|
answers: Answers
|
|
13
15
|
|
|
@@ -19,5 +21,8 @@ class Aiservices(BaseSDK):
|
|
|
19
21
|
self._init_sdks()
|
|
20
22
|
|
|
21
23
|
def _init_sdks(self):
|
|
24
|
+
self.prompt = AiservicesPrompt(
|
|
25
|
+
self.sdk_configuration, parent_ref=self.parent_ref
|
|
26
|
+
)
|
|
22
27
|
self.retrieve = Retrieve(self.sdk_configuration, parent_ref=self.parent_ref)
|
|
23
28
|
self.answers = Answers(self.sdk_configuration, parent_ref=self.parent_ref)
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from egain_api_python import errors, models, utils
|
|
5
|
+
from egain_api_python._hooks import HookContext
|
|
6
|
+
from egain_api_python.types import OptionalNullable, UNSET
|
|
7
|
+
from egain_api_python.utils import get_security_from_env
|
|
8
|
+
from egain_api_python.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
+
from typing import Any, List, Mapping, Optional, Union
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AiservicesPrompt(BaseSDK):
|
|
13
|
+
def execute_prompt(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
prompt_id: str,
|
|
17
|
+
department: str,
|
|
18
|
+
language_code: models.LanguageCodeRequestBody,
|
|
19
|
+
replacements: Optional[
|
|
20
|
+
Union[List[models.Replacement], List[models.ReplacementTypedDict]]
|
|
21
|
+
] = None,
|
|
22
|
+
event_type: Optional[models.EventTypeRequestBody] = "generate",
|
|
23
|
+
client_session_id: Optional[str] = None,
|
|
24
|
+
streaming: Optional[bool] = False,
|
|
25
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
26
|
+
server_url: Optional[str] = None,
|
|
27
|
+
timeout_ms: Optional[int] = None,
|
|
28
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
29
|
+
) -> models.ExecutePromptResponse:
|
|
30
|
+
r"""Execute a predefined prompt
|
|
31
|
+
|
|
32
|
+
Execute a published and active prompt template from the AI console.
|
|
33
|
+
|
|
34
|
+
:param prompt_id: ID of the prompt template from the AI console. Only published and active prompt IDs are allowed.
|
|
35
|
+
:param department: Name of the department. Must be a valid department name.
|
|
36
|
+
:param language_code: The language used for the prompt template.
|
|
37
|
+
:param replacements: List of variable replacements (either static or search).
|
|
38
|
+
:param event_type: Event type logged when the API executes successfully.
|
|
39
|
+
:param client_session_id: Client provided sessionID to store events against.
|
|
40
|
+
:param streaming: Whether to stream the response instead of returning inline.
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = models.EXECUTE_PROMPT_OP_SERVERS[0]
|
|
55
|
+
|
|
56
|
+
request = models.ExecutePromptRequest(
|
|
57
|
+
prompt_id=prompt_id,
|
|
58
|
+
execute_prompt=models.ExecutePrompt(
|
|
59
|
+
department=department,
|
|
60
|
+
language_code=language_code,
|
|
61
|
+
replacements=utils.get_pydantic_model(
|
|
62
|
+
replacements, Optional[List[models.Replacement]]
|
|
63
|
+
),
|
|
64
|
+
event_type=event_type,
|
|
65
|
+
client_session_id=client_session_id,
|
|
66
|
+
streaming=streaming,
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
req = self._build_request(
|
|
71
|
+
method="POST",
|
|
72
|
+
path="/promptmanager/execute/prompt/{promptId}",
|
|
73
|
+
base_url=base_url,
|
|
74
|
+
url_variables=url_variables,
|
|
75
|
+
request=request,
|
|
76
|
+
request_body_required=False,
|
|
77
|
+
request_has_path_params=True,
|
|
78
|
+
request_has_query_params=True,
|
|
79
|
+
user_agent_header="user-agent",
|
|
80
|
+
accept_header_value="application/json",
|
|
81
|
+
http_headers=http_headers,
|
|
82
|
+
security=self.sdk_configuration.security,
|
|
83
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
84
|
+
request.execute_prompt,
|
|
85
|
+
False,
|
|
86
|
+
True,
|
|
87
|
+
"json",
|
|
88
|
+
Optional[models.ExecutePrompt],
|
|
89
|
+
),
|
|
90
|
+
timeout_ms=timeout_ms,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
if retries == UNSET:
|
|
94
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
95
|
+
retries = self.sdk_configuration.retry_config
|
|
96
|
+
|
|
97
|
+
retry_config = None
|
|
98
|
+
if isinstance(retries, utils.RetryConfig):
|
|
99
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
100
|
+
|
|
101
|
+
http_res = self.do_request(
|
|
102
|
+
hook_ctx=HookContext(
|
|
103
|
+
config=self.sdk_configuration,
|
|
104
|
+
base_url=base_url or "",
|
|
105
|
+
operation_id="executePrompt",
|
|
106
|
+
oauth2_scopes=None,
|
|
107
|
+
security_source=get_security_from_env(
|
|
108
|
+
self.sdk_configuration.security, models.Security
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
request=req,
|
|
112
|
+
error_status_codes=[
|
|
113
|
+
"400",
|
|
114
|
+
"401",
|
|
115
|
+
"403",
|
|
116
|
+
"404",
|
|
117
|
+
"429",
|
|
118
|
+
"4XX",
|
|
119
|
+
"500",
|
|
120
|
+
"503",
|
|
121
|
+
"5XX",
|
|
122
|
+
],
|
|
123
|
+
retry_config=retry_config,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
response_data: Any = None
|
|
127
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
128
|
+
return unmarshal_json_response(models.ExecutePromptResponse, http_res)
|
|
129
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
130
|
+
response_data = unmarshal_json_response(
|
|
131
|
+
errors.BadRequestErrorData, http_res
|
|
132
|
+
)
|
|
133
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
134
|
+
if utils.match_response(http_res, ["401", "403", "404", "429", "4XX"], "*"):
|
|
135
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
136
|
+
raise errors.EgainDefaultError(
|
|
137
|
+
"API error occurred", http_res, http_res_text
|
|
138
|
+
)
|
|
139
|
+
if utils.match_response(http_res, ["500", "503", "5XX"], "*"):
|
|
140
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
141
|
+
raise errors.EgainDefaultError(
|
|
142
|
+
"API error occurred", http_res, http_res_text
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
|
146
|
+
|
|
147
|
+
async def execute_prompt_async(
|
|
148
|
+
self,
|
|
149
|
+
*,
|
|
150
|
+
prompt_id: str,
|
|
151
|
+
department: str,
|
|
152
|
+
language_code: models.LanguageCodeRequestBody,
|
|
153
|
+
replacements: Optional[
|
|
154
|
+
Union[List[models.Replacement], List[models.ReplacementTypedDict]]
|
|
155
|
+
] = None,
|
|
156
|
+
event_type: Optional[models.EventTypeRequestBody] = "generate",
|
|
157
|
+
client_session_id: Optional[str] = None,
|
|
158
|
+
streaming: Optional[bool] = False,
|
|
159
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
160
|
+
server_url: Optional[str] = None,
|
|
161
|
+
timeout_ms: Optional[int] = None,
|
|
162
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
163
|
+
) -> models.ExecutePromptResponse:
|
|
164
|
+
r"""Execute a predefined prompt
|
|
165
|
+
|
|
166
|
+
Execute a published and active prompt template from the AI console.
|
|
167
|
+
|
|
168
|
+
:param prompt_id: ID of the prompt template from the AI console. Only published and active prompt IDs are allowed.
|
|
169
|
+
:param department: Name of the department. Must be a valid department name.
|
|
170
|
+
:param language_code: The language used for the prompt template.
|
|
171
|
+
:param replacements: List of variable replacements (either static or search).
|
|
172
|
+
:param event_type: Event type logged when the API executes successfully.
|
|
173
|
+
:param client_session_id: Client provided sessionID to store events against.
|
|
174
|
+
:param streaming: Whether to stream the response instead of returning inline.
|
|
175
|
+
:param retries: Override the default retry configuration for this method
|
|
176
|
+
:param server_url: Override the default server URL for this method
|
|
177
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
178
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
179
|
+
"""
|
|
180
|
+
base_url = None
|
|
181
|
+
url_variables = None
|
|
182
|
+
if timeout_ms is None:
|
|
183
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
184
|
+
|
|
185
|
+
if server_url is not None:
|
|
186
|
+
base_url = server_url
|
|
187
|
+
else:
|
|
188
|
+
base_url = models.EXECUTE_PROMPT_OP_SERVERS[0]
|
|
189
|
+
|
|
190
|
+
request = models.ExecutePromptRequest(
|
|
191
|
+
prompt_id=prompt_id,
|
|
192
|
+
execute_prompt=models.ExecutePrompt(
|
|
193
|
+
department=department,
|
|
194
|
+
language_code=language_code,
|
|
195
|
+
replacements=utils.get_pydantic_model(
|
|
196
|
+
replacements, Optional[List[models.Replacement]]
|
|
197
|
+
),
|
|
198
|
+
event_type=event_type,
|
|
199
|
+
client_session_id=client_session_id,
|
|
200
|
+
streaming=streaming,
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
req = self._build_request_async(
|
|
205
|
+
method="POST",
|
|
206
|
+
path="/promptmanager/execute/prompt/{promptId}",
|
|
207
|
+
base_url=base_url,
|
|
208
|
+
url_variables=url_variables,
|
|
209
|
+
request=request,
|
|
210
|
+
request_body_required=False,
|
|
211
|
+
request_has_path_params=True,
|
|
212
|
+
request_has_query_params=True,
|
|
213
|
+
user_agent_header="user-agent",
|
|
214
|
+
accept_header_value="application/json",
|
|
215
|
+
http_headers=http_headers,
|
|
216
|
+
security=self.sdk_configuration.security,
|
|
217
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
218
|
+
request.execute_prompt,
|
|
219
|
+
False,
|
|
220
|
+
True,
|
|
221
|
+
"json",
|
|
222
|
+
Optional[models.ExecutePrompt],
|
|
223
|
+
),
|
|
224
|
+
timeout_ms=timeout_ms,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
if retries == UNSET:
|
|
228
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
229
|
+
retries = self.sdk_configuration.retry_config
|
|
230
|
+
|
|
231
|
+
retry_config = None
|
|
232
|
+
if isinstance(retries, utils.RetryConfig):
|
|
233
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
234
|
+
|
|
235
|
+
http_res = await self.do_request_async(
|
|
236
|
+
hook_ctx=HookContext(
|
|
237
|
+
config=self.sdk_configuration,
|
|
238
|
+
base_url=base_url or "",
|
|
239
|
+
operation_id="executePrompt",
|
|
240
|
+
oauth2_scopes=None,
|
|
241
|
+
security_source=get_security_from_env(
|
|
242
|
+
self.sdk_configuration.security, models.Security
|
|
243
|
+
),
|
|
244
|
+
),
|
|
245
|
+
request=req,
|
|
246
|
+
error_status_codes=[
|
|
247
|
+
"400",
|
|
248
|
+
"401",
|
|
249
|
+
"403",
|
|
250
|
+
"404",
|
|
251
|
+
"429",
|
|
252
|
+
"4XX",
|
|
253
|
+
"500",
|
|
254
|
+
"503",
|
|
255
|
+
"5XX",
|
|
256
|
+
],
|
|
257
|
+
retry_config=retry_config,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
response_data: Any = None
|
|
261
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
262
|
+
return unmarshal_json_response(models.ExecutePromptResponse, http_res)
|
|
263
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
264
|
+
response_data = unmarshal_json_response(
|
|
265
|
+
errors.BadRequestErrorData, http_res
|
|
266
|
+
)
|
|
267
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
268
|
+
if utils.match_response(http_res, ["401", "403", "404", "429", "4XX"], "*"):
|
|
269
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
270
|
+
raise errors.EgainDefaultError(
|
|
271
|
+
"API error occurred", http_res, http_res_text
|
|
272
|
+
)
|
|
273
|
+
if utils.match_response(http_res, ["500", "503", "5XX"], "*"):
|
|
274
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
275
|
+
raise errors.EgainDefaultError(
|
|
276
|
+
"API error occurred", http_res, http_res_text
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
raise errors.EgainDefaultError("Unexpected response received", http_res)
|
egain_api_python/answers.py
CHANGED
|
@@ -15,38 +15,40 @@ class Answers(BaseSDK):
|
|
|
15
15
|
*,
|
|
16
16
|
q: str,
|
|
17
17
|
portal_id: str,
|
|
18
|
+
language: models.RequiredLanguageCode,
|
|
18
19
|
filter_user_profile_id: Optional[str] = None,
|
|
19
|
-
language: Optional[models.LanguageCodeParameter] = None,
|
|
20
20
|
filter_tags: Optional[Dict[str, List[str]]] = None,
|
|
21
21
|
filter_topic_ids: Optional[List[str]] = None,
|
|
22
22
|
channel: Optional[
|
|
23
23
|
Union[models.AnswersRequestChannel, models.AnswersRequestChannelTypedDict]
|
|
24
24
|
] = None,
|
|
25
25
|
event_id: Optional[str] = None,
|
|
26
|
+
client_session_id: Optional[str] = None,
|
|
26
27
|
session_id: Optional[str] = None,
|
|
27
28
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
28
29
|
server_url: Optional[str] = None,
|
|
29
30
|
timeout_ms: Optional[int] = None,
|
|
30
31
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
31
32
|
) -> models.AnswersResponse:
|
|
32
|
-
r"""
|
|
33
|
+
r"""Generate an Answer
|
|
33
34
|
|
|
34
35
|
The **Answers API** allows enterprises to deliver fast, accurate, and contextual responses powered by their organizational knowledge. It supports two complementary approaches:
|
|
35
36
|
- **Certified Answers**: Direct snippets retrieved from enterprise-authored content.
|
|
36
37
|
- **Generative Answers**: Natural language responses synthesized by a large language model (LLM).
|
|
37
38
|
|
|
38
|
-
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
|
39
|
+
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
:param q: The search query string.
|
|
42
|
+
:param q: The search query string.
|
|
42
43
|
:param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
|
|
44
|
+
:param language: The language that describes the details of a resource. Resources available in different languages may differ from each other.
|
|
43
45
|
:param filter_user_profile_id:
|
|
44
|
-
:param
|
|
45
|
-
:param filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category.
|
|
46
|
+
:param filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category. **Note**: - The '$filter[tags]' query parameter JSON value should be url encoded. - Some developer tools for invoking APIs may not url encode the '$filter[tags]' query parameter JSON value by default. Ensure that only url encoded values are used. - Example of JSON value: {\"BASE-40845\":[\"BASE-40849\",\"BASE-40853\"]} - Example of URL encoded value: %7B%22BASE-40845%22%3A%5B%22BASE-40849%22%2C%22BASE-40853%22%5D%7D
|
|
46
47
|
:param filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
|
47
48
|
:param channel:
|
|
48
49
|
:param event_id: Unique ID for this specific API call or event.
|
|
49
|
-
:param
|
|
50
|
+
:param client_session_id: Session ID passed by the client for this specific API call or event.
|
|
51
|
+
:param session_id: eGain Session ID that ties multiple API calls to the same user session. Will be used as part of to tie events back to a session.
|
|
50
52
|
:param retries: Override the default retry configuration for this method
|
|
51
53
|
:param server_url: Override the default server URL for this method
|
|
52
54
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -74,6 +76,7 @@ class Answers(BaseSDK):
|
|
|
74
76
|
channel, Optional[models.AnswersRequestChannel]
|
|
75
77
|
),
|
|
76
78
|
event_id=event_id,
|
|
79
|
+
client_session_id=client_session_id,
|
|
77
80
|
session_id=session_id,
|
|
78
81
|
),
|
|
79
82
|
)
|
|
@@ -144,38 +147,40 @@ class Answers(BaseSDK):
|
|
|
144
147
|
*,
|
|
145
148
|
q: str,
|
|
146
149
|
portal_id: str,
|
|
150
|
+
language: models.RequiredLanguageCode,
|
|
147
151
|
filter_user_profile_id: Optional[str] = None,
|
|
148
|
-
language: Optional[models.LanguageCodeParameter] = None,
|
|
149
152
|
filter_tags: Optional[Dict[str, List[str]]] = None,
|
|
150
153
|
filter_topic_ids: Optional[List[str]] = None,
|
|
151
154
|
channel: Optional[
|
|
152
155
|
Union[models.AnswersRequestChannel, models.AnswersRequestChannelTypedDict]
|
|
153
156
|
] = None,
|
|
154
157
|
event_id: Optional[str] = None,
|
|
158
|
+
client_session_id: Optional[str] = None,
|
|
155
159
|
session_id: Optional[str] = None,
|
|
156
160
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
157
161
|
server_url: Optional[str] = None,
|
|
158
162
|
timeout_ms: Optional[int] = None,
|
|
159
163
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
160
164
|
) -> models.AnswersResponse:
|
|
161
|
-
r"""
|
|
165
|
+
r"""Generate an Answer
|
|
162
166
|
|
|
163
167
|
The **Answers API** allows enterprises to deliver fast, accurate, and contextual responses powered by their organizational knowledge. It supports two complementary approaches:
|
|
164
168
|
- **Certified Answers**: Direct snippets retrieved from enterprise-authored content.
|
|
165
169
|
- **Generative Answers**: Natural language responses synthesized by a large language model (LLM).
|
|
166
170
|
|
|
167
|
-
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
|
171
|
+
Every response includes supporting search results, references, and confidence scores—ensuring transparency, trust, and traceability. The API is built for secure, scalable integration across enterprise environments.
|
|
168
172
|
|
|
169
173
|
|
|
170
|
-
:param q: The search query string.
|
|
174
|
+
:param q: The search query string.
|
|
171
175
|
:param portal_id: The ID of the portal being accessed.<br><br>A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.
|
|
176
|
+
:param language: The language that describes the details of a resource. Resources available in different languages may differ from each other.
|
|
172
177
|
:param filter_user_profile_id:
|
|
173
|
-
:param
|
|
174
|
-
:param filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category.
|
|
178
|
+
:param filter_tags: An object where each key is a **Category Tag ID** (numeric string), and each value is an array of **Tag IDs** for that category. **Note**: - The '$filter[tags]' query parameter JSON value should be url encoded. - Some developer tools for invoking APIs may not url encode the '$filter[tags]' query parameter JSON value by default. Ensure that only url encoded values are used. - Example of JSON value: {\"BASE-40845\":[\"BASE-40849\",\"BASE-40853\"]} - Example of URL encoded value: %7B%22BASE-40845%22%3A%5B%22BASE-40849%22%2C%22BASE-40853%22%5D%7D
|
|
175
179
|
:param filter_topic_ids: An array of topic IDs. It is used to restrict search results to specific topics.
|
|
176
180
|
:param channel:
|
|
177
181
|
:param event_id: Unique ID for this specific API call or event.
|
|
178
|
-
:param
|
|
182
|
+
:param client_session_id: Session ID passed by the client for this specific API call or event.
|
|
183
|
+
:param session_id: eGain Session ID that ties multiple API calls to the same user session. Will be used as part of to tie events back to a session.
|
|
179
184
|
:param retries: Override the default retry configuration for this method
|
|
180
185
|
:param server_url: Override the default server URL for this method
|
|
181
186
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -203,6 +208,7 @@ class Answers(BaseSDK):
|
|
|
203
208
|
channel, Optional[models.AnswersRequestChannel]
|
|
204
209
|
),
|
|
205
210
|
event_id=event_id,
|
|
211
|
+
client_session_id=client_session_id,
|
|
206
212
|
session_id=session_id,
|
|
207
213
|
),
|
|
208
214
|
)
|
egain_api_python/content.py
CHANGED
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from .sdkconfiguration import SDKConfiguration
|
|
5
|
-
from egain_api_python.health import Health
|
|
6
5
|
from egain_api_python.import_ import Import
|
|
7
6
|
from typing import Optional
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class Content(BaseSDK):
|
|
11
10
|
import_: Import
|
|
12
|
-
health: Health
|
|
13
11
|
|
|
14
12
|
def __init__(
|
|
15
13
|
self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
|
|
@@ -20,4 +18,3 @@ class Content(BaseSDK):
|
|
|
20
18
|
|
|
21
19
|
def _init_sdks(self):
|
|
22
20
|
self.import_ = Import(self.sdk_configuration, parent_ref=self.parent_ref)
|
|
23
|
-
self.health = Health(self.sdk_configuration, parent_ref=self.parent_ref)
|
|
@@ -8,29 +8,29 @@ import sys
|
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from .egaindefaulterror import EgainDefaultError
|
|
11
|
-
from .
|
|
11
|
+
from .executepromptop import BadRequestError, BadRequestErrorData
|
|
12
12
|
from .no_response_error import NoResponseError
|
|
13
13
|
from .responsevalidationerror import ResponseValidationError
|
|
14
14
|
from .schemas_wserrorcommon import SchemasWSErrorCommon, SchemasWSErrorCommonData
|
|
15
15
|
from .wserrorcommon import WSErrorCommon, WSErrorCommonData
|
|
16
16
|
|
|
17
17
|
__all__ = [
|
|
18
|
+
"BadRequestError",
|
|
19
|
+
"BadRequestErrorData",
|
|
18
20
|
"EgainDefaultError",
|
|
19
21
|
"EgainError",
|
|
20
22
|
"NoResponseError",
|
|
21
23
|
"ResponseValidationError",
|
|
22
24
|
"SchemasWSErrorCommon",
|
|
23
25
|
"SchemasWSErrorCommonData",
|
|
24
|
-
"ServiceUnavailableError",
|
|
25
|
-
"ServiceUnavailableErrorData",
|
|
26
26
|
"WSErrorCommon",
|
|
27
27
|
"WSErrorCommonData",
|
|
28
28
|
]
|
|
29
29
|
|
|
30
30
|
_dynamic_imports: dict[str, str] = {
|
|
31
31
|
"EgainDefaultError": ".egaindefaulterror",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"BadRequestError": ".executepromptop",
|
|
33
|
+
"BadRequestErrorData": ".executepromptop",
|
|
34
34
|
"NoResponseError": ".no_response_error",
|
|
35
35
|
"ResponseValidationError": ".responsevalidationerror",
|
|
36
36
|
"SchemasWSErrorCommon": ".schemas_wserrorcommon",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from egain_api_python.errors import EgainError
|
|
6
|
+
from egain_api_python.types import BaseModel
|
|
7
|
+
import httpx
|
|
8
|
+
import pydantic
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from typing_extensions import Annotated
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BadRequestErrorData(BaseModel):
|
|
14
|
+
code: Optional[int] = None
|
|
15
|
+
|
|
16
|
+
developer_message: Annotated[
|
|
17
|
+
Optional[str], pydantic.Field(alias="developerMessage")
|
|
18
|
+
] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(unsafe_hash=True)
|
|
22
|
+
class BadRequestError(EgainError):
|
|
23
|
+
r"""Bad Request"""
|
|
24
|
+
|
|
25
|
+
data: BadRequestErrorData = field(hash=False)
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
data: BadRequestErrorData,
|
|
30
|
+
raw_response: httpx.Response,
|
|
31
|
+
body: Optional[str] = None,
|
|
32
|
+
):
|
|
33
|
+
message = body or raw_response.text
|
|
34
|
+
super().__init__(message, raw_response, body)
|
|
35
|
+
object.__setattr__(self, "data", data)
|