v1.5.0
What's Changed
- Sync from internal repo (2024-04-15) by @marcusolsson in #17
- Sync from internal repo (2024-04-15) by @marcusolsson in #18
- Sync from internal repo (2024-04-16) by @marcusolsson in #19
Full Changelog: v1.4.1...v1.5.0
New real-time transcriber
This release introduces a new RealTimeTranscriber
type along with the WithRealTimeTranscript
option. RealTimeTranscriber
replaces the RealTimeHandler
interface. While this deprecates RealTimeHandler
, no action is required for this release.
The new RealTimeTranscriber
allows you to only define callbacks for the events you care about.
transcriber := &aai.RealTimeTranscriber{
OnSessionBegins: func(event aai.SessionBegins) {
// ...
},
OnSessionTerminated: func(event aai.SessionTerminated) {
// ...
},
OnPartialTranscript: func(event aai.PartialTranscript) {
// ...
},
OnFinalTranscript: func(event aai.FinalTranscript) {
// ...
},
OnSessionInformation: func(event aai.SessionInformation) {
// ...
},
OnError: func(err error) {
// ...
},
}
client := aai.NewRealTimeClientWithOptions(
aai.WithRealTimeAPIKey("YOUR_API_KEY"),
aai.WithRealTimeTranscriber(transcriber),
)
Extra session information
You can now receive extra session information by defining the OnSessionInformation
callback with the new recently introduced RealTimeTranscriber
.
client := aai.NewRealTimeClientWithOptions(
aai.WithRealTimeAPIKey("YOUR_API_KEY"),
aai.WithRealTimeTranscriber(&aai.RealTimeTranscriber{
OnSessionInformation: func(event aai.SessionInformation) {
// ...
},
}),
)
Performance improvements
The server now only sends partial transcripts if you've defined the OnPartialTranscript
. This reduces network traffic when you're only interested in final transcripts.
transcriber := &aai.RealTimeTranscriber{
OnFinalTranscript: func(event aai.FinalTranscript) {
// ...
},
}
Note: If you're using the now deprecated RealTimeHandler
, you need to migrate to RealTimeTranscriber
to benefit from this.