Skip to content

Commit

Permalink
[TA] Remove enum value BooleanResoluton and renamings (#33860)
Browse files Browse the repository at this point in the history
  • Loading branch information
mssfang committed Mar 4, 2023
1 parent f1196dd commit 1672b9c
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 87 deletions.
3 changes: 2 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Expand Up @@ -14,7 +14,8 @@
- Changed `dynamic classify categories` as a required parameter in dynamic text classification methods.
- Renamed naming phrase `DynamicClassficationXXX` to `DynamicClassifyXXX` in class name, method name.
- Changed `BaseResolution` to an abstract class.
- Removed class `BooleanResolution`.
- Removed class `BooleanResolution` and enum value `BooleanResolution` in the class `ResolutionKind`.
- Renamed `maxSentenceCount` to `sentenceCount` in abstractive summarization.

### Bugs Fixed

Expand Down
Expand Up @@ -111,7 +111,7 @@ PollerFlux<AbstractSummaryOperationDetail, AbstractSummaryPagedFlux> abstractSum
new AbstractiveSummarizationLROTask().setParameters(
new AbstractiveSummarizationTaskParameters()
.setStringIndexType(StringIndexType.UTF16CODE_UNIT)
.setSentenceCount(options.getMaxSentenceCount())
.setSentenceCount(options.getSentenceCount())
.setModelVersion(options.getModelVersion())
.setLoggingOptOut(options.isServiceLogsDisabled())
))),
Expand Down Expand Up @@ -151,7 +151,7 @@ SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable> abstrac
final AbstractiveSummarizationLROTask task = new AbstractiveSummarizationLROTask().setParameters(
new AbstractiveSummarizationTaskParameters()
.setStringIndexType(StringIndexType.UTF16CODE_UNIT)
.setSentenceCount(options.getMaxSentenceCount())
.setSentenceCount(options.getSentenceCount())
.setModelVersion(options.getModelVersion())
.setLoggingOptOut(options.isServiceLogsDisabled()));
return SyncPoller.createPoller(
Expand Down
Expand Up @@ -788,7 +788,7 @@ private AbstractiveSummarizationTaskParameters getAbstractiveSummarizationTaskPa
AbstractSummaryAction action) {
return new AbstractiveSummarizationTaskParameters()
.setStringIndexType(StringIndexType.UTF16CODE_UNIT)
.setSentenceCount(action.getMaxSentenceCount())
.setSentenceCount(action.getSentenceCount())
.setModelVersion(action.getModelVersion())
.setLoggingOptOut(action.isServiceLogsDisabled());
}
Expand Down
Expand Up @@ -2937,7 +2937,7 @@ public PollerFlux<AbstractSummaryOperationDetail, AbstractSummaryPagedFlux> begi
* + &quot;foundational component of this aspiration, if grounded with external knowledge sources in &quot;
* + &quot;the downstream AI tasks.&quot;&#41;;
* &#125;
* AbstractSummaryOptions options = new AbstractSummaryOptions&#40;&#41;.setMaxSentenceCount&#40;4&#41;;
* AbstractSummaryOptions options = new AbstractSummaryOptions&#40;&#41;.setSentenceCount&#40;4&#41;;
* textAnalyticsAsyncClient.beginAbstractSummary&#40;documents, &quot;en&quot;, options&#41;
* .flatMap&#40;result -&gt; &#123;
* AbstractSummaryOperationDetail operationDetail = result.getValue&#40;&#41;;
Expand Down Expand Up @@ -3027,7 +3027,7 @@ public PollerFlux<AbstractSummaryOperationDetail, AbstractSummaryPagedFlux> begi
* + &quot;foundational component of this aspiration, if grounded with external knowledge sources in &quot;
* + &quot;the downstream AI tasks.&quot;&#41;&#41;;
* &#125;
* AbstractSummaryOptions options = new AbstractSummaryOptions&#40;&#41;.setMaxSentenceCount&#40;4&#41;;
* AbstractSummaryOptions options = new AbstractSummaryOptions&#40;&#41;.setSentenceCount&#40;4&#41;;
* textAnalyticsAsyncClient.beginAbstractSummary&#40;documents, options&#41;
* .flatMap&#40;result -&gt; &#123;
* AbstractSummaryOperationDetail operationDetail = result.getValue&#40;&#41;;
Expand Down
Expand Up @@ -2814,7 +2814,7 @@ public SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable>
* &#125;
* SyncPoller&lt;AbstractSummaryOperationDetail, AbstractSummaryPagedIterable&gt; syncPoller =
* textAnalyticsClient.beginAbstractSummary&#40;documents, &quot;en&quot;,
* new AbstractSummaryOptions&#40;&#41;.setDisplayName&#40;&quot;&#123;tasks_display_name&#125;&quot;&#41;.setMaxSentenceCount&#40;3&#41;&#41;;
* new AbstractSummaryOptions&#40;&#41;.setDisplayName&#40;&quot;&#123;tasks_display_name&#125;&quot;&#41;.setSentenceCount&#40;3&#41;&#41;;
* syncPoller.waitForCompletion&#40;&#41;;
* syncPoller.getFinalResult&#40;&#41;.forEach&#40;resultCollection -&gt; &#123;
* for &#40;AbstractSummaryResult documentResult : resultCollection&#41; &#123;
Expand Down Expand Up @@ -2895,7 +2895,7 @@ public SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable>
* &#125;
* SyncPoller&lt;AbstractSummaryOperationDetail, AbstractSummaryPagedIterable&gt; syncPoller =
* textAnalyticsClient.beginAbstractSummary&#40;documents,
* new AbstractSummaryOptions&#40;&#41;.setDisplayName&#40;&quot;&#123;tasks_display_name&#125;&quot;&#41;.setMaxSentenceCount&#40;3&#41;,
* new AbstractSummaryOptions&#40;&#41;.setDisplayName&#40;&quot;&#123;tasks_display_name&#125;&quot;&#41;.setSentenceCount&#40;3&#41;,
* Context.NONE&#41;;
* syncPoller.waitForCompletion&#40;&#41;;
* syncPoller.getFinalResult&#40;&#41;.forEach&#40;resultCollection -&gt; &#123;
Expand Down
Expand Up @@ -26,7 +26,6 @@
@JsonSubTypes.Type(name = "TemperatureResolution", value = TemperatureResolution.class),
@JsonSubTypes.Type(name = "WeightResolution", value = WeightResolution.class),
@JsonSubTypes.Type(name = "CurrencyResolution", value = CurrencyResolution.class),
@JsonSubTypes.Type(name = "BooleanResolution", value = BooleanResolution.class),
@JsonSubTypes.Type(name = "DateTimeResolution", value = DateTimeResolution.class),
@JsonSubTypes.Type(name = "NumberResolution", value = NumberResolution.class),
@JsonSubTypes.Type(name = "OrdinalResolution", value = OrdinalResolution.class),
Expand Down

