Class: PhaseoSdk::Phaseo
- Inherits:
-
Object
- Object
- PhaseoSdk::Phaseo
- Defined in:
- lib/index.rb
Overview
Thin wrapper around the in-house generated Ruby SDK.
Regenerate with: pnpm openapi:gen:ruby
Constant Summary collapse
- ACTIVE_MODEL_SOURCE_STATUSES =
%w[active available].freeze
- INACTIVE_MODEL_SOURCE_STATUSES =
%w[ deprecated retired withheld announced rumoured rumored unavailable disabled internal private removed sunset eol end_of_life end-of-life ].freeze
Instance Attribute Summary collapse
-
#async_jobs ⇒ Object
readonly
Returns the value of attribute async_jobs.
-
#raw_client ⇒ Object
readonly
Returns the value of attribute raw_client.
Instance Method Summary collapse
- #batch_websocket_url(batch_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
- #calculate_pricing(payload) ⇒ Object
- #cancel_batch(batch_id) ⇒ Object
- #cancel_video(video_id) ⇒ Object
- #create_anthropic_message(payload) ⇒ Object
- #create_api_key(payload) ⇒ Object
- #create_batch(payload) ⇒ Object
- #create_chat_completion(payload) ⇒ Object
- #create_embedding(payload) ⇒ Object
- #create_image(payload) ⇒ Object
- #create_image_edit(payload) ⇒ Object
- #create_moderation(payload) ⇒ Object
- #create_response(payload) ⇒ Object
- #create_speech(payload) ⇒ Object
- #create_transcription(payload) ⇒ Object
- #create_translation(payload) ⇒ Object
- #create_video(payload) ⇒ Object
- #create_workspace(payload) ⇒ Object
- #delete_api_key(id) ⇒ Object
- #delete_video(video_id) ⇒ Object
- #delete_workspace(id) ⇒ Object
- #generate_embedding(payload) ⇒ Object
- #generate_image(payload) ⇒ Object
- #generate_image_edit(payload) ⇒ Object
- #generate_moderation(payload) ⇒ Object
- #generate_response(payload) ⇒ Object
- #generate_speech(payload) ⇒ Object
- #generate_text(payload) ⇒ Object
- #generate_transcription(payload) ⇒ Object
- #generate_translation(payload) ⇒ Object
- #generate_video(payload) ⇒ Object
- #get_activity(options = {}) ⇒ Object
- #get_analytics(options = {}) ⇒ Object
- #get_api_key(id) ⇒ Object
- #get_async_job_websocket_url(kind, job_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
- #get_credits(options = {}) ⇒ Object
- #get_current_api_key ⇒ Object
- #get_generation(generation_id) ⇒ Object
- #get_model_deprecation_info(model_id) ⇒ Object
- #get_video(video_id) ⇒ Object
- #get_video_download_url(video_id, params = {}) ⇒ Object
- #get_workspace(id) ⇒ Object
- #health ⇒ Object
- #healthz ⇒ Object
-
#initialize(api_key: nil, base_path: "https://api.phaseo.app/v1", enable_deprecation_warnings: true, warnings_as_errors: false, logger: nil, lifecycle_resolver: nil, devtools: nil) ⇒ Phaseo
constructor
A new instance of Phaseo.
- #list_api_keys(options = {}) ⇒ Object
- #list_endpoints ⇒ Object
- #list_files(options = {}) ⇒ Object
- #list_models(options = {}) ⇒ Object
- #list_organisations(options = {}) ⇒ Object
- #list_pricing_models(options = {}) ⇒ Object
- #list_providers(options = {}) ⇒ Object
- #list_video_models ⇒ Object
- #list_videos(options = {}) ⇒ Object
- #list_workspaces(options = {}) ⇒ Object
- #retrieve_batch(batch_id) ⇒ Object
- #retrieve_file(file_id) ⇒ Object
- #retrieve_file_content(file_id) ⇒ Object
- #retrieve_video_content(video_id) ⇒ Object
- #stream_response(payload) ⇒ Object
- #update_api_key(id, payload) ⇒ Object
- #update_workspace(id, payload) ⇒ Object
- #upload_file(payload) ⇒ Object
- #validate_model(model_id) ⇒ Object
- #video_websocket_url(video_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
Constructor Details
#initialize(api_key: nil, base_path: "https://api.phaseo.app/v1", enable_deprecation_warnings: true, warnings_as_errors: false, logger: nil, lifecycle_resolver: nil, devtools: nil) ⇒ Phaseo
Returns a new instance of Phaseo.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/index.rb', line 52 def initialize( api_key: nil, base_path: "https://api.phaseo.app/v1", enable_deprecation_warnings: true, warnings_as_errors: false, logger: nil, lifecycle_resolver: nil, devtools: nil ) api_key ||= ENV["PHASEO_API_KEY"] raise ArgumentError, "Missing API key. Pass api_key or set PHASEO_API_KEY." if api_key.to_s.empty? @raw_client = ::Phaseo::Gen::Client.new( base_url: base_path, headers: { "Authorization" => "Bearer #{api_key}" } ) @base_path = base_path.sub(%r{/+\z}, "") @enable_deprecation_warnings = enable_deprecation_warnings @warnings_as_errors = warnings_as_errors @logger = logger @lifecycle_resolver = lifecycle_resolver @warned_models = {} @model_lifecycle_cache = {} @telemetry_recorder = TelemetryRecorder.new(devtools, "2.1.0") @async_jobs = AsyncJobsResource.new(self) end |
Instance Attribute Details
#async_jobs ⇒ Object (readonly)
Returns the value of attribute async_jobs.
50 51 52 |
# File 'lib/index.rb', line 50 def async_jobs @async_jobs end |
#raw_client ⇒ Object (readonly)
Returns the value of attribute raw_client.
50 51 52 |
# File 'lib/index.rb', line 50 def raw_client @raw_client end |
Instance Method Details
#batch_websocket_url(batch_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
273 274 275 |
# File 'lib/index.rb', line 273 def batch_websocket_url(batch_id, interval_ms: nil, close_on_terminal: nil) get_async_job_websocket_url("batch", batch_id, interval_ms: interval_ms, close_on_terminal: close_on_terminal) end |
#calculate_pricing(payload) ⇒ Object
381 382 383 384 385 |
# File 'lib/index.rb', line 381 def calculate_pricing(payload) with_lifecycle_and_telemetry(endpoint: "pricing.calculate", payload: payload, check_lifecycle: false) do ::Phaseo::Gen::Operations.calculatePricing(@raw_client, body: payload) end end |
#cancel_batch(batch_id) ⇒ Object
251 252 253 254 255 |
# File 'lib/index.rb', line 251 def cancel_batch(batch_id) with_lifecycle_and_telemetry(endpoint: "batches.cancel", payload: { "batch_id" => batch_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.cancelBatch(@raw_client, path: { "batch_id" => batch_id }) end end |
#cancel_video(video_id) ⇒ Object
155 156 157 158 159 |
# File 'lib/index.rb', line 155 def cancel_video(video_id) with_lifecycle_and_telemetry(endpoint: "video.cancel", payload: { "video_id" => video_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.cancelVideo(@raw_client, path: { "video_id" => video_id }) end end |
#create_anthropic_message(payload) ⇒ Object
123 124 125 126 127 |
# File 'lib/index.rb', line 123 def (payload) with_lifecycle_and_telemetry(endpoint: "messages", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createAnthropicMessage(@raw_client, body: payload) end end |
#create_api_key(payload) ⇒ Object
393 394 395 396 397 |
# File 'lib/index.rb', line 393 def create_api_key(payload) with_lifecycle_and_telemetry(endpoint: "provisioning.keys.create", payload: payload, check_lifecycle: false) do ::Phaseo::Gen::Operations.createApiKey(@raw_client, body: payload) end end |
#create_batch(payload) ⇒ Object
239 240 241 242 243 |
# File 'lib/index.rb', line 239 def create_batch(payload) with_lifecycle_and_telemetry(endpoint: "batches.create", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createBatch(@raw_client, body: payload) end end |
#create_chat_completion(payload) ⇒ Object
105 106 107 |
# File 'lib/index.rb', line 105 def create_chat_completion(payload) generate_text(payload) end |
#create_embedding(payload) ⇒ Object
195 196 197 |
# File 'lib/index.rb', line 195 def (payload) (payload) end |
#create_image(payload) ⇒ Object
135 136 137 |
# File 'lib/index.rb', line 135 def create_image(payload) generate_image(payload) end |
#create_image_edit(payload) ⇒ Object
185 186 187 |
# File 'lib/index.rb', line 185 def create_image_edit(payload) generate_image_edit(payload) end |
#create_moderation(payload) ⇒ Object
205 206 207 |
# File 'lib/index.rb', line 205 def create_moderation(payload) generate_moderation(payload) end |
#create_response(payload) ⇒ Object
115 116 117 |
# File 'lib/index.rb', line 115 def create_response(payload) generate_response(payload) end |
#create_speech(payload) ⇒ Object
215 216 217 |
# File 'lib/index.rb', line 215 def create_speech(payload) generate_speech(payload) end |
#create_transcription(payload) ⇒ Object
225 226 227 |
# File 'lib/index.rb', line 225 def create_transcription(payload) generate_transcription(payload) end |
#create_translation(payload) ⇒ Object
235 236 237 |
# File 'lib/index.rb', line 235 def create_translation(payload) generate_translation(payload) end |
#create_video(payload) ⇒ Object
145 146 147 |
# File 'lib/index.rb', line 145 def create_video(payload) generate_video(payload) end |
#create_workspace(payload) ⇒ Object
429 430 431 432 433 |
# File 'lib/index.rb', line 429 def create_workspace(payload) with_lifecycle_and_telemetry(endpoint: "provisioning.workspaces.create", payload: payload, check_lifecycle: false) do ::Phaseo::Gen::Operations.createWorkspace(@raw_client, body: payload) end end |
#delete_api_key(id) ⇒ Object
411 412 413 414 415 |
# File 'lib/index.rb', line 411 def delete_api_key(id) with_lifecycle_and_telemetry(endpoint: "provisioning.keys.delete", payload: { "id" => id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.deleteApiKey(@raw_client, path: { "id" => id }) end end |
#delete_video(video_id) ⇒ Object
161 162 163 164 165 |
# File 'lib/index.rb', line 161 def delete_video(video_id) with_lifecycle_and_telemetry(endpoint: "video.delete", payload: { "video_id" => video_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.deleteVideo(@raw_client, path: { "video_id" => video_id }) end end |
#delete_workspace(id) ⇒ Object
445 446 447 448 449 |
# File 'lib/index.rb', line 445 def delete_workspace(id) with_lifecycle_and_telemetry(endpoint: "provisioning.workspaces.delete", payload: { "id" => id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.deleteWorkspace(@raw_client, path: { "id" => id }) end end |
#generate_embedding(payload) ⇒ Object
189 190 191 192 193 |
# File 'lib/index.rb', line 189 def (payload) with_lifecycle_and_telemetry(endpoint: "embeddings", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createEmbedding(@raw_client, body: payload) end end |
#generate_image(payload) ⇒ Object
129 130 131 132 133 |
# File 'lib/index.rb', line 129 def generate_image(payload) with_lifecycle_and_telemetry(endpoint: "images.generations", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createImage(@raw_client, body: payload) end end |
#generate_image_edit(payload) ⇒ Object
179 180 181 182 183 |
# File 'lib/index.rb', line 179 def generate_image_edit(payload) with_lifecycle_and_telemetry(endpoint: "images.edits", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createImageEdit(@raw_client, body: payload) end end |
#generate_moderation(payload) ⇒ Object
199 200 201 202 203 |
# File 'lib/index.rb', line 199 def generate_moderation(payload) with_lifecycle_and_telemetry(endpoint: "moderations", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createModeration(@raw_client, body: payload) end end |
#generate_response(payload) ⇒ Object
109 110 111 112 113 |
# File 'lib/index.rb', line 109 def generate_response(payload) with_lifecycle_and_telemetry(endpoint: "responses", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createResponse(@raw_client, body: payload) end end |
#generate_speech(payload) ⇒ Object
209 210 211 212 213 |
# File 'lib/index.rb', line 209 def generate_speech(payload) with_lifecycle_and_telemetry(endpoint: "audio.speech", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createSpeech(@raw_client, body: payload) end end |
#generate_text(payload) ⇒ Object
99 100 101 102 103 |
# File 'lib/index.rb', line 99 def generate_text(payload) with_lifecycle_and_telemetry(endpoint: "chat.completions", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createChatCompletion(@raw_client, body: payload) end end |
#generate_transcription(payload) ⇒ Object
219 220 221 222 223 |
# File 'lib/index.rb', line 219 def generate_transcription(payload) with_lifecycle_and_telemetry(endpoint: "audio.transcriptions", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createTranscription(@raw_client, body: payload) end end |
#generate_translation(payload) ⇒ Object
229 230 231 232 233 |
# File 'lib/index.rb', line 229 def generate_translation(payload) with_lifecycle_and_telemetry(endpoint: "audio.translations", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createTranslation(@raw_client, body: payload) end end |
#generate_video(payload) ⇒ Object
139 140 141 142 143 |
# File 'lib/index.rb', line 139 def generate_video(payload) with_lifecycle_and_telemetry(endpoint: "video.generations", payload: payload, check_lifecycle: true) do ::Phaseo::Gen::Operations.createVideo(@raw_client, body: payload) end end |
#get_activity(options = {}) ⇒ Object
351 352 353 354 355 |
# File 'lib/index.rb', line 351 def get_activity( = {}) with_lifecycle_and_telemetry(endpoint: "activity", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.getActivity(@raw_client, query: ) end end |
#get_analytics(options = {}) ⇒ Object
339 340 341 342 343 |
# File 'lib/index.rb', line 339 def get_analytics( = {}) with_lifecycle_and_telemetry(endpoint: "analytics", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.getActivityAlias(@raw_client, query: ) end end |
#get_api_key(id) ⇒ Object
399 400 401 402 403 |
# File 'lib/index.rb', line 399 def get_api_key(id) with_lifecycle_and_telemetry(endpoint: "provisioning.keys.get", payload: { "id" => id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.getApiKey(@raw_client, path: { "id" => id }) end end |
#get_async_job_websocket_url(kind, job_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/index.rb', line 257 def get_async_job_websocket_url(kind, job_id, interval_ms: nil, close_on_terminal: nil) normalized_kind = kind.to_s.strip normalized_job_id = job_id.to_s.strip raise ArgumentError, "kind is required" if normalized_kind.empty? raise ArgumentError, "job_id is required" if normalized_job_id.empty? uri = URI.parse(@base_path) uri.scheme = uri.scheme == "https" ? "wss" : "ws" uri.path = "#{uri.path.sub(%r{/+\z}, "")}/async/#{escape_path_segment(normalized_kind)}/#{escape_path_segment(normalized_job_id)}/ws" query = {} query["interval_ms"] = interval_ms.to_s unless interval_ms.nil? query["close_on_terminal"] = close_on_terminal ? "true" : "false" unless close_on_terminal.nil? uri.query = query.empty? ? nil : URI.encode_www_form(query) uri.to_s end |
#get_credits(options = {}) ⇒ Object
345 346 347 348 349 |
# File 'lib/index.rb', line 345 def get_credits( = {}) with_lifecycle_and_telemetry(endpoint: "credits", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.getCredits(@raw_client, query: ) end end |
#get_current_api_key ⇒ Object
451 452 453 454 455 |
# File 'lib/index.rb', line 451 def get_current_api_key with_lifecycle_and_telemetry(endpoint: "key.current", payload: {}, check_lifecycle: false) do ::Phaseo::Gen::Operations.getCurrentApiKey(@raw_client) end end |
#get_generation(generation_id) ⇒ Object
357 358 359 360 361 |
# File 'lib/index.rb', line 357 def get_generation(generation_id) with_lifecycle_and_telemetry(endpoint: "generations.retrieve", payload: { "id" => generation_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.getGeneration(@raw_client, query: { "id" => generation_id }) end end |
#get_model_deprecation_info(model_id) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/index.rb', line 79 def get_model_deprecation_info(model_id) normalized = as_trimmed_string(model_id) return nil unless normalized return @model_lifecycle_cache[normalized] if @model_lifecycle_cache.key?(normalized) info = resolve_model_lifecycle(normalized) @model_lifecycle_cache[normalized] = info info end |
#get_video(video_id) ⇒ Object
149 150 151 152 153 |
# File 'lib/index.rb', line 149 def get_video(video_id) with_lifecycle_and_telemetry(endpoint: "video.retrieve", payload: { "video_id" => video_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.getVideo(@raw_client, path: { "video_id" => video_id }) end end |
#get_video_download_url(video_id, params = {}) ⇒ Object
311 312 313 314 315 316 317 318 319 |
# File 'lib/index.rb', line 311 def get_video_download_url(video_id, params = {}) with_lifecycle_and_telemetry( endpoint: "video.download_url", payload: { "video_id" => video_id, "body" => params }, check_lifecycle: false ) do @raw_client.request(method: "POST", path: "/videos/#{video_id}/download_url", body: params) end end |
#get_workspace(id) ⇒ Object
423 424 425 426 427 |
# File 'lib/index.rb', line 423 def get_workspace(id) with_lifecycle_and_telemetry(endpoint: "provisioning.workspaces.get", payload: { "id" => id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.getWorkspace(@raw_client, path: { "id" => id }) end end |
#health ⇒ Object
457 458 459 460 461 |
# File 'lib/index.rb', line 457 def health with_lifecycle_and_telemetry(endpoint: "health", payload: nil, check_lifecycle: false) do @raw_client.request(method: "GET", path: "/health") end end |
#healthz ⇒ Object
463 464 465 |
# File 'lib/index.rb', line 463 def healthz health end |
#list_api_keys(options = {}) ⇒ Object
387 388 389 390 391 |
# File 'lib/index.rb', line 387 def list_api_keys( = {}) with_lifecycle_and_telemetry(endpoint: "provisioning.keys.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listApiKeys(@raw_client, query: ) end end |
#list_endpoints ⇒ Object
363 364 365 366 367 |
# File 'lib/index.rb', line 363 def list_endpoints with_lifecycle_and_telemetry(endpoint: "endpoints.list", payload: {}, check_lifecycle: false) do ::Phaseo::Gen::Operations.listEndpoints(@raw_client) end end |
#list_files(options = {}) ⇒ Object
287 288 289 290 291 |
# File 'lib/index.rb', line 287 def list_files( = {}) with_lifecycle_and_telemetry(endpoint: "files.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listFiles(@raw_client, query: ) end end |
#list_models(options = {}) ⇒ Object
327 328 329 330 331 |
# File 'lib/index.rb', line 327 def list_models( = {}) with_lifecycle_and_telemetry(endpoint: "models.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listModels(@raw_client, query: ) end end |
#list_organisations(options = {}) ⇒ Object
369 370 371 372 373 |
# File 'lib/index.rb', line 369 def list_organisations( = {}) with_lifecycle_and_telemetry(endpoint: "organisations.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listOrganisations(@raw_client, query: ) end end |
#list_pricing_models(options = {}) ⇒ Object
375 376 377 378 379 |
# File 'lib/index.rb', line 375 def list_pricing_models( = {}) with_lifecycle_and_telemetry(endpoint: "pricing.models", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listPricingModels(@raw_client, query: ) end end |
#list_providers(options = {}) ⇒ Object
333 334 335 336 337 |
# File 'lib/index.rb', line 333 def list_providers( = {}) with_lifecycle_and_telemetry(endpoint: "providers", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listProviders(@raw_client, query: ) end end |
#list_video_models ⇒ Object
167 168 169 170 171 |
# File 'lib/index.rb', line 167 def list_video_models with_lifecycle_and_telemetry(endpoint: "video.models", payload: nil, check_lifecycle: false) do ::Phaseo::Gen::Operations.listVideoModels(@raw_client) end end |
#list_videos(options = {}) ⇒ Object
173 174 175 176 177 |
# File 'lib/index.rb', line 173 def list_videos( = {}) with_lifecycle_and_telemetry(endpoint: "video.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listVideos(@raw_client, query: ) end end |
#list_workspaces(options = {}) ⇒ Object
417 418 419 420 421 |
# File 'lib/index.rb', line 417 def list_workspaces( = {}) with_lifecycle_and_telemetry(endpoint: "provisioning.workspaces.list", payload: , check_lifecycle: false) do ::Phaseo::Gen::Operations.listWorkspaces(@raw_client, query: ) end end |
#retrieve_batch(batch_id) ⇒ Object
245 246 247 248 249 |
# File 'lib/index.rb', line 245 def retrieve_batch(batch_id) with_lifecycle_and_telemetry(endpoint: "batches.retrieve", payload: { "batch_id" => batch_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.retrieveBatch(@raw_client, path: { "batch_id" => batch_id }) end end |
#retrieve_file(file_id) ⇒ Object
293 294 295 296 297 |
# File 'lib/index.rb', line 293 def retrieve_file(file_id) with_lifecycle_and_telemetry(endpoint: "files.retrieve", payload: { "file_id" => file_id }, check_lifecycle: false) do ::Phaseo::Gen::Operations.retrieveFile(@raw_client, path: { "file_id" => file_id }) end end |
#retrieve_file_content(file_id) ⇒ Object
299 300 301 302 303 |
# File 'lib/index.rb', line 299 def retrieve_file_content(file_id) with_lifecycle_and_telemetry(endpoint: "files.content", payload: { "file_id" => file_id }, check_lifecycle: false) do @raw_client.request_bytes(method: "get", path: "/files/#{file_id}/content") end end |
#retrieve_video_content(video_id) ⇒ Object
305 306 307 308 309 |
# File 'lib/index.rb', line 305 def retrieve_video_content(video_id) with_lifecycle_and_telemetry(endpoint: "video.content", payload: { "video_id" => video_id }, check_lifecycle: false) do @raw_client.request_bytes(method: "get", path: "/videos/#{video_id}/content") end end |
#stream_response(payload) ⇒ Object
119 120 121 |
# File 'lib/index.rb', line 119 def stream_response(payload) @raw_client.request_stream(method:"post",path:"/responses",body:payload.merge(stream:true)) end |
#update_api_key(id, payload) ⇒ Object
405 406 407 408 409 |
# File 'lib/index.rb', line 405 def update_api_key(id, payload) with_lifecycle_and_telemetry(endpoint: "provisioning.keys.update", payload: { "id" => id, "body" => payload }, check_lifecycle: false) do ::Phaseo::Gen::Operations.updateApiKey(@raw_client, path: { "id" => id }, body: payload) end end |
#update_workspace(id, payload) ⇒ Object
435 436 437 438 439 440 441 442 443 |
# File 'lib/index.rb', line 435 def update_workspace(id, payload) with_lifecycle_and_telemetry( endpoint: "provisioning.workspaces.update", payload: { "id" => id, **payload }, check_lifecycle: false ) do ::Phaseo::Gen::Operations.updateWorkspace(@raw_client, path: { "id" => id }, body: payload) end end |
#upload_file(payload) ⇒ Object
321 322 323 324 325 |
# File 'lib/index.rb', line 321 def upload_file(payload) with_lifecycle_and_telemetry(endpoint: "files.upload", payload: payload, check_lifecycle: false) do ::Phaseo::Gen::Operations.uploadFile(@raw_client, body: payload) end end |
#validate_model(model_id) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/index.rb', line 89 def validate_model(model_id) info = get_model_deprecation_info(model_id) return { ok: true, info: nil } unless info unless is_model_requestable_for_inference?(info) return { ok: false, info: info, reason: (info) } end { ok: true, info: info } end |
#video_websocket_url(video_id, interval_ms: nil, close_on_terminal: nil) ⇒ Object
277 278 279 |
# File 'lib/index.rb', line 277 def video_websocket_url(video_id, interval_ms: nil, close_on_terminal: nil) get_async_job_websocket_url("video", video_id, interval_ms: interval_ms, close_on_terminal: close_on_terminal) end |