falaai-api 1.21.47__tar.gz
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-1.21.47/LICENSE +21 -0
- falaai_api-1.21.47/PKG-INFO +145 -0
- falaai_api-1.21.47/README.md +110 -0
- falaai_api-1.21.47/falaai_api/__init__.py +8 -0
- falaai_api-1.21.47/falaai_api/api/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/analysis/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/analysis/create_auditoria_risco_v_1_analyze_auditoria_risco_post.py +298 -0
- falaai_api-1.21.47/falaai_api/api/analysis/create_diagnostic_v1_analyze_diagnostic_post.py +290 -0
- falaai_api-1.21.47/falaai_api/api/email_alerts/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/email_alerts/create_email_alert_v1_email_alerts_post.py +166 -0
- falaai_api-1.21.47/falaai_api/api/email_alerts/delete_email_alert_v1_email_alerts_alert_id_delete.py +161 -0
- falaai_api-1.21.47/falaai_api/api/email_alerts/list_email_alerts_v1_email_alerts_get.py +181 -0
- falaai_api-1.21.47/falaai_api/api/email_alerts/update_email_alert_v1_email_alerts_alert_id_put.py +182 -0
- falaai_api-1.21.47/falaai_api/api/health/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/health/health_check.py +124 -0
- falaai_api-1.21.47/falaai_api/api/health/health_check_head.py +124 -0
- falaai_api-1.21.47/falaai_api/api/speech/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/speech/create_transcription_v1_audio_transcriptions_post.py +304 -0
- falaai_api-1.21.47/falaai_api/api/usage/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/usage/get_usage_by_key_v1_usage_by_key_get.py +176 -0
- falaai_api-1.21.47/falaai_api/api/usage/get_usage_log_v1_usage_log_get.py +201 -0
- falaai_api-1.21.47/falaai_api/api/version/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/version/get_version_api_version_get.py +124 -0
- falaai_api-1.21.47/falaai_api/api/webhooks/__init__.py +1 -0
- falaai_api-1.21.47/falaai_api/api/webhooks/create_webhook_v1_webhooks_post.py +186 -0
- falaai_api-1.21.47/falaai_api/api/webhooks/delete_webhook_v1_webhooks_webhook_id_delete.py +169 -0
- falaai_api-1.21.47/falaai_api/api/webhooks/list_webhooks_v1_webhooks_get.py +193 -0
- falaai_api-1.21.47/falaai_api/api/webhooks/update_webhook_v1_webhooks_webhook_id_put.py +190 -0
- falaai_api-1.21.47/falaai_api/client.py +268 -0
- falaai_api-1.21.47/falaai_api/errors.py +16 -0
- falaai_api-1.21.47/falaai_api/models/__init__.py +149 -0
- falaai_api-1.21.47/falaai_api/models/audio_event.py +93 -0
- falaai_api-1.21.47/falaai_api/models/audio_input_meta.py +93 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_analysis_v2.py +114 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_analysis_v2_final_analysis.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_analysis_v2_frameworks.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_analysis_v2_global_metrics.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_applied_action_v2.py +134 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_audio_event_model_v2.py +94 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_audio_event_model_v2_windows_s.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_audit_decisions_v2.py +104 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_conversation_scores_v2.py +273 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_detection_item_v2.py +960 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_detection_item_v2_mac_details_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_detections_v2.py +180 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_detections_v2_client_behavior_alerts_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_detections_v2_client_risk_alerts_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_indexer_v2.py +86 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_indexer_v2_suggested_terms_for_bank_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_meta_v2.py +146 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_participant_v2.py +113 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_participants_v2.py +126 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_request.py +229 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_request_call_direction_type_0.py +9 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_scores_v2.py +89 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_scores_v2_per_participant.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_scoring_explanation_v2.py +84 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_summary_v2.py +373 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_timeline_v2.py +135 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_timeline_v2_audio_events_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_timeline_v2_audio_groups_found_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_timeline_v2_turns_sentiment_item.py +45 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_usage_v2.py +77 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_v2.py +206 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_v2_acoes_i18n.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_v2_categories_summary.py +47 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_v2_response.py +68 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_verdict_v2.py +198 -0
- falaai_api-1.21.47/falaai_api/models/auditoria_risco_verdict_v2_risk_matrix.py +47 -0
- falaai_api-1.21.47/falaai_api/models/body_create_transcription_v1_audio_transcriptions_post.py +112 -0
- falaai_api-1.21.47/falaai_api/models/create_email_alert_request.py +87 -0
- falaai_api-1.21.47/falaai_api/models/create_webhook_request.py +100 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_analysis_map.py +127 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_audio_event.py +143 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_categorical_analysis.py +107 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_request.py +135 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_response.py +124 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_text_analysis.py +74 -0
- falaai_api-1.21.47/falaai_api/models/diagnostic_usage.py +77 -0
- falaai_api-1.21.47/falaai_api/models/email_alert_item.py +117 -0
- falaai_api-1.21.47/falaai_api/models/email_alert_list_response.py +91 -0
- falaai_api-1.21.47/falaai_api/models/email_alert_message_response.py +61 -0
- falaai_api-1.21.47/falaai_api/models/email_event.py +16 -0
- falaai_api-1.21.47/falaai_api/models/health_response.py +101 -0
- falaai_api-1.21.47/falaai_api/models/http_validation_error.py +79 -0
- falaai_api-1.21.47/falaai_api/models/message_response.py +61 -0
- falaai_api-1.21.47/falaai_api/models/participant.py +93 -0
- falaai_api-1.21.47/falaai_api/models/participant_diagnostic.py +132 -0
- falaai_api-1.21.47/falaai_api/models/participant_role.py +10 -0
- falaai_api-1.21.47/falaai_api/models/transcription_response.py +234 -0
- falaai_api-1.21.47/falaai_api/models/transcription_usage.py +77 -0
- falaai_api-1.21.47/falaai_api/models/update_email_alert_request.py +153 -0
- falaai_api-1.21.47/falaai_api/models/update_webhook_request.py +173 -0
- falaai_api-1.21.47/falaai_api/models/usage_by_key_item.py +107 -0
- falaai_api-1.21.47/falaai_api/models/usage_log_item.py +101 -0
- falaai_api-1.21.47/falaai_api/models/usage_log_response.py +91 -0
- falaai_api-1.21.47/falaai_api/models/validation_error.py +123 -0
- falaai_api-1.21.47/falaai_api/models/validation_error_context.py +45 -0
- falaai_api-1.21.47/falaai_api/models/version_response.py +77 -0
- falaai_api-1.21.47/falaai_api/models/webhook_event.py +17 -0
- falaai_api-1.21.47/falaai_api/models/webhook_item.py +184 -0
- falaai_api-1.21.47/falaai_api/models/webhook_list_response.py +91 -0
- falaai_api-1.21.47/falaai_api/py.typed +1 -0
- falaai_api-1.21.47/falaai_api/types.py +54 -0
- falaai_api-1.21.47/falaai_api.egg-info/PKG-INFO +145 -0
- falaai_api-1.21.47/falaai_api.egg-info/SOURCES.txt +119 -0
- falaai_api-1.21.47/falaai_api.egg-info/dependency_links.txt +1 -0
- falaai_api-1.21.47/falaai_api.egg-info/requires.txt +2 -0
- falaai_api-1.21.47/falaai_api.egg-info/top_level.txt +2 -0
- falaai_api-1.21.47/pyproject.toml +6 -0
- falaai_api-1.21.47/setup.cfg +4 -0
- falaai_api-1.21.47/setup.py +34 -0
- falaai_api-1.21.47/tests/__init__.py +0 -0
- falaai_api-1.21.47/tests/e2e/__init__.py +0 -0
- falaai_api-1.21.47/tests/e2e/conftest.py +40 -0
- falaai_api-1.21.47/tests/e2e/e2e_logger.py +42 -0
- falaai_api-1.21.47/tests/e2e/test_ai.py +108 -0
- falaai_api-1.21.47/tests/e2e/test_contract.py +64 -0
- falaai_api-1.21.47/tests/e2e/test_errors.py +56 -0
- falaai_api-1.21.47/tests/e2e/test_read.py +100 -0
- falaai_api-1.21.47/tests/e2e/test_write.py +121 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Action Tec Br
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: falaai-api
|
|
3
|
+
Version: 1.21.47
|
|
4
|
+
Summary: Official Python SDK for the FalaAI API - AI-powered call transcription, diagnosis and compliance auditing.
|
|
5
|
+
Home-page: https://falaai.action.tec.br/api
|
|
6
|
+
Author: Action Tec Br
|
|
7
|
+
Author-email: livio@action.tec.br
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://falaai.action.tec.br/api
|
|
10
|
+
Project-URL: Repository, https://github.com/ActionTecBr/falaai-api
|
|
11
|
+
Project-URL: Issues, https://github.com/ActionTecBr/falaai-api/issues
|
|
12
|
+
Keywords: falaai,api,sdk,compliance,call-audit,speech-to-text,transcription
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Requires-Python: >=3.11, <4
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: httpx<0.29.0,>=0.23.1
|
|
21
|
+
Requires-Dist: attrs>=22.2.0
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: keywords
|
|
29
|
+
Dynamic: license
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: project-url
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
Dynamic: summary
|
|
35
|
+
|
|
36
|
+
# falaai-api
|
|
37
|
+
A client library for accessing FalaAI API
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
First, create a client:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from falaai_api import Client
|
|
44
|
+
|
|
45
|
+
client = Client(base_url="https://api.example.com")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from falaai_api import AuthenticatedClient
|
|
52
|
+
|
|
53
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Now call your endpoint and use your models:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from falaai_api.models import MyDataModel
|
|
60
|
+
from falaai_api.api.my_tag import get_my_data_model
|
|
61
|
+
from falaai_api.types import Response
|
|
62
|
+
|
|
63
|
+
with client as client:
|
|
64
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
65
|
+
# or if you need more info (e.g. status_code)
|
|
66
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or do the same thing with an async version:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from falaai_api.models import MyDataModel
|
|
73
|
+
from falaai_api.api.my_tag import get_my_data_model
|
|
74
|
+
from falaai_api.types import Response
|
|
75
|
+
|
|
76
|
+
async with client as client:
|
|
77
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
78
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
client = AuthenticatedClient(
|
|
85
|
+
base_url="https://internal_api.example.com",
|
|
86
|
+
token="SuperSecretToken",
|
|
87
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
client = AuthenticatedClient(base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl=False)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Things to know:
|
|
98
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
99
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
100
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
101
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
102
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
103
|
+
|
|
104
|
+
1. All path/query params, and bodies become method arguments.
|
|
105
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
106
|
+
1. Any endpoint which did not have a tag will be in `falaai_api.api.default`
|
|
107
|
+
|
|
108
|
+
## Advanced customizations
|
|
109
|
+
|
|
110
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from falaai_api import Client
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def log_request(request):
|
|
117
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def log_response(response):
|
|
121
|
+
request = response.request
|
|
122
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
client = Client(
|
|
126
|
+
base_url="https://api.example.com",
|
|
127
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import httpx
|
|
137
|
+
from falaai_api import Client
|
|
138
|
+
|
|
139
|
+
client = Client(
|
|
140
|
+
base_url="https://api.example.com",
|
|
141
|
+
)
|
|
142
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
143
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
144
|
+
```
|
|
145
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# falaai-api
|
|
2
|
+
A client library for accessing FalaAI API
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
First, create a client:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from falaai_api import Client
|
|
9
|
+
|
|
10
|
+
client = Client(base_url="https://api.example.com")
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from falaai_api import AuthenticatedClient
|
|
17
|
+
|
|
18
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now call your endpoint and use your models:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from falaai_api.models import MyDataModel
|
|
25
|
+
from falaai_api.api.my_tag import get_my_data_model
|
|
26
|
+
from falaai_api.types import Response
|
|
27
|
+
|
|
28
|
+
with client as client:
|
|
29
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
30
|
+
# or if you need more info (e.g. status_code)
|
|
31
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or do the same thing with an async version:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from falaai_api.models import MyDataModel
|
|
38
|
+
from falaai_api.api.my_tag import get_my_data_model
|
|
39
|
+
from falaai_api.types import Response
|
|
40
|
+
|
|
41
|
+
async with client as client:
|
|
42
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
43
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = AuthenticatedClient(
|
|
50
|
+
base_url="https://internal_api.example.com",
|
|
51
|
+
token="SuperSecretToken",
|
|
52
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
client = AuthenticatedClient(base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl=False)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Things to know:
|
|
63
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
64
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
65
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
66
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
67
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
68
|
+
|
|
69
|
+
1. All path/query params, and bodies become method arguments.
|
|
70
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
71
|
+
1. Any endpoint which did not have a tag will be in `falaai_api.api.default`
|
|
72
|
+
|
|
73
|
+
## Advanced customizations
|
|
74
|
+
|
|
75
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from falaai_api import Client
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def log_request(request):
|
|
82
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def log_response(response):
|
|
86
|
+
request = response.request
|
|
87
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
client = Client(
|
|
91
|
+
base_url="https://api.example.com",
|
|
92
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
import httpx
|
|
102
|
+
from falaai_api import Client
|
|
103
|
+
|
|
104
|
+
client = Client(
|
|
105
|
+
base_url="https://api.example.com",
|
|
106
|
+
)
|
|
107
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
108
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
109
|
+
```
|
|
110
|
+
|
|
@@ -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
|