Last week, we released version 1.3.0 of the AssemblyAI Go SDK. In this post, we'll cover the new features and improvements you can enjoy once you upgrade to the latest version.
To update your project to use the latest version, run the following command in your Go project directory:
go get github.com/AssemblyAI/assemblyai-go-sdk@v1.3.0
Search words in a transcript
Want to know if a topic came up in the last meeting? The Go SDK now supports word search, which lets you query whether a transcript contains a list of words. Along with each match, you'll also get information about when it was mentioned and how often.
To search a transcript for a set of words, use the WordSearch()
method:
resp, _ := client.Transcripts.WordSearch(ctx, transcriptID, []string{"hopkins", "wildfires"})
for _, match := range resp.Matches {
fmt.Printf("Found %d matches for %q:\n",
aai.ToInt64(match.Count),
aai.ToString(match.Text),
)
for _, timestamp := range match.Timestamps {
fmt.Printf("\tBetween %d and %d\n", timestamp[0], timestamp[1])
}
}
Example output:
Found 2 matches for "hopkins":
Between 24298 and 24714
Between 273498 and 274090
Found 4 matches for "wildfires":
Between 1668 and 2346
Between 33852 and 34546
Between 50118 and 51110
Between 231356 and 232354
Purge LeMUR request data
By default, AssemblyAI stores requests for the LeMUR endpoint, along with the model output. With the new PurgeRequestData
method, you can permanently delete the data associated with your LeMUR request.
To purge data for a LeMUR request, pass the request ID from the LeMUR result to the PurgeRequestData()
method:
result, _ := client.LeMUR.Task(ctx, params)
response, _ := client.LeMUR.PurgeRequestData(ctx, aai.ToString(result.RequestID))
if aai.ToBool(response.Deleted) {
fmt.Println("Successfully deleted request data")
}
Enhancements and bug fixes
v1.3.0 also includes a couple of improvements to existing functionality.
Send real-time audio samples as binary data
The AssemblyAI WebSocket API now supports sending real-time audio as binary data. Previously, API users needed to send audio data as a base64-encoded string. You don't need to make any changes.
Type change for the LeMUR Context
The Context
field lets you set a context for the transcript when using Specialized endpoints. When we launched the initial version of the SDK, the Context
type was generated to be json.RawMessage
, which makes it tricky to use.
With the new release, the type for the Context
field in LeMURBaseParams
has been changed from json.RawMessage
to interface{}
.
var params aai.LeMURSummaryParams
params.TranscriptIDs = []string{transcriptID}
params.AnswerFormat = aai.String("TLDR")
params.Context = "A GitLab meeting to discuss logistics"
result, err := client.LeMUR.Summarize(ctx, params)
if err != nil {
fmt.Println(err)
return
}
Context
to provide a more structured context.Tell us what you think
If you have any questions about the release or if you’re experiencing any issues when upgrading to a newer version, let us know by submitting a GitHub issue.
If you want to keep up with more content like this, subscribe to our newsletter and join our Discord server.