Skip to content

Commit

Permalink
Add implementation for Cognitive Services Bing Auto Suggest (#2264)
Browse files Browse the repository at this point in the history
* Add implementation for Cognitive Services Bing Auto Suggest
* Update pom.xml files to reflect the new directory structure in github and bump version to 1.0.2
* Update LUIS Runtime auto-gen'ed SDK files using latest specs.
* Update ComputerVision auto-gen'ed SDK files using latest specs.
* Generate SDKs for CustomVision Prediction and Training.
  • Loading branch information
milismsft authored Jul 26, 2018
1 parent 5887834 commit f35615f
Show file tree
Hide file tree
Showing 175 changed files with 20,140 additions and 1,030 deletions.
6 changes: 3 additions & 3 deletions cognitiveservices/data-plane/language/bingspellcheck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<parent>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.1</version>
<version>1.0.2</version>
<artifactId>azure-cognitiveservices-spellcheck</artifactId>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for Cognitive Service Spell Check</name>
<description>This package contains Microsoft Cognitive Service Spell Check SDK.</description>
<url>https://github.com/Azure/azure-sdk-for-java/azure-cognitiveservices/language/bingspellcheck</url>
<url>https://github.com/Azure/azure-sdk-for-java/cognitiveservices/data-plane/language/bingspellcheck</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
Expand Down
8 changes: 4 additions & 4 deletions cognitiveservices/data-plane/language/luis/authoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<parent>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>azure-cognitiveservices-languageunderstanding-authoring</artifactId>
<version>1.0.1-beta</version>
<artifactId>azure-cognitiveservices-luis-authoring</artifactId>
<version>1.0.2-beta</version>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for Cognitive Service Language Understanding (LUIS)</name>
<description>This package contains Microsoft Cognitive Service Language Understanding (LUIS).</description>
<url>https://github.com/Azure/azure-sdk-for-java/azure-cognitiveservices/language/luis/authoring</url>
<url>https://github.com/Azure/azure-sdk-for-java/cognitiveservices/data-plane/language/luis/authoring</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
Expand Down
6 changes: 3 additions & 3 deletions cognitiveservices/data-plane/language/luis/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<parent>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>azure-cognitiveservices-luis-runtime</artifactId>
<version>1.0.1-beta</version>
<version>1.0.2-beta</version>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for Cognitive Service Language Understanding (LUIS) Runtime</name>
<description>This package contains Microsoft Cognitive Service Language Understanding (LUIS) Runtime.</description>
<url>https://github.com/Azure/azure-sdk-for-java/azure-cognitiveservices/language/luis/runtime</url>
<url>https://github.com/Azure/azure-sdk-for-java/cognitiveservices/data-plane/language/luis/runtime</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package com.microsoft.azure.cognitiveservices.language.luis.runtime;

import com.microsoft.azure.AzureClient;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.AzureRegions;
import com.microsoft.rest.RestClient;

/**
Expand All @@ -36,21 +35,6 @@ public interface LuisRuntimeAPI {
*/
String userAgent();

/**
* Gets Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'.
*
* @return the azureRegion value.
*/
AzureRegions azureRegion();

/**
* Sets Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'.
*
* @param azureRegion the azureRegion value.
* @return the service client itself
*/
LuisRuntimeAPI withAzureRegion(AzureRegions azureRegion);

/**
* Gets Gets or sets the preferred language for the response..
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.microsoft.azure.cognitiveservices.language.luis.runtime;

import com.microsoft.azure.cognitiveservices.language.luis.runtime.implementation.LuisRuntimeAPIImpl;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.AzureRegions;
import com.microsoft.rest.RestClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import okhttp3.Interceptor;
Expand All @@ -24,13 +23,11 @@ public class LuisRuntimeManager {
/**
* Initializes an instance of Language Understanding (LUIS) Runtime API client.
*
* @param region Supported Azure regions for Cognitive Services endpoints.
* @param subscriptionKey the Language Understanding (LUIS) Runtime API key
* @return the Language Understanding Runtime API client
*/
public static LuisRuntimeAPI authenticate(AzureRegions region, String subscriptionKey) {
return authenticate("https://{AzureRegion}.api.cognitive.microsoft.com/luis/v2.0/apps/", subscriptionKey)
.withAzureRegion(region);
public static LuisRuntimeAPI authenticate(String subscriptionKey) {
return authenticate("https://api.cognitive.microsoft.com/luis/v2.0/", subscriptionKey);
}

/**
Expand Down Expand Up @@ -65,13 +62,11 @@ public Response intercept(Chain chain) throws IOException {
/**
* Initializes an instance of Language Understanding (LUIS) Runtime API client.
*
* @param region Supported Azure regions for Cognitive Services endpoints.
* @param credentials the management credentials for Azure
* @return the Language Understanding (LUIS) Runtime API client
*/
public static LuisRuntimeAPI authenticate(AzureRegions region, ServiceClientCredentials credentials) {
return authenticate("https://{AzureRegion}.api.cognitive.microsoft.com/luis/v2.0/apps/", credentials)
.withAzureRegion(region);
public static LuisRuntimeAPI authenticate(ServiceClientCredentials credentials) {
return authenticate("https://api.cognitive.microsoft.com/luis/v2.0/", credentials);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface Predictions {
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the LuisResult object if successful.
*/

@Deprecated
LuisResult resolve(String appId, String query, ResolveOptionalParameter resolveOptionalParameter);

/**
Expand All @@ -43,7 +43,7 @@ public interface Predictions {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the LuisResult object
*/

@Deprecated
Observable<LuisResult> resolveAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.LuisRuntimeAPI;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.AzureRegions;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.Predictions;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;
Expand All @@ -31,29 +30,6 @@ public AzureClient getAzureClient() {
return this.azureClient;
}

/** Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'. */
private AzureRegions azureRegion;

/**
* Gets Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'.
*
* @return the azureRegion value.
*/
public AzureRegions azureRegion() {
return this.azureRegion;
}

/**
* Sets Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'.
*
* @param azureRegion the azureRegion value.
* @return the service client itself
*/
public LuisRuntimeAPIImpl withAzureRegion(AzureRegions azureRegion) {
this.azureRegion = azureRegion;
return this;
}

/** Gets or sets the preferred language for the response. */
private String acceptLanguage;

Expand Down Expand Up @@ -142,7 +118,7 @@ public Predictions predictions() {
* @param credentials the management credentials for Azure
*/
public LuisRuntimeAPIImpl(ServiceClientCredentials credentials) {
this("https://{AzureRegion}.api.cognitive.microsoft.com/luis/v2.0/apps", credentials);
this("https://api.cognitive.microsoft.com/luis/v2.0", credentials);
}

/**
Expand Down Expand Up @@ -181,6 +157,6 @@ protected void initialize() {
*/
@Override
public String userAgent() {
return String.format("%s (%s, %s)", super.userAgent(), "LuisRuntimeAPI", "v2.0 preview");
return String.format("%s (%s, %s)", super.userAgent(), "LuisRuntimeAPI", "2.0");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.ResolveOptionalParameter;
import retrofit2.Retrofit;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.Predictions;
import com.google.common.base.Joiner;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.APIErrorException;
import com.microsoft.azure.cognitiveservices.language.luis.runtime.models.LuisResult;
Expand Down Expand Up @@ -57,8 +56,8 @@ public PredictionsImpl(Retrofit retrofit, LuisRuntimeAPIImpl client) {
*/
interface PredictionsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.luis.runtime.Predictions resolve" })
@POST("{appId}")
Observable<Response<ResponseBody>> resolve(@Path("appId") String appId, @Body String query, @Query("timezoneOffset") Double timezoneOffset, @Query("verbose") Boolean verbose, @Query("staging") Boolean staging, @Query("spellCheck") Boolean spellCheck, @Query("bing-spell-check-subscription-key") String bingSpellCheckSubscriptionKey, @Query("log") Boolean log, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@POST("apps/{appId}")
Observable<Response<ResponseBody>> resolve(@Path("appId") String appId, @Body String query, @Query("timezoneOffset") Double timezoneOffset, @Query("verbose") Boolean verbose, @Query("staging") Boolean staging, @Query("spellCheck") Boolean spellCheck, @Query("bing-spell-check-subscription-key") String bingSpellCheckSubscriptionKey, @Query("log") Boolean log, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

Expand Down Expand Up @@ -120,9 +119,6 @@ public LuisResult call(ServiceResponse<LuisResult> response) {
* @return the observable to the LuisResult object
*/
public Observable<ServiceResponse<LuisResult>> resolveWithServiceResponseAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
Expand Down Expand Up @@ -154,17 +150,13 @@ public Observable<ServiceResponse<LuisResult>> resolveWithServiceResponseAsync(S
* @return the observable to the LuisResult object
*/
public Observable<ServiceResponse<LuisResult>> resolveWithServiceResponseAsync(String appId, String query, Double timezoneOffset, Boolean verbose, Boolean staging, Boolean spellCheck, String bingSpellCheckSubscriptionKey, Boolean log) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{AzureRegion}", this.client.azureRegion());
return service.resolve(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
return service.resolve(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LuisResult>>>() {
@Override
public Observable<ServiceResponse<LuisResult>> call(Response<ResponseBody> response) {
Expand Down
4 changes: 2 additions & 2 deletions cognitiveservices/data-plane/language/textanalytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<parent>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>azure-cognitiveservices-textanalytics</artifactId>
<version>1.0.1-beta</version>
<version>1.0.2-beta</version>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for Cognitive Service Text Analytics</name>
<description>This package contains Microsoft Cognitive Service Text Analytics SDK.</description>
Expand Down
5 changes: 4 additions & 1 deletion cognitiveservices/data-plane/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<packaging>pom</packaging>

<name>Microsoft Azure Cognitive Services SDK Parent</name>
Expand Down Expand Up @@ -300,6 +300,7 @@
<module>./language/luis/authoring</module>
<module>./language/luis/runtime</module>
<module>./language/textanalytics</module>
<module>./search/bingautosuggest</module>
<module>./search/bingcustomimagesearch</module>
<module>./search/bingcustomsearch</module>
<module>./search/bingentitysearch</module>
Expand All @@ -310,6 +311,8 @@
<module>./search/bingwebsearch</module>
<module>./vision/computervision</module>
<module>./vision/contentmoderator</module>
<module>./vision/customvision/prediction</module>
<module>./vision/customvision/training</module>
<module>./vision/faceapi</module>
</modules>
</project>
89 changes: 89 additions & 0 deletions cognitiveservices/data-plane/search/bingautosuggest/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!--
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.azure.cognitiveservices</groupId>
<artifactId>azure-cognitiveservices-parent</artifactId>
<version>1.0.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>azure-cognitiveservices-autosuggest</artifactId>
<version>1.0.2-beta</version>
<packaging>jar</packaging>
<name>Microsoft Azure SDK for Cognitive Services Auto Suggest</name>
<description>This package contains Microsoft Cognitive Service Auto Suggest SDK.</description>
<url>https://github.com/Azure/azure-sdk-for-java/cognitiveservices/data-plane/search/bingautosuggest</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
</properties>
<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<uniqueVersion>true</uniqueVersion>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<excludePackageNames>*.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search</excludePackageNames>
<bottom>
<![CDATA[<code>
/**
<br />* Copyright (c) Microsoft Corporation. All rights reserved.
<br />* Licensed under the MIT License. See License.txt in the project root for
<br />* license information.
<br />*/
</code>]]>
</bottom>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit f35615f

Please sign in to comment.