AIServiceLanguageClient

class oci.ai_language.AIServiceLanguageClient(config, **kwargs)
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.

Methods

__init__(config, **kwargs) Creates a new service client
batch_detect_dominant_language(…) Make a detect call to language detection pre-deployed model.
batch_detect_language_entities(…) Make a batch detect call to entity pre-deployed model
batch_detect_language_key_phrases(…) Make a detect call to the keyPhrase pre-deployed model.
batch_detect_language_sentiments(…) Make a detect call to sentiment pre-deployed model.
batch_detect_language_text_classification(…) Make a detect call to text classification from the pre-deployed model.
detect_dominant_language(…) Make a detect call to language detection pre-deployed model.
detect_language_entities(…) Make a detect call to enitiy pre-deployed model
detect_language_key_phrases(…) Make a detect call to the keyPhrase pre-deployed model.
detect_language_sentiments(…) Make a detect call to sentiment pre-deployed model.
detect_language_text_classification(…) Make a detect call to text classification from the pre-deployed model.
__init__(config, **kwargs)

Creates a new service client

Parameters:
  • config (dict) – Configuration keys and values as per SDK and Tool Configuration. The from_file() method can be used to load configuration from a file. Alternatively, a dict can be passed. You can validate_config the dict using validate_config()
  • service_endpoint (str) – (optional) The endpoint of the service to call using this client. For example https://iaas.us-ashburn-1.oraclecloud.com. If this keyword argument is not provided then it will be derived using the region in the config parameter. You should only provide this keyword argument if you have an explicit need to specify a service endpoint.
  • timeout (float or tuple(float, float)) – (optional) The connection and read timeouts for the client. The default values are connection timeout 10 seconds and read timeout 60 seconds. This keyword argument can be provided as a single float, in which case the value provided is used for both the read and connection timeouts, or as a tuple of two floats. If a tuple is provided then the first value is used as the connection timeout and the second value as the read timeout.
  • signer (AbstractBaseSigner) –

    (optional) The signer to use when signing requests made by the service client. The default is to use a Signer based on the values provided in the config parameter.

    One use case for this parameter is for Instance Principals authentication by passing an instance of InstancePrincipalsSecurityTokenSigner as the value for this keyword argument

  • retry_strategy (obj) –

    (optional) A retry strategy to apply to all calls made by this service client (i.e. at the client level). There is no retry strategy applied by default. Retry strategies can also be applied at the operation level by passing a retry_strategy keyword argument as part of calling the operation. Any value provided at the operation level will override whatever is specified at the client level.

    This should be one of the strategies available in the retry module. A convenience DEFAULT_RETRY_STRATEGY is also available. The specifics of the default retry strategy are described here.

  • circuit_breaker_strategy (obj) – (optional) A circuit breaker strategy to apply to all calls made by this service client (i.e. at the client level). This client uses DEFAULT_CIRCUIT_BREAKER_STRATEGY as default if no circuit breaker strategy is provided. The specifics of circuit breaker strategy are described here.
  • circuit_breaker_callback (function) – (optional) Callback function to receive any exceptions triggerred by the circuit breaker.
  • allow_control_chars – (optional) allow_control_chars is a boolean to indicate whether or not this client should allow control characters in the response object. By default, the client will not allow control characters to be in the response object.
batch_detect_dominant_language(batch_detect_dominant_language_details, **kwargs)

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

Parameters:
  • batch_detect_dominant_language_details (oci.ai_language.models.BatchDetectDominantLanguageDetails) – (required) The details to make a language detection detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type BatchDetectDominantLanguageResult

Return type:

Response

Example:

Click here to see an example of how to use batch_detect_dominant_language API.

batch_detect_language_entities(batch_detect_language_entities_details, **kwargs)

Make a batch detect call to entity pre-deployed model

Parameters:
  • batch_detect_language_entities_details (oci.ai_language.models.BatchDetectLanguageEntitiesDetails) – (required) The details to make a Entity detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type BatchDetectLanguageEntitiesResult

