falaai-api 1.21.47

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.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +205 -0
  4. data/docs/AnalysisApi.md +147 -0
  5. data/docs/AudioEvent.md +26 -0
  6. data/docs/AudioInputMeta.md +26 -0
  7. data/docs/AuditoriaRiscoAnalysisV2.md +22 -0
  8. data/docs/AuditoriaRiscoAppliedActionV2.md +32 -0
  9. data/docs/AuditoriaRiscoAudioEventModelV2.md +22 -0
  10. data/docs/AuditoriaRiscoAuditDecisionsV2.md +22 -0
  11. data/docs/AuditoriaRiscoConversationScoresV2.md +38 -0
  12. data/docs/AuditoriaRiscoDetectionItemV2.md +110 -0
  13. data/docs/AuditoriaRiscoDetectionsV2.md +26 -0
  14. data/docs/AuditoriaRiscoIndexerV2.md +18 -0
  15. data/docs/AuditoriaRiscoMetaV2.md +28 -0
  16. data/docs/AuditoriaRiscoParticipantV2.md +22 -0
  17. data/docs/AuditoriaRiscoParticipantsV2.md +26 -0
  18. data/docs/AuditoriaRiscoRequest.md +38 -0
  19. data/docs/AuditoriaRiscoScoresV2.md +20 -0
  20. data/docs/AuditoriaRiscoScoringExplanationV2.md +20 -0
  21. data/docs/AuditoriaRiscoSummaryV2.md +48 -0
  22. data/docs/AuditoriaRiscoTimelineV2.md +22 -0
  23. data/docs/AuditoriaRiscoUsageV2.md +22 -0
  24. data/docs/AuditoriaRiscoV2.md +46 -0
  25. data/docs/AuditoriaRiscoV2Response.md +18 -0
  26. data/docs/AuditoriaRiscoVerdictV2.md +30 -0
  27. data/docs/CreateEmailAlertRequest.md +22 -0
  28. data/docs/CreateWebhookRequest.md +24 -0
  29. data/docs/DiagnosticAnalysisMap.md +28 -0
  30. data/docs/DiagnosticAudioEvent.md +26 -0
  31. data/docs/DiagnosticCategoricalAnalysis.md +22 -0
  32. data/docs/DiagnosticRequest.md +30 -0
  33. data/docs/DiagnosticResponse.md +28 -0
  34. data/docs/DiagnosticTextAnalysis.md +18 -0
  35. data/docs/DiagnosticUsage.md +22 -0
  36. data/docs/EmailAlertItem.md +32 -0
  37. data/docs/EmailAlertListResponse.md +22 -0
  38. data/docs/EmailAlertMessageResponse.md +18 -0
  39. data/docs/EmailAlertsApi.md +285 -0
  40. data/docs/EmailEvent.md +15 -0
  41. data/docs/HTTPValidationError.md +18 -0
  42. data/docs/HealthApi.md +137 -0
  43. data/docs/HealthResponse.md +28 -0
  44. data/docs/LocationInner.md +15 -0
  45. data/docs/MessageResponse.md +18 -0
  46. data/docs/Participant.md +22 -0
  47. data/docs/ParticipantDiagnostic.md +26 -0
  48. data/docs/SpeechApi.md +85 -0
  49. data/docs/TranscriptionResponse.md +49 -0
  50. data/docs/TranscriptionUsage.md +22 -0
  51. data/docs/UpdateEmailAlertRequest.md +24 -0
  52. data/docs/UpdateWebhookRequest.md +26 -0
  53. data/docs/UsageApi.md +151 -0
  54. data/docs/UsageByKeyItem.md +26 -0
  55. data/docs/UsageLogItem.md +28 -0
  56. data/docs/UsageLogResponse.md +22 -0
  57. data/docs/ValidationError.md +26 -0
  58. data/docs/VersionApi.md +72 -0
  59. data/docs/VersionResponse.md +22 -0
  60. data/docs/WebhookEvent.md +15 -0
  61. data/docs/WebhookItem.md +42 -0
  62. data/docs/WebhookListResponse.md +22 -0
  63. data/docs/WebhooksApi.md +293 -0
  64. data/lib/falaai-api/api/analysis_api.rb +158 -0
  65. data/lib/falaai-api/api/email_alerts_api.rb +294 -0
  66. data/lib/falaai-api/api/health_api.rb +132 -0
  67. data/lib/falaai-api/api/speech_api.rb +100 -0
  68. data/lib/falaai-api/api/usage_api.rb +156 -0
  69. data/lib/falaai-api/api/version_api.rb +77 -0
  70. data/lib/falaai-api/api/webhooks_api.rb +302 -0
  71. data/lib/falaai-api/api_client.rb +397 -0
  72. data/lib/falaai-api/api_error.rb +58 -0
  73. data/lib/falaai-api/api_model_base.rb +88 -0
  74. data/lib/falaai-api/configuration.rb +309 -0
  75. data/lib/falaai-api/models/audio_event.rb +273 -0
  76. data/lib/falaai-api/models/audio_input_meta.rb +273 -0
  77. data/lib/falaai-api/models/auditoria_risco_analysis_v2.rb +174 -0
  78. data/lib/falaai-api/models/auditoria_risco_applied_action_v2.rb +292 -0
  79. data/lib/falaai-api/models/auditoria_risco_audio_event_model_v2.rb +174 -0
  80. data/lib/falaai-api/models/auditoria_risco_audit_decisions_v2.rb +170 -0
  81. data/lib/falaai-api/models/auditoria_risco_conversation_scores_v2.rb +251 -0
  82. data/lib/falaai-api/models/auditoria_risco_detection_item_v2.rb +651 -0
  83. data/lib/falaai-api/models/auditoria_risco_detections_v2.rb +198 -0
  84. data/lib/falaai-api/models/auditoria_risco_indexer_v2.rb +150 -0
  85. data/lib/falaai-api/models/auditoria_risco_meta_v2.rb +234 -0
  86. data/lib/falaai-api/models/auditoria_risco_participant_v2.rb +168 -0
  87. data/lib/falaai-api/models/auditoria_risco_participants_v2.rb +196 -0
  88. data/lib/falaai-api/models/auditoria_risco_request.rb +451 -0
  89. data/lib/falaai-api/models/auditoria_risco_scores_v2.rb +177 -0
  90. data/lib/falaai-api/models/auditoria_risco_scoring_explanation_v2.rb +160 -0
  91. data/lib/falaai-api/models/auditoria_risco_summary_v2.rb +300 -0
  92. data/lib/falaai-api/models/auditoria_risco_timeline_v2.rb +174 -0
  93. data/lib/falaai-api/models/auditoria_risco_usage_v2.rb +219 -0
  94. data/lib/falaai-api/models/auditoria_risco_v2.rb +548 -0
  95. data/lib/falaai-api/models/auditoria_risco_v2_response.rb +165 -0
  96. data/lib/falaai-api/models/auditoria_risco_verdict_v2.rb +213 -0
  97. data/lib/falaai-api/models/create_email_alert_request.rb +221 -0
  98. data/lib/falaai-api/models/create_webhook_request.rb +233 -0
  99. data/lib/falaai-api/models/diagnostic_analysis_map.rb +285 -0
  100. data/lib/falaai-api/models/diagnostic_audio_event.rb +205 -0
  101. data/lib/falaai-api/models/diagnostic_categorical_analysis.rb +170 -0
  102. data/lib/falaai-api/models/diagnostic_request.rb +316 -0
  103. data/lib/falaai-api/models/diagnostic_response.rb +283 -0
  104. data/lib/falaai-api/models/diagnostic_text_analysis.rb +148 -0
  105. data/lib/falaai-api/models/diagnostic_usage.rb +219 -0
  106. data/lib/falaai-api/models/email_alert_item.rb +356 -0
  107. data/lib/falaai-api/models/email_alert_list_response.rb +218 -0
  108. data/lib/falaai-api/models/email_alert_message_response.rb +165 -0
  109. data/lib/falaai-api/models/email_event.rb +47 -0
  110. data/lib/falaai-api/models/health_response.rb +300 -0
  111. data/lib/falaai-api/models/http_validation_error.rb +149 -0
  112. data/lib/falaai-api/models/location_inner.rb +103 -0
  113. data/lib/falaai-api/models/message_response.rb +165 -0
  114. data/lib/falaai-api/models/participant.rb +226 -0
  115. data/lib/falaai-api/models/participant_diagnostic.rb +222 -0
  116. data/lib/falaai-api/models/transcription_response.rb +540 -0
  117. data/lib/falaai-api/models/transcription_usage.rb +219 -0
  118. data/lib/falaai-api/models/update_email_alert_request.rb +176 -0
  119. data/lib/falaai-api/models/update_webhook_request.rb +190 -0
  120. data/lib/falaai-api/models/usage_by_key_item.rb +256 -0
  121. data/lib/falaai-api/models/usage_log_item.rb +300 -0
  122. data/lib/falaai-api/models/usage_log_response.rb +218 -0
  123. data/lib/falaai-api/models/validation_error.rb +237 -0
  124. data/lib/falaai-api/models/version_response.rb +219 -0
  125. data/lib/falaai-api/models/webhook_event.rb +48 -0
  126. data/lib/falaai-api/models/webhook_item.rb +442 -0
  127. data/lib/falaai-api/models/webhook_list_response.rb +218 -0
  128. data/lib/falaai-api/version.rb +15 -0
  129. data/lib/falaai-api.rb +100 -0
  130. metadata +229 -0
