|
1 | 1 | /**
|
2 |
| - * Oracle Cloud Infrastructure Artificial Intelligence Services API |
3 |
| - * OCI AI Service solutions can help Enterprise customers integrate AI into their products immediately using our proven, |
| 2 | + * Language API |
| 3 | + * OCI Language Service solutions can help enterprise customers integrate AI into their products immediately using our proven, |
4 | 4 | pre-trained and custom models or containers, without a need to set up an house team of AI and ML experts.
|
5 | 5 | This allows enterprises to focus on business drivers and development work rather than AI and ML operations, which shortens the time to market.
|
6 | 6 |
|
@@ -119,6 +119,340 @@ export class AIServiceLanguageClient {
|
119 | 119 | );
|
120 | 120 | }
|
121 | 121 |
|
| 122 | + /** |
| 123 | + * Make a detect call to language detection pre-deployed model. |
| 124 | + * This operation does not retry by default if the user has not defined a retry configuration. |
| 125 | + * @param BatchDetectDominantLanguageRequest |
| 126 | + * @return BatchDetectDominantLanguageResponse |
| 127 | + * @throws OciError when an error occurs |
| 128 | + * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/ailanguage/BatchDetectDominantLanguage.ts.html |here} to see how to use BatchDetectDominantLanguage API. |
| 129 | + */ |
| 130 | + public async batchDetectDominantLanguage( |
| 131 | + batchDetectDominantLanguageRequest: requests.BatchDetectDominantLanguageRequest |
| 132 | + ): Promise<responses.BatchDetectDominantLanguageResponse> { |
| 133 | + if (this.logger) |
| 134 | + this.logger.debug("Calling operation AIServiceLanguageClient#batchDetectDominantLanguage."); |
| 135 | + const pathParams = {}; |
| 136 | + |
| 137 | + const queryParams = {}; |
| 138 | + |
| 139 | + let headerParams = { |
| 140 | + "Content-Type": common.Constants.APPLICATION_JSON, |
| 141 | + "opc-request-id": batchDetectDominantLanguageRequest.opcRequestId |
| 142 | + }; |
| 143 | + |
| 144 | + const specRetryConfiguration = common.NoRetryConfigurationDetails; |
| 145 | + const retrier = GenericRetrier.createPreferredRetrier( |
| 146 | + this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, |
| 147 | + batchDetectDominantLanguageRequest.retryConfiguration, |
| 148 | + specRetryConfiguration |
| 149 | + ); |
| 150 | + if (this.logger) retrier.logger = this.logger; |
| 151 | + const request = await composeRequest({ |
| 152 | + baseEndpoint: this._endpoint, |
| 153 | + defaultHeaders: this._defaultHeaders, |
| 154 | + path: "/actions/batchDetectDominantLanguage", |
| 155 | + method: "POST", |
| 156 | + bodyContent: common.ObjectSerializer.serialize( |
| 157 | + batchDetectDominantLanguageRequest.batchDetectDominantLanguageDetails, |
| 158 | + "BatchDetectDominantLanguageDetails", |
| 159 | + model.BatchDetectDominantLanguageDetails.getJsonObj |
| 160 | + ), |
| 161 | + pathParams: pathParams, |
| 162 | + headerParams: headerParams, |
| 163 | + queryParams: queryParams |
| 164 | + }); |
| 165 | + try { |
| 166 | + const response = await retrier.makeServiceCall(this._httpClient, request); |
| 167 | + const sdkResponse = composeResponse({ |
| 168 | + responseObject: <responses.BatchDetectDominantLanguageResponse>{}, |
| 169 | + body: await response.json(), |
| 170 | + bodyKey: "batchDetectDominantLanguageResult", |
| 171 | + bodyModel: model.BatchDetectDominantLanguageResult, |
| 172 | + type: "model.BatchDetectDominantLanguageResult", |
| 173 | + responseHeaders: [ |
| 174 | + { |
| 175 | + value: response.headers.get("opc-request-id"), |
| 176 | + key: "opcRequestId", |
| 177 | + dataType: "string" |
| 178 | + } |
| 179 | + ] |
| 180 | + }); |
| 181 | + |
| 182 | + return sdkResponse; |
| 183 | + } catch (err) { |
| 184 | + throw err; |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + /** |
| 189 | + * Make a batch detect call to entity pre-deployed model |
| 190 | + * This operation does not retry by default if the user has not defined a retry configuration. |
| 191 | + * @param BatchDetectLanguageEntitiesRequest |
| 192 | + * @return BatchDetectLanguageEntitiesResponse |
| 193 | + * @throws OciError when an error occurs |
| 194 | + * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/ailanguage/BatchDetectLanguageEntities.ts.html |here} to see how to use BatchDetectLanguageEntities API. |
| 195 | + */ |
| 196 | + public async batchDetectLanguageEntities( |
| 197 | + batchDetectLanguageEntitiesRequest: requests.BatchDetectLanguageEntitiesRequest |
| 198 | + ): Promise<responses.BatchDetectLanguageEntitiesResponse> { |
| 199 | + if (this.logger) |
| 200 | + this.logger.debug("Calling operation AIServiceLanguageClient#batchDetectLanguageEntities."); |
| 201 | + const pathParams = {}; |
| 202 | + |
| 203 | + const queryParams = {}; |
| 204 | + |
| 205 | + let headerParams = { |
| 206 | + "Content-Type": common.Constants.APPLICATION_JSON, |
| 207 | + "opc-request-id": batchDetectLanguageEntitiesRequest.opcRequestId |
| 208 | + }; |
| 209 | + |
| 210 | + const specRetryConfiguration = common.NoRetryConfigurationDetails; |
| 211 | + const retrier = GenericRetrier.createPreferredRetrier( |
| 212 | + this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, |
| 213 | + batchDetectLanguageEntitiesRequest.retryConfiguration, |
| 214 | + specRetryConfiguration |
| 215 | + ); |
| 216 | + if (this.logger) retrier.logger = this.logger; |
| 217 | + const request = await composeRequest({ |
| 218 | + baseEndpoint: this._endpoint, |
| 219 | + defaultHeaders: this._defaultHeaders, |
| 220 | + path: "/actions/batchDetectLanguageEntities", |
| 221 | + method: "POST", |
| 222 | + bodyContent: common.ObjectSerializer.serialize( |
| 223 | + batchDetectLanguageEntitiesRequest.batchDetectLanguageEntitiesDetails, |
| 224 | + "BatchDetectLanguageEntitiesDetails", |
| 225 | + model.BatchDetectLanguageEntitiesDetails.getJsonObj |
| 226 | + ), |
| 227 | + pathParams: pathParams, |
| 228 | + headerParams: headerParams, |
| 229 | + queryParams: queryParams |
| 230 | + }); |
| 231 | + try { |
| 232 | + const response = await retrier.makeServiceCall(this._httpClient, request); |
| 233 | + const sdkResponse = composeResponse({ |
| 234 | + responseObject: <responses.BatchDetectLanguageEntitiesResponse>{}, |
| 235 | + body: await response.json(), |
| 236 | + bodyKey: "batchDetectLanguageEntitiesResult", |
| 237 | + bodyModel: model.BatchDetectLanguageEntitiesResult, |
| 238 | + type: "model.BatchDetectLanguageEntitiesResult", |
| 239 | + responseHeaders: [ |
| 240 | + { |
| 241 | + value: response.headers.get("opc-request-id"), |
| 242 | + key: "opcRequestId", |
| 243 | + dataType: "string" |
| 244 | + } |
| 245 | + ] |
| 246 | + }); |
| 247 | + |
| 248 | + return sdkResponse; |
| 249 | + } catch (err) { |
| 250 | + throw err; |
| 251 | + } |
| 252 | + } |
| 253 | + |
| 254 | + /** |
| 255 | + * Make a detect call to the keyPhrase pre-deployed model. |
| 256 | + * This operation does not retry by default if the user has not defined a retry configuration. |
| 257 | + * @param BatchDetectLanguageKeyPhrasesRequest |
| 258 | + * @return BatchDetectLanguageKeyPhrasesResponse |
| 259 | + * @throws OciError when an error occurs |
| 260 | + * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/ailanguage/BatchDetectLanguageKeyPhrases.ts.html |here} to see how to use BatchDetectLanguageKeyPhrases API. |
| 261 | + */ |
| 262 | + public async batchDetectLanguageKeyPhrases( |
| 263 | + batchDetectLanguageKeyPhrasesRequest: requests.BatchDetectLanguageKeyPhrasesRequest |
| 264 | + ): Promise<responses.BatchDetectLanguageKeyPhrasesResponse> { |
| 265 | + if (this.logger) |
| 266 | + this.logger.debug("Calling operation AIServiceLanguageClient#batchDetectLanguageKeyPhrases."); |
| 267 | + const pathParams = {}; |
| 268 | + |
| 269 | + const queryParams = {}; |
| 270 | + |
| 271 | + let headerParams = { |
| 272 | + "Content-Type": common.Constants.APPLICATION_JSON, |
| 273 | + "opc-request-id": batchDetectLanguageKeyPhrasesRequest.opcRequestId |
| 274 | + }; |
| 275 | + |
| 276 | + const specRetryConfiguration = common.NoRetryConfigurationDetails; |
| 277 | + const retrier = GenericRetrier.createPreferredRetrier( |
| 278 | + this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, |
| 279 | + batchDetectLanguageKeyPhrasesRequest.retryConfiguration, |
| 280 | + specRetryConfiguration |
| 281 | + ); |
| 282 | + if (this.logger) retrier.logger = this.logger; |
| 283 | + const request = await composeRequest({ |
| 284 | + baseEndpoint: this._endpoint, |
| 285 | + defaultHeaders: this._defaultHeaders, |
| 286 | + path: "/actions/batchDetectLanguageKeyPhrases", |
| 287 | + method: "POST", |
| 288 | + bodyContent: common.ObjectSerializer.serialize( |
| 289 | + batchDetectLanguageKeyPhrasesRequest.batchDetectLanguageKeyPhrasesDetails, |
| 290 | + "BatchDetectLanguageKeyPhrasesDetails", |
| 291 | + model.BatchDetectLanguageKeyPhrasesDetails.getJsonObj |
| 292 | + ), |
| 293 | + pathParams: pathParams, |
| 294 | + headerParams: headerParams, |
| 295 | + queryParams: queryParams |
| 296 | + }); |
| 297 | + try { |
| 298 | + const response = await retrier.makeServiceCall(this._httpClient, request); |
| 299 | + const sdkResponse = composeResponse({ |
| 300 | + responseObject: <responses.BatchDetectLanguageKeyPhrasesResponse>{}, |
| 301 | + body: await response.json(), |
| 302 | + bodyKey: "batchDetectLanguageKeyPhrasesResult", |
| 303 | + bodyModel: model.BatchDetectLanguageKeyPhrasesResult, |
| 304 | + type: "model.BatchDetectLanguageKeyPhrasesResult", |
| 305 | + responseHeaders: [ |
| 306 | + { |
| 307 | + value: response.headers.get("opc-request-id"), |
| 308 | + key: "opcRequestId", |
| 309 | + dataType: "string" |
| 310 | + } |
| 311 | + ] |
| 312 | + }); |
| 313 | + |
| 314 | + return sdkResponse; |
| 315 | + } catch (err) { |
| 316 | + throw err; |
| 317 | + } |
| 318 | + } |
| 319 | + |
| 320 | + /** |
| 321 | + * Make a detect call to sentiment pre-deployed model. |
| 322 | + * This operation does not retry by default if the user has not defined a retry configuration. |
| 323 | + * @param BatchDetectLanguageSentimentsRequest |
| 324 | + * @return BatchDetectLanguageSentimentsResponse |
| 325 | + * @throws OciError when an error occurs |
| 326 | + * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/ailanguage/BatchDetectLanguageSentiments.ts.html |here} to see how to use BatchDetectLanguageSentiments API. |
| 327 | + */ |
| 328 | + public async batchDetectLanguageSentiments( |
| 329 | + batchDetectLanguageSentimentsRequest: requests.BatchDetectLanguageSentimentsRequest |
| 330 | + ): Promise<responses.BatchDetectLanguageSentimentsResponse> { |
| 331 | + if (this.logger) |
| 332 | + this.logger.debug("Calling operation AIServiceLanguageClient#batchDetectLanguageSentiments."); |
| 333 | + const pathParams = {}; |
| 334 | + |
| 335 | + const queryParams = { |
| 336 | + "level": batchDetectLanguageSentimentsRequest.level |
| 337 | + }; |
| 338 | + |
| 339 | + let headerParams = { |
| 340 | + "Content-Type": common.Constants.APPLICATION_JSON, |
| 341 | + "opc-request-id": batchDetectLanguageSentimentsRequest.opcRequestId |
| 342 | + }; |
| 343 | + |
| 344 | + const specRetryConfiguration = common.NoRetryConfigurationDetails; |
| 345 | + const retrier = GenericRetrier.createPreferredRetrier( |
| 346 | + this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, |
| 347 | + batchDetectLanguageSentimentsRequest.retryConfiguration, |
| 348 | + specRetryConfiguration |
| 349 | + ); |
| 350 | + if (this.logger) retrier.logger = this.logger; |
| 351 | + const request = await composeRequest({ |
| 352 | + baseEndpoint: this._endpoint, |
| 353 | + defaultHeaders: this._defaultHeaders, |
| 354 | + path: "/actions/batchDetectLanguageSentiments", |
| 355 | + method: "POST", |
| 356 | + bodyContent: common.ObjectSerializer.serialize( |
| 357 | + batchDetectLanguageSentimentsRequest.batchDetectLanguageSentimentsDetails, |
| 358 | + "BatchDetectLanguageSentimentsDetails", |
| 359 | + model.BatchDetectLanguageSentimentsDetails.getJsonObj |
| 360 | + ), |
| 361 | + pathParams: pathParams, |
| 362 | + headerParams: headerParams, |
| 363 | + queryParams: queryParams |
| 364 | + }); |
| 365 | + try { |
| 366 | + const response = await retrier.makeServiceCall(this._httpClient, request); |
| 367 | + const sdkResponse = composeResponse({ |
| 368 | + responseObject: <responses.BatchDetectLanguageSentimentsResponse>{}, |
| 369 | + body: await response.json(), |
| 370 | + bodyKey: "batchDetectLanguageSentimentsResult", |
| 371 | + bodyModel: model.BatchDetectLanguageSentimentsResult, |
| 372 | + type: "model.BatchDetectLanguageSentimentsResult", |
| 373 | + responseHeaders: [ |
| 374 | + { |
| 375 | + value: response.headers.get("opc-request-id"), |
| 376 | + key: "opcRequestId", |
| 377 | + dataType: "string" |
| 378 | + } |
| 379 | + ] |
| 380 | + }); |
| 381 | + |
| 382 | + return sdkResponse; |
| 383 | + } catch (err) { |
| 384 | + throw err; |
| 385 | + } |
| 386 | + } |
| 387 | + |
| 388 | + /** |
| 389 | + * Make a detect call to text classification from the pre-deployed model. |
| 390 | + * This operation does not retry by default if the user has not defined a retry configuration. |
| 391 | + * @param BatchDetectLanguageTextClassificationRequest |
| 392 | + * @return BatchDetectLanguageTextClassificationResponse |
| 393 | + * @throws OciError when an error occurs |
| 394 | + * @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/latest/ailanguage/BatchDetectLanguageTextClassification.ts.html |here} to see how to use BatchDetectLanguageTextClassification API. |
| 395 | + */ |
| 396 | + public async batchDetectLanguageTextClassification( |
| 397 | + batchDetectLanguageTextClassificationRequest: requests.BatchDetectLanguageTextClassificationRequest |
| 398 | + ): Promise<responses.BatchDetectLanguageTextClassificationResponse> { |
| 399 | + if (this.logger) |
| 400 | + this.logger.debug( |
| 401 | + "Calling operation AIServiceLanguageClient#batchDetectLanguageTextClassification." |
| 402 | + ); |
| 403 | + const pathParams = {}; |
| 404 | + |
| 405 | + const queryParams = {}; |
| 406 | + |
| 407 | + let headerParams = { |
| 408 | + "Content-Type": common.Constants.APPLICATION_JSON, |
| 409 | + "opc-request-id": batchDetectLanguageTextClassificationRequest.opcRequestId |
| 410 | + }; |
| 411 | + |
| 412 | + const specRetryConfiguration = common.NoRetryConfigurationDetails; |
| 413 | + const retrier = GenericRetrier.createPreferredRetrier( |
| 414 | + this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, |
| 415 | + batchDetectLanguageTextClassificationRequest.retryConfiguration, |
| 416 | + specRetryConfiguration |
| 417 | + ); |
| 418 | + if (this.logger) retrier.logger = this.logger; |
| 419 | + const request = await composeRequest({ |
| 420 | + baseEndpoint: this._endpoint, |
| 421 | + defaultHeaders: this._defaultHeaders, |
| 422 | + path: "/actions/batchDetectLanguageTextClassification", |
| 423 | + method: "POST", |
| 424 | + bodyContent: common.ObjectSerializer.serialize( |
| 425 | + batchDetectLanguageTextClassificationRequest.batchDetectLanguageTextClassificationDetails, |
| 426 | + "BatchDetectLanguageTextClassificationDetails", |
| 427 | + model.BatchDetectLanguageTextClassificationDetails.getJsonObj |
| 428 | + ), |
| 429 | + pathParams: pathParams, |
| 430 | + headerParams: headerParams, |
| 431 | + queryParams: queryParams |
| 432 | + }); |
| 433 | + try { |
| 434 | + const response = await retrier.makeServiceCall(this._httpClient, request); |
| 435 | + const sdkResponse = composeResponse({ |
| 436 | + responseObject: <responses.BatchDetectLanguageTextClassificationResponse>{}, |
| 437 | + body: await response.json(), |
| 438 | + bodyKey: "batchDetectLanguageTextClassificationResult", |
| 439 | + bodyModel: model.BatchDetectLanguageTextClassificationResult, |
| 440 | + type: "model.BatchDetectLanguageTextClassificationResult", |
| 441 | + responseHeaders: [ |
| 442 | + { |
| 443 | + value: response.headers.get("opc-request-id"), |
| 444 | + key: "opcRequestId", |
| 445 | + dataType: "string" |
| 446 | + } |
| 447 | + ] |
| 448 | + }); |
| 449 | + |
| 450 | + return sdkResponse; |
| 451 | + } catch (err) { |
| 452 | + throw err; |
| 453 | + } |
| 454 | + } |
| 455 | + |
122 | 456 | /**
|
123 | 457 | * Make a detect call to language detection pre-deployed model.
|
124 | 458 | * This operation does not retry by default if the user has not defined a retry configuration.
|
|
0 commit comments