1
2
3syntax = "proto2";
4
5package google.internal.communications.voicemailtranscription.v1;
6
7option java_multiple_files = true;
8option optimize_for = LITE_RUNTIME;
9
10option java_package = "com.google.internal.communications.voicemailtranscription.v1";
11
12// Enum that specifies supported audio formats.
13enum AudioFormat {
14  // Default but invalid value.
15  AUDIO_FORMAT_UNSPECIFIED = 0;
16
17  // Adaptive Multi-Rate Narrowband, 8kHz sampling frequency.
18  // https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec
19  AMR_NB_8KHZ = 1;
20}
21
22// Enum that describes the status of the transcription process.
23enum TranscriptionStatus {
24  // Default but invalid value.
25  TRANSCRIPTION_STATUS_UNSPECIFIED = 0;
26
27  // Transcription was successful and the transcript is present.
28  SUCCESS = 1;
29
30  // Transcription is progress. Check again later.
31  PENDING = 2;
32
33  // Transcription was successful, but the expiration period has passed, which
34  // means that the sensative data (including the transcript) has been deleted.
35  // Resend the voicemail through TranscribeVoicemailAsync to retry.
36  EXPIRED = 3;
37
38  // Internal error encountered during the transcription.
39  // Resend the voicemail through TranscribeVoicemailAsync to retry.
40  // This is a catch-all status for all retriable errors that aren't captured by
41  // a more specfic status.
42  FAILED_RETRY = 4;
43
44  // Internal error encountered during the transcription.
45  // Do not resend the voicemail.
46  // This is a catch-all status for all non-retriable errors that aren't
47  // captured by a more specfic status.
48  FAILED_NO_RETRY = 5;
49
50  // The language detected is not yet supported by this service.
51  // Do not resend the voicemail.
52  FAILED_LANGUAGE_NOT_SUPPORTED = 6;
53
54  // No speech was detected in the voicemail.
55  // Do not resend the voicemail.
56  FAILED_NO_SPEECH_DETECTED = 7;
57}
58
59// Enum that specifies the user's consent to donate a specific voicemail.
60enum DonationPreference {
61  // Default but invalid value.
62  USER_PREFERENCE_UNSPECIFIED = 0;
63
64  // User does not consent to donating this voicemail.
65  DO_NOT_DONATE = 1;
66
67  // User consents to donating this voicemail.
68  DONATE = 2;
69}
70
71// Enum that specifies the user's rating for a voicemail transcription.
72enum TranscriptionRatingValue {
73  // Default but invalid value.
74  TRANSCRIPTION_RATING_VALUE_UNSPECIFIED = 0;
75
76  // User indicated that the transcription was good.
77  GOOD_TRANSCRIPTION = 1;
78
79  // User indicated that the transcription was bad.
80  BAD_TRANSCRIPTION = 2;
81}
82
83// Request for synchronous voicemail transcription.
84message TranscribeVoicemailRequest {
85  // Voicemail audio file containing the raw bytes we receive from the carrier.
86  optional bytes voicemail_data = 1;
87
88  // Audio format of the voicemail file.
89  optional AudioFormat audio_format = 2;
90}
91
92// Response for synchronous voicemail transcription.
93message TranscribeVoicemailResponse {
94  // The transcribed text of the voicemail.
95  optional string transcript = 1;
96}
97
98// Request for asynchronous voicemail transcription.
99message TranscribeVoicemailAsyncRequest {
100  // Voicemail audio data encoded in the format specified by audio_format.
101  optional bytes voicemail_data = 1;
102
103  // Audio format of the voicemail file.
104  optional AudioFormat audio_format = 2;
105
106  // The client may provide their own unique ID for this transcription. It
107  // should be globally unique across all voicemails from all users.
108  // If the given transcription_id is not unique, an ALREADY_EXISTS (409) error
109  // will be returned.
110  // If no transcription_id is provided, one will be generated by the server.
111  optional string transcription_id = 3;
112
113  // User's donation preference.
114  optional DonationPreference donation_preference = 4;
115}
116
117// Response for asynchronous voicemail transcription containing information
118// needed to fetch the transcription results through the GetTranscript method.
119message TranscribeVoicemailAsyncResponse {
120  // Unique ID for the transcription. This ID is used for retrieving the
121  // voicemail transcript later.
122  optional string transcription_id = 1;
123
124  // The estimated amount of time in seconds before the transcription will be
125  // available.
126  // The client should not call GetTranscript until this time has elapsed, but
127  // the transcript is not guaranteed to be ready by this time.
128  optional int64 estimated_wait_secs = 2;
129}
130
131// Request for retrieving an asynchronously generated transcript.
132message GetTranscriptRequest {
133  // Unique ID for the transcription. This ID was returned by
134  // TranscribeVoicemailAsync.
135  optional string transcription_id = 1;
136}
137
138// Response for retrieving an asynchronously generated transcript.
139message GetTranscriptResponse {
140  // Status of the trascription process.
141  optional TranscriptionStatus status = 1;
142
143  // The transcribed text of the voicemail. This is only present if the status
144  // is SUCCESS.
145  optional string transcript = 2;
146}
147
148// The rating for a single voicemail transcription.
149message TranscriptionRating {
150  // The id of the voicemail transcription.
151  optional string transcription_id = 1;
152
153  // The user's rating of the voicemail transcription.
154  optional TranscriptionRatingValue rating_value = 2;
155}
156
157// Request for uploading transcription ratings.
158message SendTranscriptionFeedbackRequest {
159  // User feedback indicating the transcription quality for one or more
160  // voicemails
161  repeated TranscriptionRating rating = 1;
162}
163
164// Response for uploading transcription ratings
165message SendTranscriptionFeedbackResponse {
166}
167
168// RPC service for transcribing voicemails.
169service VoicemailTranscriptionService {
170  // Returns a transcript of the given voicemail.
171  rpc TranscribeVoicemail(TranscribeVoicemailRequest)
172      returns (TranscribeVoicemailResponse) {}
173
174  // Schedules a transcription of the given voicemail. The transcript can be
175  // retrieved using the returned ID.
176  rpc TranscribeVoicemailAsync(TranscribeVoicemailAsyncRequest)
177      returns (TranscribeVoicemailAsyncResponse) {
178  }
179
180  // Returns the transcript corresponding to the given ID, which was returned
181  // by TranscribeVoicemailAsync.
182  rpc GetTranscript(GetTranscriptRequest) returns (GetTranscriptResponse) {
183  }
184
185  // Uploads user's transcription feedback. Feedback will only be collected from
186  // user's who have consented to donate their voicemails.
187  rpc SendTranscriptionFeedback(SendTranscriptionFeedbackRequest)
188      returns (SendTranscriptionFeedbackResponse) {
189  }
190}
191
192
193