Skip to content

v1.5.0

Compare
Choose a tag to compare
@marcusolsson marcusolsson released this 16 Apr 09:48
· 1 commit to main since this release
56d6173

What's Changed

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.