Return type:

Response

Example:

Click here to see an example of how to use batch_detect_language_entities API.

batch_detect_language_key_phrases(batch_detect_language_key_phrases_details, **kwargs)

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

Parameters:
  • batch_detect_language_key_phrases_details (oci.ai_language.models.BatchDetectLanguageKeyPhrasesDetails) – (required) The details to make keyPhrase detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type BatchDetectLanguageKeyPhrasesResult

Return type:

Response

Example:

Click here to see an example of how to use batch_detect_language_key_phrases API.

batch_detect_language_sentiments(batch_detect_language_sentiments_details, **kwargs)

Make a detect call to sentiment pre-deployed model.

Parameters:
  • batch_detect_language_sentiments_details (oci.ai_language.models.BatchDetectLanguageSentimentsDetails) – (required) The details to make sentiment detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • level (list[str]) –

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

    • ASPECT
    • SENTENCE

    Allowed values are: “ASPECT”, “SENTENCE”

  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type BatchDetectLanguageSentimentsResult

Return type:

Response

Example:

Click here to see an example of how to use batch_detect_language_sentiments API.

batch_detect_language_text_classification(batch_detect_language_text_classification_details, **kwargs)

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

Parameters:
  • batch_detect_language_text_classification_details (oci.ai_language.models.BatchDetectLanguageTextClassificationDetails) – (required) The details to make text classification detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type BatchDetectLanguageTextClassificationResult

Return type:

Response

Example:

Click here to see an example of how to use batch_detect_language_text_classification API.

detect_dominant_language(detect_dominant_language_details, **kwargs)

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

Parameters:
  • detect_dominant_language_details (oci.ai_language.models.DetectDominantLanguageDetails) – (required) The details to make a language detection detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type DetectDominantLanguageResult

Return type:

Response

Example:

Click here to see an example of how to use detect_dominant_language API.

detect_language_entities(detect_language_entities_details, **kwargs)

Make a detect call to enitiy pre-deployed model

Parameters:
  • detect_language_entities_details (oci.ai_language.models.DetectLanguageEntitiesDetails) – (required) The details to make a Entity detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • model_version (str) –

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

    Allowed values are: “V2.1”, “V1.1”

  • is_pii (bool) – (optional) 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.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type DetectLanguageEntitiesResult

Return type:

Response

Example:

Click here to see an example of how to use detect_language_entities API.

detect_language_key_phrases(detect_language_key_phrases_details, **kwargs)

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

Parameters:
  • detect_language_key_phrases_details (oci.ai_language.models.DetectLanguageKeyPhrasesDetails) – (required) The details to make keyPhrase detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type DetectLanguageKeyPhrasesResult

Return type:

Response

Example:

Click here to see an example of how to use detect_language_key_phrases API.

detect_language_sentiments(detect_language_sentiments_details, **kwargs)

Make a detect call to sentiment pre-deployed model.

Parameters:
  • detect_language_sentiments_details (oci.ai_language.models.DetectLanguageSentimentsDetails) – (required) The details to make sentiment detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type DetectLanguageSentimentsResult

Return type:

Response

Example:

Click here to see an example of how to use detect_language_sentiments API.

detect_language_text_classification(detect_language_text_classification_details, **kwargs)

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

Parameters:
  • detect_language_text_classification_details (oci.ai_language.models.DetectLanguageTextClassificationDetails) – (required) The details to make text classification detect call.
  • opc_request_id (str) – (optional) The client request ID for tracing.
  • retry_strategy (obj) –

    (optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

    This should be one of the strategies available in the retry module. This operation will not retry by default, users can also use the convenient DEFAULT_RETRY_STRATEGY provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.

    To have this operation explicitly not perform any retries, pass an instance of NoneRetryStrategy.

  • allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns:

A Response object with data of type DetectLanguageTextClassificationResult

Return type:

Response

Example:

Click here to see an example of how to use detect_language_text_classification API.