Skip to content

Commit

Permalink
Add comments in OpenAiAudioSpeechModel
Browse files Browse the repository at this point in the history
* Add comments in OpenAiAudioSpeechModel like OpenAiChatModel

* Remove duplicated word in OpenAiAudioSpeechOptions AudioResponseFormat comment
  • Loading branch information
devholic22 authored and markpollack committed Jul 2, 2024
1 parent 3bec210 commit 3411e3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,37 @@
* OpenAI audio speech client implementation for backed by {@link OpenAiAudioApi}.
*
* @author Ahmed Yousri
* @author Hyunjoon Choi
* @see OpenAiAudioApi
* @since 1.0.0-M1
*/
public class OpenAiAudioSpeechModel implements SpeechModel, StreamingSpeechModel {

private final Logger logger = LoggerFactory.getLogger(getClass());

/**
* The default options used for the audio completion requests.
*/
private final OpenAiAudioSpeechOptions defaultOptions;

/**
* The speed of the default voice synthesis.
* @see OpenAiAudioSpeechOptions
*/
private static final Float SPEED = 1.0f;

/**
* The retry template used to retry the OpenAI Audio API calls.
*/
public final RetryTemplate retryTemplate = RetryTemplate.builder()
.maxAttempts(10)
.retryOn(OpenAiApiException.class)
.exponentialBackoff(Duration.ofMillis(2000), 5, Duration.ofMillis(3 * 60000))
.build();

/**
* Low-level access to the OpenAI Audio API.
*/
private final OpenAiAudioApi audioApi;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Options for OpenAI text to audio - speech synthesis.
*
* @author Ahmed Yousri
* @author Hyunjoon Choi
* @since 1.0.0-M1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
Expand Down Expand Up @@ -53,7 +54,7 @@ public class OpenAiAudioSpeechOptions implements ModelOptions {

/**
* The format of the audio output. Supported formats are mp3, opus, aac, and flac.
* Defaults to mp3. Defaults to mp3
* Defaults to mp3.
*/
@JsonProperty("response_format")
private AudioResponseFormat responseFormat;
Expand Down

0 comments on commit 3411e3e

Please sign in to comment.