falaai-api 1.21.47__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.
- falaai_api/__init__.py +8 -0
- falaai_api/api/__init__.py +1 -0
- falaai_api/api/analysis/__init__.py +1 -0
- falaai_api/api/analysis/create_auditoria_risco_v_1_analyze_auditoria_risco_post.py +298 -0
- falaai_api/api/analysis/create_diagnostic_v1_analyze_diagnostic_post.py +290 -0
- falaai_api/api/email_alerts/__init__.py +1 -0
- falaai_api/api/email_alerts/create_email_alert_v1_email_alerts_post.py +166 -0
- falaai_api/api/email_alerts/delete_email_alert_v1_email_alerts_alert_id_delete.py +161 -0
- falaai_api/api/email_alerts/list_email_alerts_v1_email_alerts_get.py +181 -0
- falaai_api/api/email_alerts/update_email_alert_v1_email_alerts_alert_id_put.py +182 -0
- falaai_api/api/health/__init__.py +1 -0
- falaai_api/api/health/health_check.py +124 -0
- falaai_api/api/health/health_check_head.py +124 -0
- falaai_api/api/speech/__init__.py +1 -0
- falaai_api/api/speech/create_transcription_v1_audio_transcriptions_post.py +304 -0
- falaai_api/api/usage/__init__.py +1 -0
- falaai_api/api/usage/get_usage_by_key_v1_usage_by_key_get.py +176 -0
- falaai_api/api/usage/get_usage_log_v1_usage_log_get.py +201 -0
- falaai_api/api/version/__init__.py +1 -0
- falaai_api/api/version/get_version_api_version_get.py +124 -0
- falaai_api/api/webhooks/__init__.py +1 -0
- falaai_api/api/webhooks/create_webhook_v1_webhooks_post.py +186 -0
- falaai_api/api/webhooks/delete_webhook_v1_webhooks_webhook_id_delete.py +169 -0
- falaai_api/api/webhooks/list_webhooks_v1_webhooks_get.py +193 -0
- falaai_api/api/webhooks/update_webhook_v1_webhooks_webhook_id_put.py +190 -0
- falaai_api/client.py +268 -0
- falaai_api/errors.py +16 -0
- falaai_api/models/__init__.py +149 -0
- falaai_api/models/audio_event.py +93 -0
- falaai_api/models/audio_input_meta.py +93 -0
- falaai_api/models/auditoria_risco_analysis_v2.py +114 -0
- falaai_api/models/auditoria_risco_analysis_v2_final_analysis.py +47 -0
- falaai_api/models/auditoria_risco_analysis_v2_frameworks.py +47 -0
- falaai_api/models/auditoria_risco_analysis_v2_global_metrics.py +47 -0
- falaai_api/models/auditoria_risco_applied_action_v2.py +134 -0
- falaai_api/models/auditoria_risco_audio_event_model_v2.py +94 -0
- falaai_api/models/auditoria_risco_audio_event_model_v2_windows_s.py +47 -0
- falaai_api/models/auditoria_risco_audit_decisions_v2.py +104 -0
- falaai_api/models/auditoria_risco_conversation_scores_v2.py +273 -0
- falaai_api/models/auditoria_risco_detection_item_v2.py +960 -0
- falaai_api/models/auditoria_risco_detection_item_v2_mac_details_item.py +45 -0
- falaai_api/models/auditoria_risco_detections_v2.py +180 -0
- falaai_api/models/auditoria_risco_detections_v2_client_behavior_alerts_item.py +45 -0
- falaai_api/models/auditoria_risco_detections_v2_client_risk_alerts_item.py +45 -0
- falaai_api/models/auditoria_risco_indexer_v2.py +86 -0
- falaai_api/models/auditoria_risco_indexer_v2_suggested_terms_for_bank_item.py +45 -0
- falaai_api/models/auditoria_risco_meta_v2.py +146 -0
- falaai_api/models/auditoria_risco_participant_v2.py +113 -0
- falaai_api/models/auditoria_risco_participants_v2.py +126 -0
- falaai_api/models/auditoria_risco_request.py +229 -0
- falaai_api/models/auditoria_risco_request_call_direction_type_0.py +9 -0
- falaai_api/models/auditoria_risco_scores_v2.py +89 -0
- falaai_api/models/auditoria_risco_scores_v2_per_participant.py +47 -0
- falaai_api/models/auditoria_risco_scoring_explanation_v2.py +84 -0
- falaai_api/models/auditoria_risco_summary_v2.py +373 -0
- falaai_api/models/auditoria_risco_timeline_v2.py +135 -0
- falaai_api/models/auditoria_risco_timeline_v2_audio_events_item.py +45 -0
- falaai_api/models/auditoria_risco_timeline_v2_audio_groups_found_item.py +45 -0
- falaai_api/models/auditoria_risco_timeline_v2_turns_sentiment_item.py +45 -0
- falaai_api/models/auditoria_risco_usage_v2.py +77 -0
- falaai_api/models/auditoria_risco_v2.py +206 -0
- falaai_api/models/auditoria_risco_v2_acoes_i18n.py +47 -0
- falaai_api/models/auditoria_risco_v2_categories_summary.py +47 -0
- falaai_api/models/auditoria_risco_v2_response.py +68 -0
- falaai_api/models/auditoria_risco_verdict_v2.py +198 -0
- falaai_api/models/auditoria_risco_verdict_v2_risk_matrix.py +47 -0
- falaai_api/models/body_create_transcription_v1_audio_transcriptions_post.py +112 -0
- falaai_api/models/create_email_alert_request.py +87 -0
- falaai_api/models/create_webhook_request.py +100 -0
- falaai_api/models/diagnostic_analysis_map.py +127 -0
- falaai_api/models/diagnostic_audio_event.py +143 -0
- falaai_api/models/diagnostic_categorical_analysis.py +107 -0
- falaai_api/models/diagnostic_request.py +135 -0
- falaai_api/models/diagnostic_response.py +124 -0
- falaai_api/models/diagnostic_text_analysis.py +74 -0
- falaai_api/models/diagnostic_usage.py +77 -0
- falaai_api/models/email_alert_item.py +117 -0
- falaai_api/models/email_alert_list_response.py +91 -0
- falaai_api/models/email_alert_message_response.py +61 -0
- falaai_api/models/email_event.py +16 -0
- falaai_api/models/health_response.py +101 -0
- falaai_api/models/http_validation_error.py +79 -0
- falaai_api/models/message_response.py +61 -0
- falaai_api/models/participant.py +93 -0
- falaai_api/models/participant_diagnostic.py +132 -0
- falaai_api/models/participant_role.py +10 -0
- falaai_api/models/transcription_response.py +234 -0
- falaai_api/models/transcription_usage.py +77 -0
- falaai_api/models/update_email_alert_request.py +153 -0
- falaai_api/models/update_webhook_request.py +173 -0
- falaai_api/models/usage_by_key_item.py +107 -0
- falaai_api/models/usage_log_item.py +101 -0
- falaai_api/models/usage_log_response.py +91 -0
- falaai_api/models/validation_error.py +123 -0
- falaai_api/models/validation_error_context.py +45 -0
- falaai_api/models/version_response.py +77 -0
- falaai_api/models/webhook_event.py +17 -0
- falaai_api/models/webhook_item.py +184 -0
- falaai_api/models/webhook_list_response.py +91 -0
- falaai_api/py.typed +1 -0
- falaai_api/types.py +54 -0
- falaai_api-1.21.47.dist-info/METADATA +145 -0
- falaai_api-1.21.47.dist-info/RECORD +115 -0
- falaai_api-1.21.47.dist-info/WHEEL +5 -0
- falaai_api-1.21.47.dist-info/licenses/LICENSE +21 -0
- falaai_api-1.21.47.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/e2e/__init__.py +0 -0
- tests/e2e/conftest.py +40 -0
- tests/e2e/e2e_logger.py +42 -0
- tests/e2e/test_ai.py +108 -0
- tests/e2e/test_contract.py +64 -0
- tests/e2e/test_errors.py +56 -0
- tests/e2e/test_read.py +100 -0
- tests/e2e/test_write.py +121 -0
falaai_api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.auditoria_risco_request import AuditoriaRiscoRequest
|
|
9
|
+
from ...models.auditoria_risco_v2_response import AuditoriaRiscoV2Response
|
|
10
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: AuditoriaRiscoRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/analyze/auditoriaRisco",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> AuditoriaRiscoV2Response | HTTPValidationError | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = AuditoriaRiscoV2Response.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 422:
|
|
42
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_422
|
|
45
|
+
|
|
46
|
+
if client.raise_on_unexpected_status:
|
|
47
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
48
|
+
else:
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _build_response(
|
|
53
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
54
|
+
) -> Response[AuditoriaRiscoV2Response | HTTPValidationError]:
|
|
55
|
+
return Response(
|
|
56
|
+
status_code=HTTPStatus(response.status_code),
|
|
57
|
+
content=response.content,
|
|
58
|
+
headers=response.headers,
|
|
59
|
+
parsed=_parse_response(client=client, response=response),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def sync_detailed(
|
|
64
|
+
*,
|
|
65
|
+
client: AuthenticatedClient | Client,
|
|
66
|
+
body: AuditoriaRiscoRequest,
|
|
67
|
+
) -> Response[AuditoriaRiscoV2Response | HTTPValidationError]:
|
|
68
|
+
""" Compliance Risk Audit — conversation compliance analysis
|
|
69
|
+
|
|
70
|
+
Analyzes a call transcript for compliance risks. Returns a score (0-100), classification level,
|
|
71
|
+
violations, positives, and a detailed HTML report.
|
|
72
|
+
|
|
73
|
+
**Python:**
|
|
74
|
+
```python
|
|
75
|
+
import httpx
|
|
76
|
+
|
|
77
|
+
response = httpx.post(
|
|
78
|
+
'https://api.fala.ai/v1/analyze/auditoriaRisco',
|
|
79
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
80
|
+
json={
|
|
81
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
82
|
+
'duration_seconds': 151.0,
|
|
83
|
+
'language': 'pt-BR',
|
|
84
|
+
'response_language': 'en-US'
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
print(response.json())
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**cURL:**
|
|
91
|
+
```bash
|
|
92
|
+
curl https://api.fala.ai/v1/analyze/auditoriaRisco \\
|
|
93
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
94
|
+
-H 'Content-Type: application/json' \\
|
|
95
|
+
-d '{
|
|
96
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
97
|
+
"duration_seconds": 151.0,
|
|
98
|
+
"language": "pt-BR",
|
|
99
|
+
"response_language": "en-US"
|
|
100
|
+
}'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
body (AuditoriaRiscoRequest):
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
108
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Response[AuditoriaRiscoV2Response | HTTPValidationError]
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
kwargs = _get_kwargs(
|
|
115
|
+
body=body,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
response = client.get_httpx_client().request(
|
|
119
|
+
**kwargs,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
return _build_response(client=client, response=response)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def sync(
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient | Client,
|
|
128
|
+
body: AuditoriaRiscoRequest,
|
|
129
|
+
) -> AuditoriaRiscoV2Response | HTTPValidationError | None:
|
|
130
|
+
""" Compliance Risk Audit — conversation compliance analysis
|
|
131
|
+
|
|
132
|
+
Analyzes a call transcript for compliance risks. Returns a score (0-100), classification level,
|
|
133
|
+
violations, positives, and a detailed HTML report.
|
|
134
|
+
|
|
135
|
+
**Python:**
|
|
136
|
+
```python
|
|
137
|
+
import httpx
|
|
138
|
+
|
|
139
|
+
response = httpx.post(
|
|
140
|
+
'https://api.fala.ai/v1/analyze/auditoriaRisco',
|
|
141
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
142
|
+
json={
|
|
143
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
144
|
+
'duration_seconds': 151.0,
|
|
145
|
+
'language': 'pt-BR',
|
|
146
|
+
'response_language': 'en-US'
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
print(response.json())
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**cURL:**
|
|
153
|
+
```bash
|
|
154
|
+
curl https://api.fala.ai/v1/analyze/auditoriaRisco \\
|
|
155
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
156
|
+
-H 'Content-Type: application/json' \\
|
|
157
|
+
-d '{
|
|
158
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
159
|
+
"duration_seconds": 151.0,
|
|
160
|
+
"language": "pt-BR",
|
|
161
|
+
"response_language": "en-US"
|
|
162
|
+
}'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
body (AuditoriaRiscoRequest):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
AuditoriaRiscoV2Response | HTTPValidationError
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
return sync_detailed(
|
|
177
|
+
client=client,
|
|
178
|
+
body=body,
|
|
179
|
+
).parsed
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
async def asyncio_detailed(
|
|
183
|
+
*,
|
|
184
|
+
client: AuthenticatedClient | Client,
|
|
185
|
+
body: AuditoriaRiscoRequest,
|
|
186
|
+
) -> Response[AuditoriaRiscoV2Response | HTTPValidationError]:
|
|
187
|
+
""" Compliance Risk Audit — conversation compliance analysis
|
|
188
|
+
|
|
189
|
+
Analyzes a call transcript for compliance risks. Returns a score (0-100), classification level,
|
|
190
|
+
violations, positives, and a detailed HTML report.
|
|
191
|
+
|
|
192
|
+
**Python:**
|
|
193
|
+
```python
|
|
194
|
+
import httpx
|
|
195
|
+
|
|
196
|
+
response = httpx.post(
|
|
197
|
+
'https://api.fala.ai/v1/analyze/auditoriaRisco',
|
|
198
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
199
|
+
json={
|
|
200
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
201
|
+
'duration_seconds': 151.0,
|
|
202
|
+
'language': 'pt-BR',
|
|
203
|
+
'response_language': 'en-US'
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
print(response.json())
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**cURL:**
|
|
210
|
+
```bash
|
|
211
|
+
curl https://api.fala.ai/v1/analyze/auditoriaRisco \\
|
|
212
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
213
|
+
-H 'Content-Type: application/json' \\
|
|
214
|
+
-d '{
|
|
215
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
216
|
+
"duration_seconds": 151.0,
|
|
217
|
+
"language": "pt-BR",
|
|
218
|
+
"response_language": "en-US"
|
|
219
|
+
}'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
body (AuditoriaRiscoRequest):
|
|
224
|
+
|
|
225
|
+
Raises:
|
|
226
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
227
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
Response[AuditoriaRiscoV2Response | HTTPValidationError]
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
kwargs = _get_kwargs(
|
|
234
|
+
body=body,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
238
|
+
|
|
239
|
+
return _build_response(client=client, response=response)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
async def asyncio(
|
|
243
|
+
*,
|
|
244
|
+
client: AuthenticatedClient | Client,
|
|
245
|
+
body: AuditoriaRiscoRequest,
|
|
246
|
+
) -> AuditoriaRiscoV2Response | HTTPValidationError | None:
|
|
247
|
+
""" Compliance Risk Audit — conversation compliance analysis
|
|
248
|
+
|
|
249
|
+
Analyzes a call transcript for compliance risks. Returns a score (0-100), classification level,
|
|
250
|
+
violations, positives, and a detailed HTML report.
|
|
251
|
+
|
|
252
|
+
**Python:**
|
|
253
|
+
```python
|
|
254
|
+
import httpx
|
|
255
|
+
|
|
256
|
+
response = httpx.post(
|
|
257
|
+
'https://api.fala.ai/v1/analyze/auditoriaRisco',
|
|
258
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
259
|
+
json={
|
|
260
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
261
|
+
'duration_seconds': 151.0,
|
|
262
|
+
'language': 'pt-BR',
|
|
263
|
+
'response_language': 'en-US'
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
print(response.json())
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**cURL:**
|
|
270
|
+
```bash
|
|
271
|
+
curl https://api.fala.ai/v1/analyze/auditoriaRisco \\
|
|
272
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
273
|
+
-H 'Content-Type: application/json' \\
|
|
274
|
+
-d '{
|
|
275
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
276
|
+
"duration_seconds": 151.0,
|
|
277
|
+
"language": "pt-BR",
|
|
278
|
+
"response_language": "en-US"
|
|
279
|
+
}'
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Args:
|
|
283
|
+
body (AuditoriaRiscoRequest):
|
|
284
|
+
|
|
285
|
+
Raises:
|
|
286
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
287
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
AuditoriaRiscoV2Response | HTTPValidationError
|
|
291
|
+
"""
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
await asyncio_detailed(
|
|
295
|
+
client=client,
|
|
296
|
+
body=body,
|
|
297
|
+
)
|
|
298
|
+
).parsed
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.diagnostic_request import DiagnosticRequest
|
|
9
|
+
from ...models.diagnostic_response import DiagnosticResponse
|
|
10
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: DiagnosticRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/analyze/diagnostic",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> DiagnosticResponse | HTTPValidationError | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = DiagnosticResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 422:
|
|
42
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_422
|
|
45
|
+
|
|
46
|
+
if client.raise_on_unexpected_status:
|
|
47
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
48
|
+
else:
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _build_response(
|
|
53
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
54
|
+
) -> Response[DiagnosticResponse | HTTPValidationError]:
|
|
55
|
+
return Response(
|
|
56
|
+
status_code=HTTPStatus(response.status_code),
|
|
57
|
+
content=response.content,
|
|
58
|
+
headers=response.headers,
|
|
59
|
+
parsed=_parse_response(client=client, response=response),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def sync_detailed(
|
|
64
|
+
*,
|
|
65
|
+
client: AuthenticatedClient | Client,
|
|
66
|
+
body: DiagnosticRequest,
|
|
67
|
+
) -> Response[DiagnosticResponse | HTTPValidationError]:
|
|
68
|
+
""" Analyze a call transcript — 5 parallel analyses
|
|
69
|
+
|
|
70
|
+
Runs 5 independent analyses on a call transcript: dialogue summary, contact reason, identified
|
|
71
|
+
action, label classification, and sentiment.
|
|
72
|
+
|
|
73
|
+
**Python:**
|
|
74
|
+
```python
|
|
75
|
+
import httpx
|
|
76
|
+
|
|
77
|
+
response = httpx.post(
|
|
78
|
+
'https://api.fala.ai/v1/analyze/diagnostic',
|
|
79
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
80
|
+
json={
|
|
81
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
82
|
+
'language': 'pt-BR',
|
|
83
|
+
'duration_seconds': 151.0
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
print(response.json())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**cURL:**
|
|
90
|
+
```bash
|
|
91
|
+
curl https://api.fala.ai/v1/analyze/diagnostic \\
|
|
92
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
93
|
+
-H 'Content-Type: application/json' \\
|
|
94
|
+
-d '{
|
|
95
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
96
|
+
"language": "pt-BR",
|
|
97
|
+
"duration_seconds": 151.0
|
|
98
|
+
}'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
body (DiagnosticRequest):
|
|
103
|
+
|
|
104
|
+
Raises:
|
|
105
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
106
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Response[DiagnosticResponse | HTTPValidationError]
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
kwargs = _get_kwargs(
|
|
113
|
+
body=body,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
response = client.get_httpx_client().request(
|
|
117
|
+
**kwargs,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return _build_response(client=client, response=response)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def sync(
|
|
124
|
+
*,
|
|
125
|
+
client: AuthenticatedClient | Client,
|
|
126
|
+
body: DiagnosticRequest,
|
|
127
|
+
) -> DiagnosticResponse | HTTPValidationError | None:
|
|
128
|
+
""" Analyze a call transcript — 5 parallel analyses
|
|
129
|
+
|
|
130
|
+
Runs 5 independent analyses on a call transcript: dialogue summary, contact reason, identified
|
|
131
|
+
action, label classification, and sentiment.
|
|
132
|
+
|
|
133
|
+
**Python:**
|
|
134
|
+
```python
|
|
135
|
+
import httpx
|
|
136
|
+
|
|
137
|
+
response = httpx.post(
|
|
138
|
+
'https://api.fala.ai/v1/analyze/diagnostic',
|
|
139
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
140
|
+
json={
|
|
141
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
142
|
+
'language': 'pt-BR',
|
|
143
|
+
'duration_seconds': 151.0
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
print(response.json())
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**cURL:**
|
|
150
|
+
```bash
|
|
151
|
+
curl https://api.fala.ai/v1/analyze/diagnostic \\
|
|
152
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
153
|
+
-H 'Content-Type: application/json' \\
|
|
154
|
+
-d '{
|
|
155
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
156
|
+
"language": "pt-BR",
|
|
157
|
+
"duration_seconds": 151.0
|
|
158
|
+
}'
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
body (DiagnosticRequest):
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
166
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
DiagnosticResponse | HTTPValidationError
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
return sync_detailed(
|
|
173
|
+
client=client,
|
|
174
|
+
body=body,
|
|
175
|
+
).parsed
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
async def asyncio_detailed(
|
|
179
|
+
*,
|
|
180
|
+
client: AuthenticatedClient | Client,
|
|
181
|
+
body: DiagnosticRequest,
|
|
182
|
+
) -> Response[DiagnosticResponse | HTTPValidationError]:
|
|
183
|
+
""" Analyze a call transcript — 5 parallel analyses
|
|
184
|
+
|
|
185
|
+
Runs 5 independent analyses on a call transcript: dialogue summary, contact reason, identified
|
|
186
|
+
action, label classification, and sentiment.
|
|
187
|
+
|
|
188
|
+
**Python:**
|
|
189
|
+
```python
|
|
190
|
+
import httpx
|
|
191
|
+
|
|
192
|
+
response = httpx.post(
|
|
193
|
+
'https://api.fala.ai/v1/analyze/diagnostic',
|
|
194
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
195
|
+
json={
|
|
196
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
197
|
+
'language': 'pt-BR',
|
|
198
|
+
'duration_seconds': 151.0
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
print(response.json())
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**cURL:**
|
|
205
|
+
```bash
|
|
206
|
+
curl https://api.fala.ai/v1/analyze/diagnostic \\
|
|
207
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
208
|
+
-H 'Content-Type: application/json' \\
|
|
209
|
+
-d '{
|
|
210
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
211
|
+
"language": "pt-BR",
|
|
212
|
+
"duration_seconds": 151.0
|
|
213
|
+
}'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
body (DiagnosticRequest):
|
|
218
|
+
|
|
219
|
+
Raises:
|
|
220
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
221
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
Response[DiagnosticResponse | HTTPValidationError]
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
kwargs = _get_kwargs(
|
|
228
|
+
body=body,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
232
|
+
|
|
233
|
+
return _build_response(client=client, response=response)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
async def asyncio(
|
|
237
|
+
*,
|
|
238
|
+
client: AuthenticatedClient | Client,
|
|
239
|
+
body: DiagnosticRequest,
|
|
240
|
+
) -> DiagnosticResponse | HTTPValidationError | None:
|
|
241
|
+
""" Analyze a call transcript — 5 parallel analyses
|
|
242
|
+
|
|
243
|
+
Runs 5 independent analyses on a call transcript: dialogue summary, contact reason, identified
|
|
244
|
+
action, label classification, and sentiment.
|
|
245
|
+
|
|
246
|
+
**Python:**
|
|
247
|
+
```python
|
|
248
|
+
import httpx
|
|
249
|
+
|
|
250
|
+
response = httpx.post(
|
|
251
|
+
'https://api.fala.ai/v1/analyze/diagnostic',
|
|
252
|
+
headers={'Authorization': 'Bearer fai_xxx'},
|
|
253
|
+
json={
|
|
254
|
+
'dialog': 'Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.',
|
|
255
|
+
'language': 'pt-BR',
|
|
256
|
+
'duration_seconds': 151.0
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
print(response.json())
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**cURL:**
|
|
263
|
+
```bash
|
|
264
|
+
curl https://api.fala.ai/v1/analyze/diagnostic \\
|
|
265
|
+
-H 'Authorization: Bearer fai_xxx' \\
|
|
266
|
+
-H 'Content-Type: application/json' \\
|
|
267
|
+
-d '{
|
|
268
|
+
"dialog": "Speaker 1: [00:00:00.540 - 00:00:01.139] Hi, Alex.",
|
|
269
|
+
"language": "pt-BR",
|
|
270
|
+
"duration_seconds": 151.0
|
|
271
|
+
}'
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
body (DiagnosticRequest):
|
|
276
|
+
|
|
277
|
+
Raises:
|
|
278
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
279
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
DiagnosticResponse | HTTPValidationError
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
return (
|
|
286
|
+
await asyncio_detailed(
|
|
287
|
+
client=client,
|
|
288
|
+
body=body,
|
|
289
|
+
)
|
|
290
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|