summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/transcribe/grpc/voicemail_transcription.proto
blob: 117efaeb81e7589ee4aa0b070d256bd5ae8bcb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
syntax = "proto2";

package google.internal.communications.voicemailtranscription.v1;

option java_multiple_files = true;

option java_package = "com.google.internal.communications.voicemailtranscription.v1";

// Enum that specifies supported audio formats.
enum AudioFormat {
  // Default but invalid value.
  AUDIO_FORMAT_UNSPECIFIED = 0;

  // Adaptive Multi-Rate Narrowband, 8kHz sampling frequency.
  // https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec
  AMR_NB_8KHZ = 1;
}

// Enum that describes the status of the transcription process.
enum TranscriptionStatus {
  // Default but invalid value.
  TRANSCRIPTION_STATUS_UNSPECIFIED = 0;

  // Transcription was successful and the transcript is present.
  SUCCESS = 1;

  // Transcription is progress. Check again later.
  PENDING = 2;

  // Transcription was successful, but the expiration period has passed, which
  // means that the sensative data (including the transcript) has been deleted.
  // Resend the voicemail through TranscribeVoicemailAsync to retry.
  EXPIRED = 3;

  // Internal error encountered during the transcription.
  // Resend the voicemail through TranscribeVoicemailAsync to retry.
  // This is a catch-all status for all retriable errors that aren't captured by
  // a more specfic status.
  FAILED_RETRY = 4;

  // Internal error encountered during the transcription.
  // Do not resend the voicemail.
  // This is a catch-all status for all non-retriable errors that aren't
  // captured by a more specfic status.
  FAILED_NO_RETRY = 5;

  // The language detected is not yet supported by this service.
  // Do not resend the voicemail.
  FAILED_LANGUAGE_NOT_SUPPORTED = 6;

  // No speech was detected in the voicemail.
  // Do not resend the voicemail.
  FAILED_NO_SPEECH_DETECTED = 7;
}

// Enum that specifies the user's consent to donate a specific voicemail.
enum DonationPreference {
  // Default but invalid value.
  USER_PREFERENCE_UNSPECIFIED = 0;

  // User does not consent to donating this voicemail.
  DO_NOT_DONATE = 1;

  // User consents to donating this voicemail.
  DONATE = 2;
}

// Enum that specifies the user's rating for a voicemail transcription.
enum TranscriptionRatingValue {
  // Default but invalid value.
  TRANSCRIPTION_RATING_VALUE_UNSPECIFIED = 0;

  // User indicated that the transcription was good.
  GOOD_TRANSCRIPTION = 1;

  // User indicated that the transcription was bad.
  BAD_TRANSCRIPTION = 2;
}

// Request for synchronous voicemail transcription.
message TranscribeVoicemailRequest {
  // Voicemail audio file containing the raw bytes we receive from the carrier.
  optional bytes voicemail_data = 1;

  // Audio format of the voicemail file.
  optional AudioFormat audio_format = 2;
}

// Response for synchronous voicemail transcription.
message TranscribeVoicemailResponse {
  // The transcribed text of the voicemail.
  optional string transcript = 1;
}

// Request for asynchronous voicemail transcription.
message TranscribeVoicemailAsyncRequest {
  // Voicemail audio data encoded in the format specified by audio_format.
  optional bytes voicemail_data = 1;

  // Audio format of the voicemail file.
  optional AudioFormat audio_format = 2;

  // The client may provide their own unique ID for this transcription. It
  // should be globally unique across all voicemails from all users.
  // If the given transcription_id is not unique, an ALREADY_EXISTS (409) error
  // will be returned.
  // If no transcription_id is provided, one will be generated by the server.
  optional string transcription_id = 3;

  // User's donation preference.
  optional DonationPreference donation_preference = 4;
}

// Response for asynchronous voicemail transcription containing information
// needed to fetch the transcription results through the GetTranscript method.
message TranscribeVoicemailAsyncResponse {
  // Unique ID for the transcription. This ID is used for retrieving the
  // voicemail transcript later.
  optional string transcription_id = 1;

  // The estimated amount of time in seconds before the transcription will be
  // available.
  // The client should not call GetTranscript until this time has elapsed, but
  // the transcript is not guaranteed to be ready by this time.
  optional int64 estimated_wait_secs = 2;
}

// Request for retrieving an asynchronously generated transcript.
message GetTranscriptRequest {
  // Unique ID for the transcription. This ID was returned by
  // TranscribeVoicemailAsync.
  optional string transcription_id = 1;
}

// Response for retrieving an asynchronously generated transcript.
message GetTranscriptResponse {
  // Status of the trascription process.
  optional TranscriptionStatus status = 1;

  // The transcribed text of the voicemail. This is only present if the status
  // is SUCCESS.
  optional string transcript = 2;
}

// The rating for a single voicemail transcription.
message TranscriptionRating {
  // The id of the voicemail transcription.
  optional string transcription_id = 1;

  // The user's rating of the voicemail transcription.
  optional TranscriptionRatingValue rating_value = 2;
}

// Request for uploading transcription ratings.
message SendTranscriptionFeedbackRequest {
  // User feedback indicating the transcription quality for one or more
  // voicemails
  repeated TranscriptionRating rating = 1;
}

// Response for uploading transcription ratings
message SendTranscriptionFeedbackResponse {
}

// RPC service for transcribing voicemails.
service VoicemailTranscriptionService {
  // Returns a transcript of the given voicemail.
  rpc TranscribeVoicemail(TranscribeVoicemailRequest)
      returns (TranscribeVoicemailResponse) {}

  // Schedules a transcription of the given voicemail. The transcript can be
  // retrieved using the returned ID.
  rpc TranscribeVoicemailAsync(TranscribeVoicemailAsyncRequest)
      returns (TranscribeVoicemailAsyncResponse) {
  }

  // Returns the transcript corresponding to the given ID, which was returned
  // by TranscribeVoicemailAsync.
  rpc GetTranscript(GetTranscriptRequest) returns (GetTranscriptResponse) {
  }

  // Uploads user's transcription feedback. Feedback will only be collected from
  // user's who have consented to donate their voicemails.
  rpc SendTranscriptionFeedback(SendTranscriptionFeedbackRequest)
      returns (SendTranscriptionFeedbackResponse) {
  }
}