@@ -0,0 +1,451 @@
1
+ =begin
2
+ #FalaAI API
3
+
4
+ #Transcribe, diagnose and score calls with 3 simple endpoints. **Endpoints:** - `POST /v1/audio/transcriptions` — Audio to text - `POST /v1/analyze/diagnostic` — Conversation analysis - `POST /v1/analyze/auditoriaRisco` — Compliance audit **Complete flow (Python):** ```python import httpx API = 'https://api.fala.ai' KEY = 'fai_xxx' HD = {'Authorization': f'Bearer {KEY}'} # 1. Transcribe files = {'file': open('call.mp3', 'rb')} resp = httpx.post(f'{API}/v1/audio/transcriptions', headers=HD, files=files, data={'model': 'falaai-transcribe-1', 'language': 'pt'}) tr = resp.json() print(f'Text: {tr[\"text\"][:100]}...') # 2. Diagnose resp = httpx.post(f'{API}/v1/analyze/diagnostic', headers=HD, json={'dialog': tr['dialog'], 'language': 'pt-BR', 'duration_seconds': tr['duration_seconds']}) diag = resp.json() print(f'Sentiment: {diag[\"analysis\"][\"sentiment\"][\"list_choice\"]}') print(f'Summary: {diag[\"analysis\"][\"dialogue_summary\"][\"explanation\"][:100]}...') # 3. Audit resp = httpx.post(f'{API}/v1/analyze/auditoriaRisco', headers=HD, json={'dialogo': tr['dialog'], 'duration_seconds': tr['duration_seconds']}) audit = resp.json() print(f'Score: {audit[\"audit_score\"]} | Verdict: {audit[\"verdict\"]}') print(f'Detections: {audit[\"total_detections\"]} | Violations: {len(audit[\"violations\"])} | Positives: {len(audit[\"positives\"])}') ``` **Authentication:** All endpoints require an API Key in the `Authorization` header: `Bearer fai_xxx` Get your API Key at [falaai.action.tec.br/api](https://falaai.action.tec.br/api)
5
+
6
+ The version of the OpenAPI document: 1.21.47
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FalaAI
17
+ class AuditoriaRiscoRequest < ApiModelBase
18
+ # Analysis model. Always 'falaai-auditoria-risco-1'
19
+ attr_accessor :model
20
+
21
+ # Plain transcript (fallback if dialog is empty). At least one of 'dialog' or 'text' required. Max 300,000 characters
22
+ attr_accessor :text
23
+
24
+ # Diarized transcript with speaker turns. PRIMARY source. Speaker labels accepted (any case): 'Speaker N', 'Interlocutor N', 'Hablante N', 'Locutor N', 'Orador N' (space or underscore). Normalized internally to 'Speaker N' in the response. Max 300,000 characters
25
+ attr_accessor :dialog
26
+
27
+ # Audio events with timestamps (correlated with turns when diarization is present)
28
+ attr_accessor :audio_events
29
+
30
+ # Total audio duration in seconds. Required. Max 3h (10800s).
31
+ attr_accessor :duration_seconds
32
+
33
+ # Language of the transcript being analyzed. Must match the dialog/text language. Accepted: pt-BR, en-US, es-ES.
34
+ attr_accessor :language
35
+
36
+ # Language for analysis results (labels, categories, levels, actions, HTML report). Can differ from 'language'. Accepted: pt-BR, en-US, es-ES.
37
+ attr_accessor :response_language
38
+
39
+ # Who originated the call. inbound=client called, outbound=company called. If omitted, LLM infers from context.
40
+ attr_accessor :call_direction
41
+
42
+ # Explicit participant roles. If omitted, LLM infers from dialog (Lei 17). When provided, used as ground truth — no inference.
43
+ attr_accessor :participants
44
+
45
+ # Response format version. v1=legacy flat PT-BR, v2=structured EN-US blocks.
46
+ attr_accessor :response_format
47
+
48
+ # Optional client-supplied ID echoed verbatim in the response. Use to correlate/sync with your system. Accepted charset: [A-Za-z0-9._:-], max 128 chars. Not idempotency.
49
+ attr_accessor :client_reference_id
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'model' => :'model',
77
+ :'text' => :'text',
78
+ :'dialog' => :'dialog',
79
+ :'audio_events' => :'audio_events',
80
+ :'duration_seconds' => :'duration_seconds',
81
+ :'language' => :'language',
82
+ :'response_language' => :'response_language',
83
+ :'call_direction' => :'call_direction',
84
+ :'participants' => :'participants',
85
+ :'response_format' => :'response_format',
86
+ :'client_reference_id' => :'client_reference_id'
87
+ }
88
+ end
89
+
90
+ # Returns attribute mapping this model knows about
91
+ def self.acceptable_attribute_map
92
+ attribute_map
93
+ end
94
+
95
+ # Returns all the JSON keys this model knows about
96
+ def self.acceptable_attributes
97
+ acceptable_attribute_map.values
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.openapi_types
102
+ {
103
+ :'model' => :'String',
104
+ :'text' => :'String',
105
+ :'dialog' => :'String',
106
+ :'audio_events' => :'Array<DiagnosticAudioEvent>',
107
+ :'duration_seconds' => :'Float',
108
+ :'language' => :'String',
109
+ :'response_language' => :'String',
110
+ :'call_direction' => :'String',
111
+ :'participants' => :'Array<Participant>',
112
+ :'response_format' => :'String',
113
+ :'client_reference_id' => :'String'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ ])
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ if (!attributes.is_a?(Hash))
127
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FalaAI::AuditoriaRiscoRequest` initialize method"
128
+ end
129
+
130
+ # check to see if the attribute exists and convert string to symbol for hash key
131
+ acceptable_attribute_map = self.class.acceptable_attribute_map
132
+ attributes = attributes.each_with_object({}) { |(k, v), h|
133
+ if (!acceptable_attribute_map.key?(k.to_sym))
134
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FalaAI::AuditoriaRiscoRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
135
+ end
136
+ h[k.to_sym] = v
137
+ }
138
+
139
+ if attributes.key?(:'model')
140
+ self.model = attributes[:'model']
141
+ else
142
+ self.model = 'falaai-auditoria-risco-1'
143
+ end
144
+
145
+ if attributes.key?(:'text')
146
+ self.text = attributes[:'text']
147
+ else
148
+ self.text = ''
149
+ end
150
+
151
+ if attributes.key?(:'dialog')
152
+ self.dialog = attributes[:'dialog']
153
+ else
154
+ self.dialog = ''
155
+ end
156
+
157
+ if attributes.key?(:'audio_events')
158
+ if (value = attributes[:'audio_events']).is_a?(Array)
159
+ self.audio_events = value
160
+ end
161
+ end
162
+
163
+ if attributes.key?(:'duration_seconds')
164
+ self.duration_seconds = attributes[:'duration_seconds']
165
+ else
166
+ self.duration_seconds = nil
167
+ end
168
+
169
+ if attributes.key?(:'language')
170
+ self.language = attributes[:'language']
171
+ else
172
+ self.language = nil
173
+ end
174
+
175
+ if attributes.key?(:'response_language')
176
+ self.response_language = attributes[:'response_language']
177
+ else
178
+ self.response_language = nil
179
+ end
180
+
181
+ if attributes.key?(:'call_direction')
182
+ self.call_direction = attributes[:'call_direction']
183
+ end
184
+
185
+ if attributes.key?(:'participants')
186
+ if (value = attributes[:'participants']).is_a?(Array)
187
+ self.participants = value
188
+ end
189
+ end
190
+
191
+ if attributes.key?(:'response_format')
192
+ self.response_format = attributes[:'response_format']
193
+ else
194
+ self.response_format = 'v2'
195
+ end
196
+
197
+ if attributes.key?(:'client_reference_id')
198
+ self.client_reference_id = attributes[:'client_reference_id']
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
206
+ invalid_properties = Array.new
207
+ if !@text.nil? && @text.to_s.length > 300000
208
+ invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 300000.')
209
+ end
210
+
211
+ if !@dialog.nil? && @dialog.to_s.length > 300000
212
+ invalid_properties.push('invalid value for "dialog", the character length must be smaller than or equal to 300000.')
213
+ end
214
+
215
+ if !@audio_events.nil? && @audio_events.length > 500
216
+ invalid_properties.push('invalid value for "audio_events", number of items must be less than or equal to 500.')
217
+ end
218
+
219
+ if @duration_seconds.nil?
220
+ invalid_properties.push('invalid value for "duration_seconds", duration_seconds cannot be nil.')
221
+ end
222
+
223
+ if @duration_seconds < 1.0
224
+ invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 1.0.')
225
+ end
226
+
227
+ if @language.nil?
228
+ invalid_properties.push('invalid value for "language", language cannot be nil.')
229
+ end
230
+
231
+ if @response_language.nil?
232
+ invalid_properties.push('invalid value for "response_language", response_language cannot be nil.')
233
+ end
234
+
235
+ if !@participants.nil? && @participants.length > 10
236
+ invalid_properties.push('invalid value for "participants", number of items must be less than or equal to 10.')
237
+ end
238
+
239
+ pattern = Regexp.new(/^v[0-9]+$/)
240
+ if !@response_format.nil? && @response_format !~ pattern
241
+ invalid_properties.push("invalid value for \"response_format\", must conform to the pattern #{pattern}.")
242
+ end
243
+
244
+ invalid_properties
245
+ end
246
+
247
+ # Check to see if the all the properties in the model are valid
248
+ # @return true if the model is valid
249
+ def valid?
250
+ warn '[DEPRECATED] the `valid?` method is obsolete'
251
+ return false if !@text.nil? && @text.to_s.length > 300000
252
+ return false if !@dialog.nil? && @dialog.to_s.length > 300000
253
+ return false if !@audio_events.nil? && @audio_events.length > 500
254
+ return false if @duration_seconds.nil?
255
+ return false if @duration_seconds < 1.0
256
+ return false if @language.nil?
257
+ return false if @response_language.nil?
258
+ call_direction_validator = EnumAttributeValidator.new('String', ["inbound", "outbound"])
259
+ return false unless call_direction_validator.valid?(@call_direction)
260
+ return false if !@participants.nil? && @participants.length > 10
261
+ return false if !@response_format.nil? && @response_format !~ Regexp.new(/^v[0-9]+$/)
262
+ true
263
+ end
264
+
265
+ # Custom attribute writer method with validation
266
+ # @param [Object] text Value to be assigned
267
+ def text=(text)
268
+ if text.nil?
269
+ fail ArgumentError, 'text cannot be nil'
270
+ end
271
+
272
+ if text.to_s.length > 300000
273
+ fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 300000.'
274
+ end
275
+
276
+ @text = text
277
+ end
278
+
279
+ # Custom attribute writer method with validation
280
+ # @param [Object] dialog Value to be assigned
281
+ def dialog=(dialog)
282
+ if dialog.nil?
283
+ fail ArgumentError, 'dialog cannot be nil'
284
+ end
285
+
286
+ if dialog.to_s.length > 300000
287
+ fail ArgumentError, 'invalid value for "dialog", the character length must be smaller than or equal to 300000.'
288
+ end
289
+
290
+ @dialog = dialog
291
+ end
292
+
293
+ # Custom attribute writer method with validation
294
+ # @param [Object] audio_events Value to be assigned
295
+ def audio_events=(audio_events)
296
+ if audio_events.nil?
297
+ fail ArgumentError, 'audio_events cannot be nil'
298
+ end
299
+
300
+ if audio_events.length > 500
301
+ fail ArgumentError, 'invalid value for "audio_events", number of items must be less than or equal to 500.'
302
+ end
303
+
304
+ @audio_events = audio_events
305
+ end
306
+
307
+ # Custom attribute writer method with validation
308
+ # @param [Object] duration_seconds Value to be assigned
309
+ def duration_seconds=(duration_seconds)
310
+ if duration_seconds.nil?
311
+ fail ArgumentError, 'duration_seconds cannot be nil'
312
+ end
313
+
314
+ if duration_seconds < 1.0
315
+ fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 1.0.'
316
+ end
317
+
318
+ @duration_seconds = duration_seconds
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] language Value to be assigned
323
+ def language=(language)
324
+ if language.nil?
325
+ fail ArgumentError, 'language cannot be nil'
326
+ end
327
+
328
+ @language = language
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] response_language Value to be assigned
333
+ def response_language=(response_language)
334
+ if response_language.nil?
335
+ fail ArgumentError, 'response_language cannot be nil'
336
+ end
337
+
338
+ @response_language = response_language
339
+ end
340
+
341
+ # Custom attribute writer method checking allowed values (enum).
342
+ # @param [Object] call_direction Object to be assigned
343
+ def call_direction=(call_direction)
344
+ validator = EnumAttributeValidator.new('String', ["inbound", "outbound"])
345
+ unless validator.valid?(call_direction)
346
+ fail ArgumentError, "invalid value for \"call_direction\", must be one of #{validator.allowable_values}."
347
+ end
348
+ @call_direction = call_direction
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] participants Value to be assigned
353
+ def participants=(participants)
354
+ if participants.nil?
355
+ fail ArgumentError, 'participants cannot be nil'
356
+ end
357
+
358
+ if participants.length > 10
359
+ fail ArgumentError, 'invalid value for "participants", number of items must be less than or equal to 10.'
360
+ end
361
+
362
+ @participants = participants
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] response_format Value to be assigned
367
+ def response_format=(response_format)
368
+ if response_format.nil?
369
+ fail ArgumentError, 'response_format cannot be nil'
370
+ end
371
+
372
+ pattern = Regexp.new(/^v[0-9]+$/)
373
+ if response_format !~ pattern
374
+ fail ArgumentError, "invalid value for \"response_format\", must conform to the pattern #{pattern}."
375
+ end
376
+
377
+ @response_format = response_format
378
+ end
379
+
380
+ # Checks equality by comparing each attribute.
381
+ # @param [Object] Object to be compared
382
+ def ==(o)
383
+ return true if self.equal?(o)
384
+ self.class == o.class &&
385
+ model == o.model &&
386
+ text == o.text &&
387
+ dialog == o.dialog &&
388
+ audio_events == o.audio_events &&
389
+ duration_seconds == o.duration_seconds &&
390
+ language == o.language &&
391
+ response_language == o.response_language &&
392
+ call_direction == o.call_direction &&
393
+ participants == o.participants &&
394
+ response_format == o.response_format &&
395
+ client_reference_id == o.client_reference_id
396
+ end
397
+
398
+ # @see the `==` method
399
+ # @param [Object] Object to be compared
400
+ def eql?(o)
401
+ self == o
402
+ end
403
+
404
+ # Calculates hash code according to all attributes.
405
+ # @return [Integer] Hash code
406
+ def hash
407
+ [model, text, dialog, audio_events, duration_seconds, language, response_language, call_direction, participants, response_format, client_reference_id].hash
408
+ end
409
+
410
+ # Builds the object from hash
411
+ # @param [Hash] attributes Model attributes in the form of hash
412
+ # @return [Object] Returns the model itself
413
+ def self.build_from_hash(attributes)
414
+ return nil unless attributes.is_a?(Hash)
415
+ attributes = attributes.transform_keys(&:to_sym)
416
+ transformed_hash = {}
417
+ openapi_types.each_pair do |key, type|
418
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
419
+ transformed_hash["#{key}"] = nil
420
+ elsif type =~ /\AArray<(.*)>/i
421
+ # check to ensure the input is an array given that the attribute
422
+ # is documented as an array but the input is not
423
+ if attributes[attribute_map[key]].is_a?(Array)
424
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
425
+ end
426
+ elsif !attributes[attribute_map[key]].nil?
427
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
428
+ end
429
+ end
430
+ new(transformed_hash)
431
+ end
432
+
433
+ # Returns the object in the form of hash
434
+ # @return [Hash] Returns the object in the form of hash
435
+ def to_hash
436
+ hash = {}
437
+ self.class.attribute_map.each_pair do |attr, param|
438
+ value = self.send(attr)
439
+ if value.nil?
440
+ is_nullable = self.class.openapi_nullable.include?(attr)
441
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
442
+ end
443
+
444
+ hash[param] = _to_hash(value)
445
+ end
446
+ hash
447
+ end
448
+
449
+ end
450
+
451
+ end
@@ -0,0 +1,177 @@
1
+ =begin
2
+ #FalaAI API
3
+
4
+ #Transcribe, diagnose and score calls with 3 simple endpoints. **Endpoints:** - `POST /v1/audio/transcriptions` — Audio to text - `POST /v1/analyze/diagnostic` — Conversation analysis - `POST /v1/analyze/auditoriaRisco` — Compliance audit **Complete flow (Python):** ```python import httpx API = 'https://api.fala.ai' KEY = 'fai_xxx' HD = {'Authorization': f'Bearer {KEY}'} # 1. Transcribe files = {'file': open('call.mp3', 'rb')} resp = httpx.post(f'{API}/v1/audio/transcriptions', headers=HD, files=files, data={'model': 'falaai-transcribe-1', 'language': 'pt'}) tr = resp.json() print(f'Text: {tr[\"text\"][:100]}...') # 2. Diagnose resp = httpx.post(f'{API}/v1/analyze/diagnostic', headers=HD, json={'dialog': tr['dialog'], 'language': 'pt-BR', 'duration_seconds': tr['duration_seconds']}) diag = resp.json() print(f'Sentiment: {diag[\"analysis\"][\"sentiment\"][\"list_choice\"]}') print(f'Summary: {diag[\"analysis\"][\"dialogue_summary\"][\"explanation\"][:100]}...') # 3. Audit resp = httpx.post(f'{API}/v1/analyze/auditoriaRisco', headers=HD, json={'dialogo': tr['dialog'], 'duration_seconds': tr['duration_seconds']}) audit = resp.json() print(f'Score: {audit[\"audit_score\"]} | Verdict: {audit[\"verdict\"]}') print(f'Detections: {audit[\"total_detections\"]} | Violations: {len(audit[\"violations\"])} | Positives: {len(audit[\"positives\"])}') ``` **Authentication:** All endpoints require an API Key in the `Authorization` header: `Bearer fai_xxx` Get your API Key at [falaai.action.tec.br/api](https://falaai.action.tec.br/api)
5
+
6
+ The version of the OpenAPI document: 1.21.47
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FalaAI
17
+ class AuditoriaRiscoScoresV2 < ApiModelBase
18
+ # Conversation scores
19
+ attr_accessor :conversation
20
+
21
+ # Per-participant KPIs
22
+ attr_accessor :per_participant
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'conversation' => :'conversation',
28
+ :'per_participant' => :'per_participant'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'conversation' => :'AuditoriaRiscoConversationScoresV2',
46
+ :'per_participant' => :'Hash<String, Object>'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FalaAI::AuditoriaRiscoScoresV2` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FalaAI::AuditoriaRiscoScoresV2`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'conversation')
73
+ self.conversation = attributes[:'conversation']
74
+ else
75
+ self.conversation = nil
76
+ end
77
+
78
+ if attributes.key?(:'per_participant')
79
+ if (value = attributes[:'per_participant']).is_a?(Hash)
80
+ self.per_participant = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @conversation.nil?
91
+ invalid_properties.push('invalid value for "conversation", conversation cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if @conversation.nil?
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] conversation Value to be assigned
107
+ def conversation=(conversation)
108
+ if conversation.nil?
109
+ fail ArgumentError, 'conversation cannot be nil'
110
+ end
111
+
112
+ @conversation = conversation
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ conversation == o.conversation &&
121
+ per_participant == o.per_participant
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [conversation, per_participant].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ if value.nil?
166
+ is_nullable = self.class.openapi_nullable.include?(attr)
167
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
168
+ end
169
+
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ end
176
+
177
+ end