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