forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 25734 in Azure/azure-rest-api-specs
Azure OpenAI: minimal, partial specification for Whisper transcription/translation (Azure#25734) * minimalistic whisper .tsp definitions * merge, format, remove client.tsp changes for mvp simplicity * speculative example JSON update for string response types * restore header traits for swagger hints * review pass, prioritize object response for OpenAPI v2 * PR feedback: fully distinguish transcription/translation models
- Loading branch information
SDKAuto
committed
Sep 20, 2023
1 parent
88aa872
commit ac39fe0
Showing
7 changed files
with
477 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) AutoRest Code Generator. | ||
|
||
package com.azure.ai.openai.models; | ||
|
||
import com.azure.core.annotation.Generated; | ||
import com.azure.core.annotation.Immutable; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.time.Duration; | ||
import java.util.List; | ||
|
||
/** Result information for an operation that translated spoken audio into written text. */ | ||
@Immutable | ||
public final class AudioTranslation { | ||
/* | ||
* The translated text for the provided audio data. | ||
*/ | ||
@Generated | ||
@JsonProperty(value = "text") | ||
private String text; | ||
|
||
/* | ||
* The label that describes which operation type generated the accompanying response data. | ||
*/ | ||
@Generated | ||
@JsonProperty(value = "task") | ||
private AudioTaskLabel task; | ||
|
||
/* | ||
* The spoken language that was detected in the translated audio data. | ||
* This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. | ||
*/ | ||
@Generated | ||
@JsonProperty(value = "language") | ||
private String language; | ||
|
||
/* | ||
* The total duration of the audio processed to produce accompanying translation information. | ||
*/ | ||
@Generated | ||
@JsonProperty(value = "duration") | ||
private Double duration; | ||
|
||
/* | ||
* A collection of information about the timing, probabilities, and other detail of each processed audio segment. | ||
*/ | ||
@Generated | ||
@JsonProperty(value = "segments") | ||
private List<AudioTranslationSegment> segments; | ||
|
||
/** | ||
* Creates an instance of AudioTranslation class. | ||
* | ||
* @param text the text value to set. | ||
*/ | ||
@Generated | ||
@JsonCreator | ||
private AudioTranslation(@JsonProperty(value = "text") String text) { | ||
this.text = text; | ||
} | ||
|
||
/** | ||
* Get the text property: The translated text for the provided audio data. | ||
* | ||
* @return the text value. | ||
*/ | ||
@Generated | ||
public String getText() { | ||
return this.text; | ||
} | ||
|
||
/** | ||
* Get the task property: The label that describes which operation type generated the accompanying response data. | ||
* | ||
* @return the task value. | ||
*/ | ||
@Generated | ||
public AudioTaskLabel getTask() { | ||
return this.task; | ||
} | ||
|
||
/** | ||
* Get the language property: The spoken language that was detected in the translated audio data. This is expressed | ||
* as a two-letter ISO-639-1 language code like 'en' or 'fr'. | ||
* | ||
* @return the language value. | ||
*/ | ||
@Generated | ||
public String getLanguage() { | ||
return this.language; | ||
} | ||
|
||
/** | ||
* Get the duration property: The total duration of the audio processed to produce accompanying translation | ||
* information. | ||
* | ||
* @return the duration value. | ||
*/ | ||
@Generated | ||
public Duration getDuration() { | ||
if (this.duration == null) { | ||
return null; | ||
} | ||
return Duration.ofNanos((long) (this.duration * 1000_000_000L)); | ||
} | ||
|
||
/** | ||
* Get the segments property: A collection of information about the timing, probabilities, and other detail of each | ||
* processed audio segment. | ||
* | ||
* @return the segments value. | ||
*/ | ||
@Generated | ||
public List<AudioTranslationSegment> getSegments() { | ||
return this.segments; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...enai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) AutoRest Code Generator. | ||
|
||
package com.azure.ai.openai.models; | ||
|
||
import com.azure.core.annotation.Generated; | ||
import com.azure.core.util.ExpandableStringEnum; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import java.util.Collection; | ||
|
||
/** Defines available options for the underlying response format of output translation information. */ | ||
public final class AudioTranslationFormat extends ExpandableStringEnum<AudioTranslationFormat> { | ||
/** Use a response body that is a JSON object containing a single 'text' field for the translation. */ | ||
@Generated public static final AudioTranslationFormat JSON = fromString("json"); | ||
|
||
/** | ||
* Use a response body that is a JSON object containing translation text along with timing, segments, and other | ||
* metadata. | ||
*/ | ||
@Generated public static final AudioTranslationFormat VERBOSE_JSON = fromString("verbose_json"); | ||
|
||
/** Use a response body that is plain text containing the raw, unannotated translation. */ | ||
@Generated public static final AudioTranslationFormat TEXT = fromString("text"); | ||
|
||
/** Use a response body that is plain text in SubRip (SRT) format that also includes timing information. */ | ||
@Generated public static final AudioTranslationFormat SRT = fromString("srt"); | ||
|
||
/** | ||
* Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes timing | ||
* information. | ||
*/ | ||
@Generated public static final AudioTranslationFormat VTT = fromString("vtt"); | ||
|
||
/** | ||
* Creates a new instance of AudioTranslationFormat value. | ||
* | ||
* @deprecated Use the {@link #fromString(String)} factory method. | ||
*/ | ||
@Generated | ||
@Deprecated | ||
public AudioTranslationFormat() {} | ||
|
||
/** | ||
* Creates or finds a AudioTranslationFormat from its string representation. | ||
* | ||
* @param name a name to look for. | ||
* @return the corresponding AudioTranslationFormat. | ||
*/ | ||
@Generated | ||
@JsonCreator | ||
public static AudioTranslationFormat fromString(String name) { | ||
return fromString(name, AudioTranslationFormat.class); | ||
} | ||
|
||
/** | ||
* Gets known AudioTranslationFormat values. | ||
* | ||
* @return known AudioTranslationFormat values. | ||
*/ | ||
@Generated | ||
public static Collection<AudioTranslationFormat> values() { | ||
return values(AudioTranslationFormat.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.