This file was deleted.

Expand Up @@ -14,7 +14,7 @@ public final class AbstractSummaryAction {
private String actionName;
private String modelVersion;
private Boolean disableServiceLogs;
private Integer maxSentenceCount;
private Integer sentenceCount;

/**
* Get the name of action.
Expand Down Expand Up @@ -85,22 +85,22 @@ public AbstractSummaryAction setServiceLogsDisabled(boolean disableServiceLogs)
}

/**
* Get the maxSentenceCount property: It controls the approximate number of sentences in the output summaries.
* Get the sentenceCount property: It controls the approximate number of sentences in the output summaries.
*
* @return the maxSentenceCount value.
* @return the sentenceCount value.
*/
public Integer getMaxSentenceCount() {
return this.maxSentenceCount;
public Integer getSentenceCount() {
return this.sentenceCount;
}

/**
* Set the maxSentenceCount property: It controls the approximate number of sentences in the output summaries.
* Set the sentenceCount property: It controls the approximate number of sentences in the output summaries.
*
* @param maxSentenceCount the maxSentenceCount value to set.
* @param sentenceCount the sentenceCount value to set.
* @return the AbstractSummaryAction object itself.
*/
public AbstractSummaryAction setMaxSentenceCount(Integer maxSentenceCount) {
this.maxSentenceCount = maxSentenceCount;
public AbstractSummaryAction setSentenceCount(Integer sentenceCount) {
this.sentenceCount = sentenceCount;
return this;
}
}
Expand Up @@ -12,7 +12,7 @@
@Fluent
public final class AbstractSummaryOptions extends TextAnalyticsRequestOptions {
private String displayName;
private Integer maxSentenceCount;
private Integer sentenceCount;

/**
* Gets display name of the operation.
Expand All @@ -36,22 +36,22 @@ public AbstractSummaryOptions setDisplayName(String displayName) {
}

/**
* Get the maxSentenceCount property: It controls the approximate number of sentences in the output summaries.
* Get the sentenceCount property: It controls the approximate number of sentences in the output summaries.
*
* @return the maxSentenceCount value.
* @return the sentenceCount value.
*/
public Integer getMaxSentenceCount() {
return this.maxSentenceCount;
public Integer getSentenceCount() {
return this.sentenceCount;
}

/**
* Set the maxSentenceCount property: It controls the approximate number of sentences in the output summaries.
* Set the sentenceCount property: It controls the approximate number of sentences in the output summaries.
*
* @param maxSentenceCount the maxSentenceCount value to set.
* @param sentenceCount the sentenceCount value to set.
* @return the AbstractSummaryOptions object itself.
*/
public AbstractSummaryOptions setMaxSentenceCount(Integer maxSentenceCount) {
this.maxSentenceCount = maxSentenceCount;
public AbstractSummaryOptions setSentenceCount(Integer sentenceCount) {
this.sentenceCount = sentenceCount;
return this;
}
}
Expand Up @@ -7,9 +7,6 @@

/** Defines values for ResolutionKind. */
public final class ResolutionKind extends ExpandableStringEnum<ResolutionKind> {
/** Static value BooleanResolution for ResolutionKind. */
public static final ResolutionKind BOOLEAN_RESOLUTION = fromString("BooleanResolution");

/** Static value DateTimeResolution for ResolutionKind. */
public static final ResolutionKind DATE_TIME_RESOLUTION = fromString("DateTimeResolution");

Expand Down
Expand Up @@ -1547,7 +1547,7 @@ public void abstractSummaryStringInputWithOption() {
+ "foundational component of this aspiration, if grounded with external knowledge sources in "
+ "the downstream AI tasks.");
}
AbstractSummaryOptions options = new AbstractSummaryOptions().setMaxSentenceCount(4);
AbstractSummaryOptions options = new AbstractSummaryOptions().setSentenceCount(4);
textAnalyticsAsyncClient.beginAbstractSummary(documents, "en", options)
.flatMap(result -> {
AbstractSummaryOperationDetail operationDetail = result.getValue();
Expand Down Expand Up @@ -1601,7 +1601,7 @@ public void abstractSummaryMaxOverload() {
+ "foundational component of this aspiration, if grounded with external knowledge sources in "
+ "the downstream AI tasks."));
}
AbstractSummaryOptions options = new AbstractSummaryOptions().setMaxSentenceCount(4);
AbstractSummaryOptions options = new AbstractSummaryOptions().setSentenceCount(4);
textAnalyticsAsyncClient.beginAbstractSummary(documents, options)
.flatMap(result -> {
AbstractSummaryOperationDetail operationDetail = result.getValue();
Expand Down
Expand Up @@ -1474,7 +1474,7 @@ public void abstractSummaryStringInputWithOption() {
}
SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable> syncPoller =
textAnalyticsClient.beginAbstractSummary(documents, "en",
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setMaxSentenceCount(3));
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setSentenceCount(3));
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(resultCollection -> {
for (AbstractSummaryResult documentResult : resultCollection) {
Expand Down Expand Up @@ -1520,7 +1520,7 @@ public void abstractSummaryMaxOverload() {
}
SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable> syncPoller =
textAnalyticsClient.beginAbstractSummary(documents,
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setMaxSentenceCount(3),
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setSentenceCount(3),
Context.NONE);
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(resultCollection -> {
Expand Down
Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) {
SyncPoller<AbstractSummaryOperationDetail, AbstractSummaryPagedIterable> syncPoller =
client.beginAbstractSummary(documents,
"en",
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setMaxSentenceCount(3));
new AbstractSummaryOptions().setDisplayName("{tasks_display_name}").setSentenceCount(3));
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(resultCollection -> {
for (AbstractSummaryResult documentResult : resultCollection) {
Expand Down
Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) {

client.beginAbstractSummary(documents,
"en",
new AbstractSummaryOptions().setMaxSentenceCount(4))
new AbstractSummaryOptions().setSentenceCount(4))
.flatMap(result -> {
AbstractSummaryOperationDetail operationDetail = result.getValue();
System.out.printf("Operation created time: %s, expiration time: %s.%n",
Expand Down
Expand Up @@ -1429,22 +1429,22 @@ void extractSummaryMaxOverloadRunner(BiConsumer<List<TextDocumentInput>, Extract


void abstractSummaryActionRunner(BiConsumer<List<String>, TextAnalyticsActions> testRunner,
Integer maxSentenceCount) {
Integer sentenceCount) {
testRunner.accept(SUMMARY_INPUTS,
new TextAnalyticsActions()
.setAbstractSummaryActions(
new AbstractSummaryAction().setMaxSentenceCount(maxSentenceCount)));
new AbstractSummaryAction().setSentenceCount(sentenceCount)));
}

void abstractSummaryRunner(BiConsumer<List<String>, AbstractSummaryOptions> testRunner,
Integer maxSentenceCount) {
testRunner.accept(SUMMARY_INPUTS, new AbstractSummaryOptions().setMaxSentenceCount(maxSentenceCount));
Integer sentenceCount) {
testRunner.accept(SUMMARY_INPUTS, new AbstractSummaryOptions().setSentenceCount(sentenceCount));
}

void abstractSummaryMaxOverloadRunner(BiConsumer<List<TextDocumentInput>, AbstractSummaryOptions> testRunner,
Integer maxSentenceCount) {
Integer sentenceCount) {
testRunner.accept(TestUtils.getTextDocumentInputs(SUMMARY_INPUTS),
new AbstractSummaryOptions().setMaxSentenceCount(maxSentenceCount));
new AbstractSummaryOptions().setSentenceCount(sentenceCount));
}

// Dynamic classification
Expand Down

0 comments on commit 1672b9c

Please sign in to comment.