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,198 @@
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 AuditoriaRiscoDetectionsV2 < ApiModelBase
18
+ # Active violations
19
+ attr_accessor :violations
20
+
21
+ # Active positives
22
+ attr_accessor :positives
23
+
24
+ # Client risk alerts
25
+ attr_accessor :client_risk_alerts
26
+
27
+ # Client behavior alerts
28
+ attr_accessor :client_behavior_alerts
29
+
30
+ # Client negatives
31
+ attr_accessor :client_negatives
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'violations' => :'violations',
37
+ :'positives' => :'positives',
38
+ :'client_risk_alerts' => :'client_risk_alerts',
39
+ :'client_behavior_alerts' => :'client_behavior_alerts',
40
+ :'client_negatives' => :'client_negatives'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'violations' => :'Array<AuditoriaRiscoDetectionItemV2>',
58
+ :'positives' => :'Array<AuditoriaRiscoDetectionItemV2>',
59
+ :'client_risk_alerts' => :'Array<Hash<String, Object>>',
60
+ :'client_behavior_alerts' => :'Array<Hash<String, Object>>',
61
+ :'client_negatives' => :'Array<AuditoriaRiscoDetectionItemV2>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FalaAI::AuditoriaRiscoDetectionsV2` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FalaAI::AuditoriaRiscoDetectionsV2`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'violations')
88
+ if (value = attributes[:'violations']).is_a?(Array)
89
+ self.violations = value
90
+ end
91
+ end
92
+
93
+ if attributes.key?(:'positives')
94
+ if (value = attributes[:'positives']).is_a?(Array)
95
+ self.positives = value
96
+ end
97
+ end
98
+
99
+ if attributes.key?(:'client_risk_alerts')
100
+ if (value = attributes[:'client_risk_alerts']).is_a?(Array)
101
+ self.client_risk_alerts = value
102
+ end
103
+ end
104
+
105
+ if attributes.key?(:'client_behavior_alerts')
106
+ if (value = attributes[:'client_behavior_alerts']).is_a?(Array)
107
+ self.client_behavior_alerts = value
108
+ end
109
+ end
110
+
111
+ if attributes.key?(:'client_negatives')
112
+ if (value = attributes[:'client_negatives']).is_a?(Array)
113
+ self.client_negatives = value
114
+ end
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ warn '[DEPRECATED] the `valid?` method is obsolete'
130
+ true
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ violations == o.violations &&
139
+ positives == o.positives &&
140
+ client_risk_alerts == o.client_risk_alerts &&
141
+ client_behavior_alerts == o.client_behavior_alerts &&
142
+ client_negatives == o.client_negatives
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [violations, positives, client_risk_alerts, client_behavior_alerts, client_negatives].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ end
197
+
198
+ end
@@ -0,0 +1,150 @@
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 AuditoriaRiscoIndexerV2 < ApiModelBase
18
+ # Suggested terms for bank
19
+ attr_accessor :suggested_terms_for_bank
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'suggested_terms_for_bank' => :'suggested_terms_for_bank'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'suggested_terms_for_bank' => :'Array<Hash<String, Object>>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FalaAI::AuditoriaRiscoIndexerV2` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FalaAI::AuditoriaRiscoIndexerV2`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'suggested_terms_for_bank')
68
+ if (value = attributes[:'suggested_terms_for_bank']).is_a?(Array)
69
+ self.suggested_terms_for_bank = value
70
+ end
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ suggested_terms_for_bank == o.suggested_terms_for_bank
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [suggested_terms_for_bank].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Returns the object in the form of hash
133
+ # @return [Hash] Returns the object in the form of hash
134
+ def to_hash
135
+ hash = {}
136
+ self.class.attribute_map.each_pair do |attr, param|
137
+ value = self.send(attr)
138
+ if value.nil?
139
+ is_nullable = self.class.openapi_nullable.include?(attr)
140
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
141
+ end
142
+
143
+ hash[param] = _to_hash(value)
144
+ end
145
+ hash
146
+ end
147
+
148
+ end
149
+
150
+ end
@@ -0,0 +1,234 @@
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 AuditoriaRiscoMetaV2 < ApiModelBase
18
+ # Analysis id
19
+ attr_accessor :id
20
+
21
+ # Object type
22
+ attr_accessor :object
23
+
24
+ # Call duration (s)
25
+ attr_accessor :call_duration_s
26
+
27
+ # ISO 8601 analyzed timestamp
28
+ attr_accessor :analyzed_at
29
+
30
+ # Usage block
31
+ attr_accessor :usage
32
+
33
+ # Echoed client reference id
34
+ attr_accessor :client_reference_id
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'object' => :'object',
41
+ :'call_duration_s' => :'call_duration_s',
42
+ :'analyzed_at' => :'analyzed_at',
43
+ :'usage' => :'usage',
44
+ :'client_reference_id' => :'client_reference_id'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'object' => :'String',
63
+ :'call_duration_s' => :'Float',
64
+ :'analyzed_at' => :'String',
65
+ :'usage' => :'AuditoriaRiscoUsageV2',
66
+ :'client_reference_id' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FalaAI::AuditoriaRiscoMetaV2` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FalaAI::AuditoriaRiscoMetaV2`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'id')
93
+ self.id = attributes[:'id']
94
+ else
95
+ self.id = nil
96
+ end
97
+
98
+ if attributes.key?(:'object')
99
+ self.object = attributes[:'object']
100
+ else
101
+ self.object = 'auditoria_risco'
102
+ end
103
+
104
+ if attributes.key?(:'call_duration_s')
105
+ self.call_duration_s = attributes[:'call_duration_s']
106
+ end
107
+
108
+ if attributes.key?(:'analyzed_at')
109
+ self.analyzed_at = attributes[:'analyzed_at']
110
+ end
111
+
112
+ if attributes.key?(:'usage')
113
+ self.usage = attributes[:'usage']
114
+ else
115
+ self.usage = nil
116
+ end
117
+
118
+ if attributes.key?(:'client_reference_id')
119
+ self.client_reference_id = attributes[:'client_reference_id']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ if @id.nil?
129
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
130
+ end
131
+
132
+ if @usage.nil?
133
+ invalid_properties.push('invalid value for "usage", usage cannot be nil.')
134
+ end
135
+
136
+ invalid_properties
137
+ end
138
+
139
+ # Check to see if the all the properties in the model are valid
140
+ # @return true if the model is valid
141
+ def valid?
142
+ warn '[DEPRECATED] the `valid?` method is obsolete'
143
+ return false if @id.nil?
144
+ return false if @usage.nil?
145
+ true
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] id Value to be assigned
150
+ def id=(id)
151
+ if id.nil?
152
+ fail ArgumentError, 'id cannot be nil'
153
+ end
154
+
155
+ @id = id
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] usage Value to be assigned
160
+ def usage=(usage)
161
+ if usage.nil?
162
+ fail ArgumentError, 'usage cannot be nil'
163
+ end
164
+
165
+ @usage = usage
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ id == o.id &&
174
+ object == o.object &&
175
+ call_duration_s == o.call_duration_s &&
176
+ analyzed_at == o.analyzed_at &&
177
+ usage == o.usage &&
178
+ client_reference_id == o.client_reference_id
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [id, object, call_duration_s, analyzed_at, usage, client_reference_id].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ attributes = attributes.transform_keys(&:to_sym)
199
+ transformed_hash = {}
200
+ openapi_types.each_pair do |key, type|
201
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = nil
203
+ elsif type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[attribute_map[key]].is_a?(Array)
207
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
208
+ end
209
+ elsif !attributes[attribute_map[key]].nil?
210
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
211
+ end
212
+ end
213
+ new(transformed_hash)
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ end
233
+
234
+ end