Add Text-to-Speech and Speech-to-Text features

- Add TTS service using AVSpeechSynthesizer for voice output
- Add STT service using SpeechAnalyzer (macOS 26) for transcription
- Add voice input (microphone) button in chat with recording level indicator
- Add speak button on assistant messages for TTS playback
- Add language toggle (EN-CA/FR-CA) for bilingual speech recognition
- Fix Swift 6 strict concurrency issues in audio callbacks
- Update proto schema with TTS/STT message types and RPCs
- Update gRPC provider with speech service endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mathias Beaulieu-Duncan
2025-12-31 02:57:30 -05:00
parent 638656e7ca
commit b754945923
10 changed files with 3151 additions and 8 deletions
@@ -56,11 +56,63 @@ public enum Appleintelligence_AppleIntelligenceService: Sendable {
method: "Health"
)
}
/// Namespace for "TextToSpeech" metadata.
public enum TextToSpeech: Sendable {
/// Request type for "TextToSpeech".
public typealias Input = Appleintelligence_TextToSpeechRequest
/// Response type for "TextToSpeech".
public typealias Output = Appleintelligence_TextToSpeechResponse
/// Descriptor for "TextToSpeech".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "TextToSpeech"
)
}
/// Namespace for "ListVoices" metadata.
public enum ListVoices: Sendable {
/// Request type for "ListVoices".
public typealias Input = Appleintelligence_ListVoicesRequest
/// Response type for "ListVoices".
public typealias Output = Appleintelligence_ListVoicesResponse
/// Descriptor for "ListVoices".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "ListVoices"
)
}
/// Namespace for "Transcribe" metadata.
public enum Transcribe: Sendable {
/// Request type for "Transcribe".
public typealias Input = Appleintelligence_TranscribeRequest
/// Response type for "Transcribe".
public typealias Output = Appleintelligence_TranscribeResponse
/// Descriptor for "Transcribe".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "Transcribe"
)
}
/// Namespace for "StreamTranscribe" metadata.
public enum StreamTranscribe: Sendable {
/// Request type for "StreamTranscribe".
public typealias Input = Appleintelligence_StreamingTranscribeRequest
/// Response type for "StreamTranscribe".
public typealias Output = Appleintelligence_StreamingTranscribeResponse
/// Descriptor for "StreamTranscribe".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "appleintelligence.AppleIntelligenceService"),
method: "StreamTranscribe"
)
}
/// Descriptors for all methods in the "appleintelligence.AppleIntelligenceService" service.
public static let descriptors: [GRPCCore.MethodDescriptor] = [
Complete.descriptor,
StreamComplete.descriptor,
Health.descriptor
Health.descriptor,
TextToSpeech.descriptor,
ListVoices.descriptor,
Transcribe.descriptor,
StreamTranscribe.descriptor
]
}
}
@@ -143,6 +195,70 @@ extension Appleintelligence_AppleIntelligenceService {
request: GRPCCore.StreamingServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_HealthResponse>
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_TextToSpeechRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_TextToSpeechResponse` messages.
func textToSpeech(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TextToSpeechResponse>
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_ListVoicesRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_ListVoicesResponse` messages.
func listVoices(
request: GRPCCore.StreamingServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_ListVoicesResponse>
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_TranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_TranscribeResponse` messages.
func transcribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TranscribeResponse>
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_StreamingTranscribeResponse` messages.
func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>
}
/// Service protocol for the "appleintelligence.AppleIntelligenceService" service.
@@ -210,6 +326,70 @@ extension Appleintelligence_AppleIntelligenceService {
request: GRPCCore.ServerRequest<Appleintelligence_HealthRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_HealthResponse>
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_TextToSpeechResponse` message.
func textToSpeech(
request: GRPCCore.ServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse>
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_ListVoicesResponse` message.
func listVoices(
request: GRPCCore.ServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse>
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A response containing a single `Appleintelligence_TranscribeResponse` message.
func transcribe(
request: GRPCCore.ServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse>
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A streaming response of `Appleintelligence_StreamingTranscribeResponse` messages.
func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>
}
/// Simple service protocol for the "appleintelligence.AppleIntelligenceService" service.
@@ -276,6 +456,71 @@ extension Appleintelligence_AppleIntelligenceService {
request: Appleintelligence_HealthRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_HealthResponse
/// Handle the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A `Appleintelligence_TextToSpeechRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_TextToSpeechResponse` to respond with.
func textToSpeech(
request: Appleintelligence_TextToSpeechRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_TextToSpeechResponse
/// Handle the "ListVoices" method.
///
/// - Parameters:
/// - request: A `Appleintelligence_ListVoicesRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_ListVoicesResponse` to respond with.
func listVoices(
request: Appleintelligence_ListVoicesRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_ListVoicesResponse
/// Handle the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A `Appleintelligence_TranscribeRequest` message.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
/// - Returns: A `Appleintelligence_TranscribeResponse` to respond with.
func transcribe(
request: Appleintelligence_TranscribeRequest,
context: GRPCCore.ServerContext
) async throws -> Appleintelligence_TranscribeResponse
/// Handle the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A stream of `Appleintelligence_StreamingTranscribeRequest` messages.
/// - response: A response stream of `Appleintelligence_StreamingTranscribeResponse` messages.
/// - context: Context providing information about the RPC.
/// - Throws: Any error which occurred during the processing of the request. Thrown errors
/// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
/// to an internal error.
func streamTranscribe(
request: GRPCCore.RPCAsyncSequence<Appleintelligence_StreamingTranscribeRequest, any Swift.Error>,
response: GRPCCore.RPCWriter<Appleintelligence_StreamingTranscribeResponse>,
context: GRPCCore.ServerContext
) async throws
}
}
@@ -316,6 +561,50 @@ extension Appleintelligence_AppleIntelligenceService.StreamingServiceProtocol {
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.TextToSpeech.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TextToSpeechRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TextToSpeechResponse>(),
handler: { request, context in
try await self.textToSpeech(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.ListVoices.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_ListVoicesRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_ListVoicesResponse>(),
handler: { request, context in
try await self.listVoices(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.Transcribe.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TranscribeRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TranscribeResponse>(),
handler: { request, context in
try await self.transcribe(
request: request,
context: context
)
}
)
router.registerHandler(
forMethod: Appleintelligence_AppleIntelligenceService.Method.StreamTranscribe.descriptor,
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_StreamingTranscribeRequest>(),
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_StreamingTranscribeResponse>(),
handler: { request, context in
try await self.streamTranscribe(
request: request,
context: context
)
}
)
}
}
@@ -354,6 +643,39 @@ extension Appleintelligence_AppleIntelligenceService.ServiceProtocol {
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func textToSpeech(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TextToSpeechResponse> {
let response = try await self.textToSpeech(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func listVoices(
request: GRPCCore.StreamingServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_ListVoicesResponse> {
let response = try await self.listVoices(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
public func transcribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_TranscribeResponse> {
let response = try await self.transcribe(
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.StreamingServerResponse(single: response)
}
}
// Default implementation of methods from 'ServiceProtocol'.
@@ -401,6 +723,62 @@ extension Appleintelligence_AppleIntelligenceService.SimpleServiceProtocol {
metadata: [:]
)
}
public func textToSpeech(
request: GRPCCore.ServerRequest<Appleintelligence_TextToSpeechRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse> {
return GRPCCore.ServerResponse<Appleintelligence_TextToSpeechResponse>(
message: try await self.textToSpeech(
request: request.message,
context: context
),
metadata: [:]
)
}
public func listVoices(
request: GRPCCore.ServerRequest<Appleintelligence_ListVoicesRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse> {
return GRPCCore.ServerResponse<Appleintelligence_ListVoicesResponse>(
message: try await self.listVoices(
request: request.message,
context: context
),
metadata: [:]
)
}
public func transcribe(
request: GRPCCore.ServerRequest<Appleintelligence_TranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse> {
return GRPCCore.ServerResponse<Appleintelligence_TranscribeResponse>(
message: try await self.transcribe(
request: request.message,
context: context
),
metadata: [:]
)
}
public func streamTranscribe(
request: GRPCCore.StreamingServerRequest<Appleintelligence_StreamingTranscribeRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse> {
return GRPCCore.StreamingServerResponse<Appleintelligence_StreamingTranscribeResponse>(
metadata: [:],
producer: { writer in
try await self.streamTranscribe(
request: request.messages,
response: writer,
context: context
)
return [:]
}
)
}
}
// MARK: appleintelligence.AppleIntelligenceService (client)
@@ -484,6 +862,90 @@ extension Appleintelligence_AppleIntelligenceService {
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_HealthResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - serializer: A serializer for `Appleintelligence_TextToSpeechRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TextToSpeechResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TextToSpeechRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TextToSpeechResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - serializer: A serializer for `Appleintelligence_ListVoicesRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_ListVoicesResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_ListVoicesRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_ListVoicesResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - serializer: A serializer for `Appleintelligence_TranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TranscribeResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - serializer: A serializer for `Appleintelligence_StreamingTranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_StreamingTranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_StreamingTranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_StreamingTranscribeResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable
}
/// Generated client for the "appleintelligence.AppleIntelligenceService" service.
@@ -605,6 +1067,132 @@ extension Appleintelligence_AppleIntelligenceService {
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - serializer: A serializer for `Appleintelligence_TextToSpeechRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TextToSpeechResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TextToSpeechRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TextToSpeechResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.TextToSpeech.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - serializer: A serializer for `Appleintelligence_ListVoicesRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_ListVoicesResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_ListVoicesRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_ListVoicesResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.ListVoices.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - serializer: A serializer for `Appleintelligence_TranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_TranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_TranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_TranscribeResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.Transcribe.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - serializer: A serializer for `Appleintelligence_StreamingTranscribeRequest` messages.
/// - deserializer: A deserializer for `Appleintelligence_StreamingTranscribeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
serializer: some GRPCCore.MessageSerializer<Appleintelligence_StreamingTranscribeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Appleintelligence_StreamingTranscribeResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.client.bidirectionalStreaming(
request: request,
descriptor: Appleintelligence_AppleIntelligenceService.Method.StreamTranscribe.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}
}
}
@@ -695,6 +1283,112 @@ extension Appleintelligence_AppleIntelligenceService.ClientProtocol {
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TextToSpeechRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.textToSpeech(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TextToSpeechRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TextToSpeechResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_ListVoicesRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.listVoices(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_ListVoicesRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_ListVoicesResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - request: A request containing a single `Appleintelligence_TranscribeRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
request: GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.transcribe(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_TranscribeRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_TranscribeResponse>(),
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - request: A streaming request producing `Appleintelligence_StreamingTranscribeRequest` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
request: GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
try await self.streamTranscribe(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Appleintelligence_StreamingTranscribeRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Appleintelligence_StreamingTranscribeResponse>(),
options: options,
onResponse: handleResponse
)
}
}
// Helpers providing sugared APIs for 'ClientProtocol' methods.
@@ -796,4 +1490,127 @@ extension Appleintelligence_AppleIntelligenceService.ClientProtocol {
onResponse: handleResponse
)
}
/// Call the "TextToSpeech" method.
///
/// > Source IDL Documentation:
/// >
/// > Text-to-Speech
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func textToSpeech<Result>(
_ message: Appleintelligence_TextToSpeechRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TextToSpeechResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_TextToSpeechRequest>(
message: message,
metadata: metadata
)
return try await self.textToSpeech(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "ListVoices" method.
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func listVoices<Result>(
_ message: Appleintelligence_ListVoicesRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_ListVoicesResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_ListVoicesRequest>(
message: message,
metadata: metadata
)
return try await self.listVoices(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "Transcribe" method.
///
/// > Source IDL Documentation:
/// >
/// > Speech-to-Text
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func transcribe<Result>(
_ message: Appleintelligence_TranscribeRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Appleintelligence_TranscribeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Appleintelligence_TranscribeRequest>(
message: message,
metadata: metadata
)
return try await self.transcribe(
request: request,
options: options,
onResponse: handleResponse
)
}
/// Call the "StreamTranscribe" method.
///
/// - Parameters:
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - producer: A closure producing request messages to send to the server. The request
/// stream is closed when the closure returns.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func streamTranscribe<Result>(
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Appleintelligence_StreamingTranscribeRequest>) async throws -> Void,
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Appleintelligence_StreamingTranscribeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
let request = GRPCCore.StreamingClientRequest<Appleintelligence_StreamingTranscribeRequest>(
metadata: metadata,
producer: producer
)
return try await self.streamTranscribe(
request: request,
options: options,
onResponse: handleResponse
)
}
}
File diff suppressed because it is too large Load Diff