Skip to content

Commit 3ab708d

Browse files
Update Readme & Changelog file
1 parent 452b6c4 commit 3ab708d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [1.0.3] - 07-04-2023
10+
11+
### Added
12+
- Audio translation & transcription.
13+
14+
### Changed
15+
- Update readme file.
16+
- Update example project with audio translation & transcription.
17+
918
## [1.0.2] - 06-23-2023
1019

1120
### Changed

Example/Example/Views/AudioTranslationAndTranscript/AudioViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AudioViewController: UIViewController {
2929

3030
func audioTranslation(url: URL) {
3131
EZLoadingActivity.show("Loading...", disableUI: true)
32-
ChatGPTAPIManager.shared.audioTranslationRequest(fileUrl: url,temperature: 0.8, model: .whisper1, endPoint: .translations, completion: { result in
32+
ChatGPTAPIManager.shared.audioTranslationRequest(fileUrl: url, temperature: 0.8, model: .whisper1, endPoint: .translations, completion: { result in
3333

3434
switch result {
3535
case.success(let success):

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,37 @@ ChatGPTAPIManager.shared.generateImage(prompt: "Your prompt", model: .engine, im
118118
}
119119
```
120120

121+
### Audio Translation
122+
To make an audio translation request using the ChatGPT API, you can use the `audioTranslationRequest` function provided by the `ChatGPTAPIManager` class. This function allows you to translate an audio file into text.
123+
124+
```swift
125+
ChatGPTAPIManager.shared.audioTranslationRequest(fileUrl: url, temperature: 0.8, model: .whisper1, endPoint: .translations, completion: { result in
126+
switch result {
127+
case .success(let success):
128+
// Handle successful translation
129+
print(success)
130+
case .failure(let error):
131+
// Handle error
132+
print(error)
133+
}
134+
})
135+
```
136+
137+
### Audio Transcription
138+
To transcribe an audio file into text using the ChatGPT API, you can use the `audioTranscriptionRequest` function provided by the `ChatGPTAPIManager` class. This function allows you to convert audio recordings into written transcripts.
139+
140+
```swift
141+
ChatGPTAPIManager.shared.audioTranscriptionRequest(fileUrl: url, prompt: "Translate this audio", language: "en", model: .whisper1, endPoint: .transcriptions, completion: { result in
142+
switch result {
143+
case .success(let success):
144+
// Handle successful transcription
145+
print(success)
146+
case .failure(let error):
147+
// Handle error
148+
print(error)
149+
}
150+
})
151+
```
121152

122153
Note: The code snippets provided in this README assume that you have replaced `"YOUR_API_KEY"` with your actual API key.
123154

0 commit comments

Comments
 (0)