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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +205 -0
- data/docs/AnalysisApi.md +147 -0
- data/docs/AudioEvent.md +26 -0
- data/docs/AudioInputMeta.md +26 -0
- data/docs/AuditoriaRiscoAnalysisV2.md +22 -0
- data/docs/AuditoriaRiscoAppliedActionV2.md +32 -0
- data/docs/AuditoriaRiscoAudioEventModelV2.md +22 -0
- data/docs/AuditoriaRiscoAuditDecisionsV2.md +22 -0
- data/docs/AuditoriaRiscoConversationScoresV2.md +38 -0
- data/docs/AuditoriaRiscoDetectionItemV2.md +110 -0
- data/docs/AuditoriaRiscoDetectionsV2.md +26 -0
- data/docs/AuditoriaRiscoIndexerV2.md +18 -0
- data/docs/AuditoriaRiscoMetaV2.md +28 -0
- data/docs/AuditoriaRiscoParticipantV2.md +22 -0
- data/docs/AuditoriaRiscoParticipantsV2.md +26 -0
- data/docs/AuditoriaRiscoRequest.md +38 -0
- data/docs/AuditoriaRiscoScoresV2.md +20 -0
- data/docs/AuditoriaRiscoScoringExplanationV2.md +20 -0
- data/docs/AuditoriaRiscoSummaryV2.md +48 -0
- data/docs/AuditoriaRiscoTimelineV2.md +22 -0
- data/docs/AuditoriaRiscoUsageV2.md +22 -0
- data/docs/AuditoriaRiscoV2.md +46 -0
- data/docs/AuditoriaRiscoV2Response.md +18 -0
- data/docs/AuditoriaRiscoVerdictV2.md +30 -0
- data/docs/CreateEmailAlertRequest.md +22 -0
- data/docs/CreateWebhookRequest.md +24 -0
- data/docs/DiagnosticAnalysisMap.md +28 -0
- data/docs/DiagnosticAudioEvent.md +26 -0
- data/docs/DiagnosticCategoricalAnalysis.md +22 -0
- data/docs/DiagnosticRequest.md +30 -0
- data/docs/DiagnosticResponse.md +28 -0
- data/docs/DiagnosticTextAnalysis.md +18 -0
- data/docs/DiagnosticUsage.md +22 -0
- data/docs/EmailAlertItem.md +32 -0
- data/docs/EmailAlertListResponse.md +22 -0
- data/docs/EmailAlertMessageResponse.md +18 -0
- data/docs/EmailAlertsApi.md +285 -0
- data/docs/EmailEvent.md +15 -0
- data/docs/HTTPValidationError.md +18 -0
- data/docs/HealthApi.md +137 -0
- data/docs/HealthResponse.md +28 -0
- data/docs/LocationInner.md +15 -0
- data/docs/MessageResponse.md +18 -0
- data/docs/Participant.md +22 -0
- data/docs/ParticipantDiagnostic.md +26 -0
- data/docs/SpeechApi.md +85 -0
- data/docs/TranscriptionResponse.md +49 -0
- data/docs/TranscriptionUsage.md +22 -0
- data/docs/UpdateEmailAlertRequest.md +24 -0
- data/docs/UpdateWebhookRequest.md +26 -0
- data/docs/UsageApi.md +151 -0
- data/docs/UsageByKeyItem.md +26 -0
- data/docs/UsageLogItem.md +28 -0
- data/docs/UsageLogResponse.md +22 -0
- data/docs/ValidationError.md +26 -0
- data/docs/VersionApi.md +72 -0
- data/docs/VersionResponse.md +22 -0
- data/docs/WebhookEvent.md +15 -0
- data/docs/WebhookItem.md +42 -0
- data/docs/WebhookListResponse.md +22 -0
- data/docs/WebhooksApi.md +293 -0
- data/lib/falaai-api/api/analysis_api.rb +158 -0
- data/lib/falaai-api/api/email_alerts_api.rb +294 -0
- data/lib/falaai-api/api/health_api.rb +132 -0
- data/lib/falaai-api/api/speech_api.rb +100 -0
- data/lib/falaai-api/api/usage_api.rb +156 -0
- data/lib/falaai-api/api/version_api.rb +77 -0
- data/lib/falaai-api/api/webhooks_api.rb +302 -0
- data/lib/falaai-api/api_client.rb +397 -0
- data/lib/falaai-api/api_error.rb +58 -0
- data/lib/falaai-api/api_model_base.rb +88 -0
- data/lib/falaai-api/configuration.rb +309 -0
- data/lib/falaai-api/models/audio_event.rb +273 -0
- data/lib/falaai-api/models/audio_input_meta.rb +273 -0
- data/lib/falaai-api/models/auditoria_risco_analysis_v2.rb +174 -0
- data/lib/falaai-api/models/auditoria_risco_applied_action_v2.rb +292 -0
- data/lib/falaai-api/models/auditoria_risco_audio_event_model_v2.rb +174 -0
- data/lib/falaai-api/models/auditoria_risco_audit_decisions_v2.rb +170 -0
- data/lib/falaai-api/models/auditoria_risco_conversation_scores_v2.rb +251 -0
- data/lib/falaai-api/models/auditoria_risco_detection_item_v2.rb +651 -0
- data/lib/falaai-api/models/auditoria_risco_detections_v2.rb +198 -0
- data/lib/falaai-api/models/auditoria_risco_indexer_v2.rb +150 -0
- data/lib/falaai-api/models/auditoria_risco_meta_v2.rb +234 -0
- data/lib/falaai-api/models/auditoria_risco_participant_v2.rb +168 -0
- data/lib/falaai-api/models/auditoria_risco_participants_v2.rb +196 -0
- data/lib/falaai-api/models/auditoria_risco_request.rb +451 -0
- data/lib/falaai-api/models/auditoria_risco_scores_v2.rb +177 -0
- data/lib/falaai-api/models/auditoria_risco_scoring_explanation_v2.rb +160 -0
- data/lib/falaai-api/models/auditoria_risco_summary_v2.rb +300 -0
- data/lib/falaai-api/models/auditoria_risco_timeline_v2.rb +174 -0
- data/lib/falaai-api/models/auditoria_risco_usage_v2.rb +219 -0
- data/lib/falaai-api/models/auditoria_risco_v2.rb +548 -0
- data/lib/falaai-api/models/auditoria_risco_v2_response.rb +165 -0
- data/lib/falaai-api/models/auditoria_risco_verdict_v2.rb +213 -0
- data/lib/falaai-api/models/create_email_alert_request.rb +221 -0
- data/lib/falaai-api/models/create_webhook_request.rb +233 -0
- data/lib/falaai-api/models/diagnostic_analysis_map.rb +285 -0
- data/lib/falaai-api/models/diagnostic_audio_event.rb +205 -0
- data/lib/falaai-api/models/diagnostic_categorical_analysis.rb +170 -0
- data/lib/falaai-api/models/diagnostic_request.rb +316 -0
- data/lib/falaai-api/models/diagnostic_response.rb +283 -0
- data/lib/falaai-api/models/diagnostic_text_analysis.rb +148 -0
- data/lib/falaai-api/models/diagnostic_usage.rb +219 -0
- data/lib/falaai-api/models/email_alert_item.rb +356 -0
- data/lib/falaai-api/models/email_alert_list_response.rb +218 -0
- data/lib/falaai-api/models/email_alert_message_response.rb +165 -0
- data/lib/falaai-api/models/email_event.rb +47 -0
- data/lib/falaai-api/models/health_response.rb +300 -0
- data/lib/falaai-api/models/http_validation_error.rb +149 -0
- data/lib/falaai-api/models/location_inner.rb +103 -0
- data/lib/falaai-api/models/message_response.rb +165 -0
- data/lib/falaai-api/models/participant.rb +226 -0
- data/lib/falaai-api/models/participant_diagnostic.rb +222 -0
- data/lib/falaai-api/models/transcription_response.rb +540 -0
- data/lib/falaai-api/models/transcription_usage.rb +219 -0
- data/lib/falaai-api/models/update_email_alert_request.rb +176 -0
- data/lib/falaai-api/models/update_webhook_request.rb +190 -0
- data/lib/falaai-api/models/usage_by_key_item.rb +256 -0
- data/lib/falaai-api/models/usage_log_item.rb +300 -0
- data/lib/falaai-api/models/usage_log_response.rb +218 -0
- data/lib/falaai-api/models/validation_error.rb +237 -0
- data/lib/falaai-api/models/version_response.rb +219 -0
- data/lib/falaai-api/models/webhook_event.rb +48 -0
- data/lib/falaai-api/models/webhook_item.rb +442 -0
- data/lib/falaai-api/models/webhook_list_response.rb +218 -0
- data/lib/falaai-api/version.rb +15 -0
- data/lib/falaai-api.rb +100 -0
- metadata +229 -0
|
@@ -0,0 +1,256 @@
|
|
|
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 UsageByKeyItem < ApiModelBase
|
|
18
|
+
# API key id
|
|
19
|
+
attr_accessor :key_id
|
|
20
|
+
|
|
21
|
+
# API key name
|
|
22
|
+
attr_accessor :key_name
|
|
23
|
+
|
|
24
|
+
# Total credits consumed by the key
|
|
25
|
+
attr_accessor :total_credits
|
|
26
|
+
|
|
27
|
+
# Number of requests
|
|
28
|
+
attr_accessor :request_count
|
|
29
|
+
|
|
30
|
+
# ISO 8601 of last use (null if never)
|
|
31
|
+
attr_accessor :last_used
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'key_id' => :'key_id',
|
|
37
|
+
:'key_name' => :'key_name',
|
|
38
|
+
:'total_credits' => :'total_credits',
|
|
39
|
+
:'request_count' => :'request_count',
|
|
40
|
+
:'last_used' => :'last_used'
|
|
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
|
+
:'key_id' => :'String',
|
|
58
|
+
:'key_name' => :'String',
|
|
59
|
+
:'total_credits' => :'Integer',
|
|
60
|
+
:'request_count' => :'Integer',
|
|
61
|
+
:'last_used' => :'String'
|
|
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::UsageByKeyItem` 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::UsageByKeyItem`. 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?(:'key_id')
|
|
88
|
+
self.key_id = attributes[:'key_id']
|
|
89
|
+
else
|
|
90
|
+
self.key_id = nil
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'key_name')
|
|
94
|
+
self.key_name = attributes[:'key_name']
|
|
95
|
+
else
|
|
96
|
+
self.key_name = nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'total_credits')
|
|
100
|
+
self.total_credits = attributes[:'total_credits']
|
|
101
|
+
else
|
|
102
|
+
self.total_credits = nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'request_count')
|
|
106
|
+
self.request_count = attributes[:'request_count']
|
|
107
|
+
else
|
|
108
|
+
self.request_count = nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'last_used')
|
|
112
|
+
self.last_used = attributes[:'last_used']
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def list_invalid_properties
|
|
119
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
120
|
+
invalid_properties = Array.new
|
|
121
|
+
if @key_id.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "key_id", key_id cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if @key_name.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "key_name", key_name cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @total_credits.nil?
|
|
130
|
+
invalid_properties.push('invalid value for "total_credits", total_credits cannot be nil.')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if @request_count.nil?
|
|
134
|
+
invalid_properties.push('invalid value for "request_count", request_count cannot be nil.')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
invalid_properties
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Check to see if the all the properties in the model are valid
|
|
141
|
+
# @return true if the model is valid
|
|
142
|
+
def valid?
|
|
143
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
144
|
+
return false if @key_id.nil?
|
|
145
|
+
return false if @key_name.nil?
|
|
146
|
+
return false if @total_credits.nil?
|
|
147
|
+
return false if @request_count.nil?
|
|
148
|
+
true
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Custom attribute writer method with validation
|
|
152
|
+
# @param [Object] key_id Value to be assigned
|
|
153
|
+
def key_id=(key_id)
|
|
154
|
+
if key_id.nil?
|
|
155
|
+
fail ArgumentError, 'key_id cannot be nil'
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
@key_id = key_id
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Custom attribute writer method with validation
|
|
162
|
+
# @param [Object] key_name Value to be assigned
|
|
163
|
+
def key_name=(key_name)
|
|
164
|
+
if key_name.nil?
|
|
165
|
+
fail ArgumentError, 'key_name cannot be nil'
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
@key_name = key_name
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Custom attribute writer method with validation
|
|
172
|
+
# @param [Object] total_credits Value to be assigned
|
|
173
|
+
def total_credits=(total_credits)
|
|
174
|
+
if total_credits.nil?
|
|
175
|
+
fail ArgumentError, 'total_credits cannot be nil'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
@total_credits = total_credits
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Custom attribute writer method with validation
|
|
182
|
+
# @param [Object] request_count Value to be assigned
|
|
183
|
+
def request_count=(request_count)
|
|
184
|
+
if request_count.nil?
|
|
185
|
+
fail ArgumentError, 'request_count cannot be nil'
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@request_count = request_count
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Checks equality by comparing each attribute.
|
|
192
|
+
# @param [Object] Object to be compared
|
|
193
|
+
def ==(o)
|
|
194
|
+
return true if self.equal?(o)
|
|
195
|
+
self.class == o.class &&
|
|
196
|
+
key_id == o.key_id &&
|
|
197
|
+
key_name == o.key_name &&
|
|
198
|
+
total_credits == o.total_credits &&
|
|
199
|
+
request_count == o.request_count &&
|
|
200
|
+
last_used == o.last_used
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# @see the `==` method
|
|
204
|
+
# @param [Object] Object to be compared
|
|
205
|
+
def eql?(o)
|
|
206
|
+
self == o
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Calculates hash code according to all attributes.
|
|
210
|
+
# @return [Integer] Hash code
|
|
211
|
+
def hash
|
|
212
|
+
[key_id, key_name, total_credits, request_count, last_used].hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Builds the object from hash
|
|
216
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
217
|
+
# @return [Object] Returns the model itself
|
|
218
|
+
def self.build_from_hash(attributes)
|
|
219
|
+
return nil unless attributes.is_a?(Hash)
|
|
220
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
221
|
+
transformed_hash = {}
|
|
222
|
+
openapi_types.each_pair do |key, type|
|
|
223
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
224
|
+
transformed_hash["#{key}"] = nil
|
|
225
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
226
|
+
# check to ensure the input is an array given that the attribute
|
|
227
|
+
# is documented as an array but the input is not
|
|
228
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
229
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
230
|
+
end
|
|
231
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
232
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
new(transformed_hash)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Returns the object in the form of hash
|
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
|
240
|
+
def to_hash
|
|
241
|
+
hash = {}
|
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
243
|
+
value = self.send(attr)
|
|
244
|
+
if value.nil?
|
|
245
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
246
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
hash[param] = _to_hash(value)
|
|
250
|
+
end
|
|
251
|
+
hash
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
end
|
|
@@ -0,0 +1,300 @@
|
|
|
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 UsageLogItem < ApiModelBase
|
|
18
|
+
# Usage log entry id
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# Endpoint called
|
|
22
|
+
attr_accessor :endpoint
|
|
23
|
+
|
|
24
|
+
# Credits consumed
|
|
25
|
+
attr_accessor :credits_cost
|
|
26
|
+
|
|
27
|
+
# Result status
|
|
28
|
+
attr_accessor :status
|
|
29
|
+
|
|
30
|
+
# Errors count
|
|
31
|
+
attr_accessor :errors_count
|
|
32
|
+
|
|
33
|
+
# ISO 8601 timestamp
|
|
34
|
+
attr_accessor :created_at
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'id' => :'id',
|
|
40
|
+
:'endpoint' => :'endpoint',
|
|
41
|
+
:'credits_cost' => :'credits_cost',
|
|
42
|
+
:'status' => :'status',
|
|
43
|
+
:'errors_count' => :'errors_count',
|
|
44
|
+
:'created_at' => :'created_at'
|
|
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
|
+
:'endpoint' => :'String',
|
|
63
|
+
:'credits_cost' => :'Integer',
|
|
64
|
+
:'status' => :'String',
|
|
65
|
+
:'errors_count' => :'Integer',
|
|
66
|
+
:'created_at' => :'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::UsageLogItem` 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::UsageLogItem`. 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?(:'endpoint')
|
|
99
|
+
self.endpoint = attributes[:'endpoint']
|
|
100
|
+
else
|
|
101
|
+
self.endpoint = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'credits_cost')
|
|
105
|
+
self.credits_cost = attributes[:'credits_cost']
|
|
106
|
+
else
|
|
107
|
+
self.credits_cost = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'status')
|
|
111
|
+
self.status = attributes[:'status']
|
|
112
|
+
else
|
|
113
|
+
self.status = nil
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'errors_count')
|
|
117
|
+
self.errors_count = attributes[:'errors_count']
|
|
118
|
+
else
|
|
119
|
+
self.errors_count = nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'created_at')
|
|
123
|
+
self.created_at = attributes[:'created_at']
|
|
124
|
+
else
|
|
125
|
+
self.created_at = nil
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
130
|
+
# @return Array for valid properties with the reasons
|
|
131
|
+
def list_invalid_properties
|
|
132
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
133
|
+
invalid_properties = Array.new
|
|
134
|
+
if @id.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if @endpoint.nil?
|
|
139
|
+
invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @credits_cost.nil?
|
|
143
|
+
invalid_properties.push('invalid value for "credits_cost", credits_cost cannot be nil.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if @status.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if @errors_count.nil?
|
|
151
|
+
invalid_properties.push('invalid value for "errors_count", errors_count cannot be nil.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if @created_at.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
invalid_properties
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Check to see if the all the properties in the model are valid
|
|
162
|
+
# @return true if the model is valid
|
|
163
|
+
def valid?
|
|
164
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
165
|
+
return false if @id.nil?
|
|
166
|
+
return false if @endpoint.nil?
|
|
167
|
+
return false if @credits_cost.nil?
|
|
168
|
+
return false if @status.nil?
|
|
169
|
+
return false if @errors_count.nil?
|
|
170
|
+
return false if @created_at.nil?
|
|
171
|
+
true
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom attribute writer method with validation
|
|
175
|
+
# @param [Object] id Value to be assigned
|
|
176
|
+
def id=(id)
|
|
177
|
+
if id.nil?
|
|
178
|
+
fail ArgumentError, 'id cannot be nil'
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@id = id
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Custom attribute writer method with validation
|
|
185
|
+
# @param [Object] endpoint Value to be assigned
|
|
186
|
+
def endpoint=(endpoint)
|
|
187
|
+
if endpoint.nil?
|
|
188
|
+
fail ArgumentError, 'endpoint cannot be nil'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
@endpoint = endpoint
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Custom attribute writer method with validation
|
|
195
|
+
# @param [Object] credits_cost Value to be assigned
|
|
196
|
+
def credits_cost=(credits_cost)
|
|
197
|
+
if credits_cost.nil?
|
|
198
|
+
fail ArgumentError, 'credits_cost cannot be nil'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
@credits_cost = credits_cost
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method with validation
|
|
205
|
+
# @param [Object] status Value to be assigned
|
|
206
|
+
def status=(status)
|
|
207
|
+
if status.nil?
|
|
208
|
+
fail ArgumentError, 'status cannot be nil'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
@status = status
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Custom attribute writer method with validation
|
|
215
|
+
# @param [Object] errors_count Value to be assigned
|
|
216
|
+
def errors_count=(errors_count)
|
|
217
|
+
if errors_count.nil?
|
|
218
|
+
fail ArgumentError, 'errors_count cannot be nil'
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
@errors_count = errors_count
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Custom attribute writer method with validation
|
|
225
|
+
# @param [Object] created_at Value to be assigned
|
|
226
|
+
def created_at=(created_at)
|
|
227
|
+
if created_at.nil?
|
|
228
|
+
fail ArgumentError, 'created_at cannot be nil'
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
@created_at = created_at
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Checks equality by comparing each attribute.
|
|
235
|
+
# @param [Object] Object to be compared
|
|
236
|
+
def ==(o)
|
|
237
|
+
return true if self.equal?(o)
|
|
238
|
+
self.class == o.class &&
|
|
239
|
+
id == o.id &&
|
|
240
|
+
endpoint == o.endpoint &&
|
|
241
|
+
credits_cost == o.credits_cost &&
|
|
242
|
+
status == o.status &&
|
|
243
|
+
errors_count == o.errors_count &&
|
|
244
|
+
created_at == o.created_at
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# @see the `==` method
|
|
248
|
+
# @param [Object] Object to be compared
|
|
249
|
+
def eql?(o)
|
|
250
|
+
self == o
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Calculates hash code according to all attributes.
|
|
254
|
+
# @return [Integer] Hash code
|
|
255
|
+
def hash
|
|
256
|
+
[id, endpoint, credits_cost, status, errors_count, created_at].hash
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Builds the object from hash
|
|
260
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
261
|
+
# @return [Object] Returns the model itself
|
|
262
|
+
def self.build_from_hash(attributes)
|
|
263
|
+
return nil unless attributes.is_a?(Hash)
|
|
264
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
265
|
+
transformed_hash = {}
|
|
266
|
+
openapi_types.each_pair do |key, type|
|
|
267
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
268
|
+
transformed_hash["#{key}"] = nil
|
|
269
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
270
|
+
# check to ensure the input is an array given that the attribute
|
|
271
|
+
# is documented as an array but the input is not
|
|
272
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
273
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
274
|
+
end
|
|
275
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
276
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
new(transformed_hash)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Returns the object in the form of hash
|
|
283
|
+
# @return [Hash] Returns the object in the form of hash
|
|
284
|
+
def to_hash
|
|
285
|
+
hash = {}
|
|
286
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
287
|
+
value = self.send(attr)
|
|
288
|
+
if value.nil?
|
|
289
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
290
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
hash[param] = _to_hash(value)
|
|
294
|
+
end
|
|
295
|
+
hash
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
end
|