Class: OCI::AiLanguage::AIServiceLanguageClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_language/ai_service_language_client.rb

Overview

OCI Language Service solutions can help enterprise customers integrate AI into their products immediately using our proven,

pre-trained and custom models or containers, without a need to set up an house team of AI and ML experts.
This allows enterprises to focus on business drivers and development work rather than AI and ML operations, which shortens the time to market.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) ⇒ AIServiceLanguageClient

Creates a new AIServiceLanguageClient. Notes:

If a config is not specified, then the global OCI.config will be used.

This client is not thread-safe

Either a region or an endpoint must be specified.  If an endpoint is specified, it will be used instead of the
  region. A region may be specified in the config or via or the region parameter. If specified in both, then the
  region parameter will be used.

Parameters:

  • config (Config) (defaults to: nil)

    A Config object.

  • region (String) (defaults to: nil)

    A region used to determine the service endpoint. This will usually correspond to a value in Regions::REGION_ENUM, but may be an arbitrary string.

  • endpoint (String) (defaults to: nil)

    The fully qualified endpoint URL

  • signer (OCI::BaseSigner) (defaults to: nil)

    A signer implementation which can be used by this client. If this is not provided then a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication, so that the instance principals signer can be provided to the client

  • proxy_settings (OCI::ApiClientProxySettings) (defaults to: nil)

    If your environment requires you to use a proxy server for outgoing HTTP requests the details for the proxy can be provided in this parameter

  • retry_config (OCI::Retry::RetryConfig) (defaults to: nil)

    The retry configuration for this service client. This represents the default retry configuration to apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is nil, which means that an operation will not perform any retries



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 55

def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
  # If the signer is an InstancePrincipalsSecurityTokenSigner or SecurityTokenSigner and no config was supplied (they are self-sufficient signers)
  # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
  # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
  # pass it to this constructor.
  #
  # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
  # so try and load the config from the default file.
  config = OCI::Config.validate_and_build_config_with_signer(config, signer)

  signer = OCI::Signer.config_file_auth_builder(config) if signer.nil?

  @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
  @retry_config = retry_config

  if endpoint
    @endpoint = endpoint + '/20210101'
  else
    region ||= config.region
    region ||= signer.region if signer.respond_to?(:region)
    self.region = region
  end
  logger.info "AIServiceLanguageClient endpoint set to '#{@endpoint}'." if logger
end

Instance Attribute Details

#api_clientOCI::ApiClient (readonly)

Client used to make HTTP requests.

Returns:



15
16
17
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 15

def api_client
  @api_client
end

#endpointString (readonly)

Fully qualified endpoint URL

Returns:

  • (String)


19
20
21
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 19

def endpoint
  @endpoint
end

#regionString

The region, which will usually correspond to a value in Regions::REGION_ENUM.

Returns:

  • (String)


29
30
31
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 29

def region
  @region
end

#retry_configOCI::Retry::RetryConfig (readonly)

The default retry configuration to apply to all operations in this service client. This can be overridden on a per-operation basis. The default retry configuration value is nil, which means that an operation will not perform any retries



25
26
27
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 25

def retry_config
  @retry_config
end

Instance Method Details

#batch_detect_dominant_language(batch_detect_dominant_language_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/batch_detect_dominant_language.rb.html) to see an example of how to use batch_detect_dominant_language API.

Make a detect call to language detection pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 112

def batch_detect_dominant_language(batch_detect_dominant_language_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#batch_detect_dominant_language.' if logger

  raise "Missing the required parameter 'batch_detect_dominant_language_details' when calling batch_detect_dominant_language." if batch_detect_dominant_language_details.nil?

  path = '/actions/batchDetectDominantLanguage'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(batch_detect_dominant_language_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#batch_detect_dominant_language') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::BatchDetectDominantLanguageResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#batch_detect_language_entities(batch_detect_language_entities_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/batch_detect_language_entities.rb.html) to see an example of how to use batch_detect_language_entities API.

Make a batch detect call to entity pre-deployed model

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 166

def batch_detect_language_entities(batch_detect_language_entities_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#batch_detect_language_entities.' if logger

  raise "Missing the required parameter 'batch_detect_language_entities_details' when calling batch_detect_language_entities." if batch_detect_language_entities_details.nil?

  path = '/actions/batchDetectLanguageEntities'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(batch_detect_language_entities_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#batch_detect_language_entities') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::BatchDetectLanguageEntitiesResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#batch_detect_language_key_phrases(batch_detect_language_key_phrases_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/batch_detect_language_key_phrases.rb.html) to see an example of how to use batch_detect_language_key_phrases API.

Make a detect call to the keyPhrase pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 220

def batch_detect_language_key_phrases(batch_detect_language_key_phrases_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#batch_detect_language_key_phrases.' if logger

  raise "Missing the required parameter 'batch_detect_language_key_phrases_details' when calling batch_detect_language_key_phrases." if batch_detect_language_key_phrases_details.nil?

  path = '/actions/batchDetectLanguageKeyPhrases'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(batch_detect_language_key_phrases_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#batch_detect_language_key_phrases') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::BatchDetectLanguageKeyPhrasesResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#batch_detect_language_sentiments(batch_detect_language_sentiments_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/batch_detect_language_sentiments.rb.html) to see an example of how to use batch_detect_language_sentiments API.

Make a detect call to sentiment pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

  • :level (Array<String>)

    Set this parameter for sentence and aspect level sentiment analysis. Allowed values are:

    - ASPECT
    - SENTENCE
    

    Allowed values are: ASPECT, SENTENCE

Returns:



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 280

def batch_detect_language_sentiments(batch_detect_language_sentiments_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#batch_detect_language_sentiments.' if logger

  raise "Missing the required parameter 'batch_detect_language_sentiments_details' when calling batch_detect_language_sentiments." if batch_detect_language_sentiments_details.nil?


  level_allowable_values = %w[ASPECT SENTENCE]
  if opts[:level] && !opts[:level].empty?
    opts[:level].each do |val_to_check|
      unless level_allowable_values.include?(val_to_check)
        raise 'Invalid value for "level", must be one of ASPECT, SENTENCE.'
      end
    end
  end

  path = '/actions/batchDetectLanguageSentiments'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:level] = OCI::ApiClient.build_collection_params(opts[:level], :multi) if opts[:level] && !opts[:level].empty?

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(batch_detect_language_sentiments_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#batch_detect_language_sentiments') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::BatchDetectLanguageSentimentsResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#batch_detect_language_text_classification(batch_detect_language_text_classification_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/batch_detect_language_text_classification.rb.html) to see an example of how to use batch_detect_language_text_classification API.

Make a detect call to text classification from the pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 345

def batch_detect_language_text_classification(batch_detect_language_text_classification_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#batch_detect_language_text_classification.' if logger

  raise "Missing the required parameter 'batch_detect_language_text_classification_details' when calling batch_detect_language_text_classification." if batch_detect_language_text_classification_details.nil?

  path = '/actions/batchDetectLanguageTextClassification'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(batch_detect_language_text_classification_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#batch_detect_language_text_classification') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::BatchDetectLanguageTextClassificationResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#detect_dominant_language(detect_dominant_language_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/detect_dominant_language.rb.html) to see an example of how to use detect_dominant_language API.

Make a detect call to language detection pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 399

def detect_dominant_language(detect_dominant_language_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#detect_dominant_language.' if logger

  raise "Missing the required parameter 'detect_dominant_language_details' when calling detect_dominant_language." if detect_dominant_language_details.nil?

  path = '/actions/detectDominantLanguage'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(detect_dominant_language_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#detect_dominant_language') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::DetectDominantLanguageResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#detect_language_entities(detect_language_entities_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/detect_language_entities.rb.html) to see an example of how to use detect_language_entities API.

Make a detect call to enitiy pre-deployed model

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

  • :model_version (String)

    Named Entity Recognition model versions. By default user will get output from V2.1 implementation. (default to V2.1)

  • :is_pii (BOOLEAN)

    If this parameter is set to true, you only get PII (Personally identifiable information) entities like PhoneNumber, Email, Person, and so on. Default value is false.

    (default to false)
    

Returns:



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 457

def detect_language_entities(detect_language_entities_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#detect_language_entities.' if logger

  raise "Missing the required parameter 'detect_language_entities_details' when calling detect_language_entities." if detect_language_entities_details.nil?

  if opts[:model_version] && !OCI::AiLanguage::Models::NER_MODEL_VERSION_ENUM.include?(opts[:model_version])
    raise 'Invalid value for "model_version", must be one of the values in OCI::AiLanguage::Models::NER_MODEL_VERSION_ENUM.'
  end

  path = '/actions/detectLanguageEntities'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:modelVersion] = opts[:model_version] if opts[:model_version]
  query_params[:isPii] = opts[:is_pii] if !opts[:is_pii].nil?

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(detect_language_entities_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#detect_language_entities') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::DetectLanguageEntitiesResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#detect_language_key_phrases(detect_language_key_phrases_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/detect_language_key_phrases.rb.html) to see an example of how to use detect_language_key_phrases API.

Make a detect call to the keyPhrase pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 517

def detect_language_key_phrases(detect_language_key_phrases_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#detect_language_key_phrases.' if logger

  raise "Missing the required parameter 'detect_language_key_phrases_details' when calling detect_language_key_phrases." if detect_language_key_phrases_details.nil?

  path = '/actions/detectLanguageKeyPhrases'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(detect_language_key_phrases_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#detect_language_key_phrases') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::DetectLanguageKeyPhrasesResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#detect_language_sentiments(detect_language_sentiments_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/detect_language_sentiments.rb.html) to see an example of how to use detect_language_sentiments API.

Make a detect call to sentiment pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 571

def detect_language_sentiments(detect_language_sentiments_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#detect_language_sentiments.' if logger

  raise "Missing the required parameter 'detect_language_sentiments_details' when calling detect_language_sentiments." if detect_language_sentiments_details.nil?

  path = '/actions/detectLanguageSentiments'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(detect_language_sentiments_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#detect_language_sentiments') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::DetectLanguageSentimentsResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#detect_language_text_classification(detect_language_text_classification_details, opts = {}) ⇒ Response

Note:

Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/ailanguage/detect_language_text_classification.rb.html) to see an example of how to use detect_language_text_classification API.

Make a detect call to text classification from the pre-deployed model.

Parameters:

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The client request ID for tracing.

Returns:



625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 625

def detect_language_text_classification(detect_language_text_classification_details, opts = {})
  logger.debug 'Calling operation AIServiceLanguageClient#detect_language_text_classification.' if logger

  raise "Missing the required parameter 'detect_language_text_classification_details' when calling detect_language_text_classification." if detect_language_text_classification_details.nil?

  path = '/actions/detectLanguageTextClassification'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(detect_language_text_classification_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'AIServiceLanguageClient#detect_language_text_classification') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::AiLanguage::Models::DetectLanguageTextClassificationResult'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

#loggerLogger

Returns The logger for this client. May be nil.

Returns:

  • (Logger)

    The logger for this client. May be nil.



94
95
96
# File 'lib/oci/ai_language/ai_service_language_client.rb', line 94

def logger
  @api_client.config.logger
end