Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keyterms to keyterm #281

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/agent/websocket/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func main() {
tOptions.Agent.Think.Model = "gpt-4o-mini"
tOptions.Agent.Think.Instructions = "You are a helpful AI assistant."
tOptions.Agent.Listen.Model = "nova-3"
tOptions.Agent.Listen.Keyterms = []string{"Bueller"}
tOptions.Agent.Listen.Keyterm = []string{"Bueller"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

LGTM! Terminology update is consistent.

The change from Keyterms to Keyterm aligns with the PR objectives and maintains the same functionality.

Let's verify this change is consistent across the SDK:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining instances of "Keyterms" in the codebase
# to ensure the terminology update is complete.

echo "Searching for remaining instances of 'Keyterms'..."
rg -i "keyterms" --type go

Length of output: 706


Action Needed: Inconsistent Terminology Detected

  • The change in examples/agent/websocket/simple/main.go (line 397) to use Keyterm is correctly implemented and aligns with the PR objectives.
  • However, a search of the codebase shows that several log messages still reference "Keyterms":
    • pkg/client/agent/v1/websocket/new_using_chan.go
    • pkg/client/listen/v1/websocket/new_using_chan.go
    • pkg/client/listen/v1/websocket/new_using_callbacks.go
    • pkg/client/listen/v1/rest/client.go (2 occurrences)

Please verify whether these references should also be updated to Keyterm for consistency across the SDK, or if they are intentionally retained for backward compatibility. Adjust accordingly.


// implement your own callback
callback := msginterfaces.AgentMessageChan(*NewMyHandler())
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/callback/callback/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func main() {
url,
&interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Diarize: true,
Language: "en-US",
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/file/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"Bueller"},
Keyterm: []string{"Bueller"},
Punctuate: true,
Paragraphs: true,
SmartFormat: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/intent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Language: "en-US",
SmartFormat: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/sentiment/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Language: "en-US",
SmartFormat: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/stream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"Bueller"},
Keyterm: []string{"Bueller"},
Punctuate: true,
Diarize: true,
Language: "en-US",
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/summary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Language: "en-US",
SmartFormat: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/topic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Language: "en-US",
SmartFormat: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/rest/url/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
// send stream to Deepgram
options := &interfaces.PreRecordedTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Punctuate: true,
Diarize: true,
Language: "en-US",
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/websocket/http_callback/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// set the Transcription options
transcriptOptions := &interfaces.LiveTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Language: "en-US",
Punctuate: true,
}
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/websocket/http_channel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
// set the Transcription options
transcriptOptions := &interfaces.LiveTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Language: "en-US",
Punctuate: true,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func main() {
// set the Transcription options
tOptions := &interfaces.LiveTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Language: "en-US",
Punctuate: true,
Encoding: "linear16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func main() {
// set the Transcription options
tOptions := &interfaces.LiveTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Language: "en-US",
Punctuate: true,
Encoding: "linear16",
Expand Down
2 changes: 1 addition & 1 deletion examples/speech-to-text/websocket/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
// set the Transcription options
options := &interfaces.LiveTranscriptionOptions{
Model: "nova-3",
Keyterms: []string{"deepgram"},
Keyterm: []string{"deepgram"},
Language: "en-US",
Punctuate: true,
Encoding: "mulaw",
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/agent/v1/websocket/new_using_chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, a
if apiKey != "" {
cOptions.APIKey = apiKey
}
if len(tOptions.Agent.Listen.Keyterms) > 0 && !strings.HasPrefix(tOptions.Agent.Listen.Model, "nova-3") {
if len(tOptions.Agent.Listen.Keyterm) > 0 && !strings.HasPrefix(tOptions.Agent.Listen.Model, "nova-3") {
klog.V(1).Info("Keyterms are only supported with nova-3 models.")
return nil, nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/interfaces/v1/types-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type Audio struct {
Output *Output `json:"output,omitempty"`
}
type Listen struct {
Model string `json:"model,omitempty"`
Keyterms []string `json:"keyterms,omitempty"`
Model string `json:"model,omitempty"`
Keyterm []string `json:"keyterm,omitempty"`
}
type Provider struct {
Type string `json:"type,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/interfaces/v1/types-prerecorded.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type PreRecordedTranscriptionOptions struct {
FillerWords bool `json:"filler_words,omitempty" schema:"filler_words,omitempty"`
Intents bool `json:"intents,omitempty" schema:"intents,omitempty"`
Keywords []string `json:"keywords,omitempty" schema:"keywords,omitempty"`
Keyterms []string `json:"keyterms,omitempty" schema:"keyterms,omitempty"`
Keyterm []string `json:"keyterm,omitempty" schema:"keyterm,omitempty"`
Language string `json:"language,omitempty" schema:"language,omitempty"`
Measurements bool `json:"measurements,omitempty" schema:"measurements,omitempty"`
Model string `json:"model,omitempty" schema:"model,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/interfaces/v1/types-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type LiveTranscriptionOptions struct {
FillerWords bool `json:"filler_words,omitempty" schema:"filler_words,omitempty"`
InterimResults bool `json:"interim_results,omitempty" schema:"interim_results,omitempty"`
Keywords []string `json:"keywords,omitempty" schema:"keywords,omitempty"`
Keyterms []string `json:"keyterms,omitempty" schema:"keyterms,omitempty"`
Keyterm []string `json:"keyterm,omitempty" schema:"keyterm,omitempty"`
Language string `json:"language,omitempty" schema:"language,omitempty"`
Model string `json:"model,omitempty" schema:"model,omitempty"`
Multichannel bool `json:"multichannel,omitempty" schema:"multichannel,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/listen/v1/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Output parameters:
func (c *Client) DoFile(ctx context.Context, filePath string, req *interfaces.PreRecordedTranscriptionOptions, resBody interface{}) error {
klog.V(6).Infof("prerecorded.DoFile() ENTER\n")

if len(req.Keyterms) > 0 && !strings.HasPrefix(req.Model, "nova-3") {
if len(req.Keyterm) > 0 && !strings.HasPrefix(req.Model, "nova-3") {
klog.V(1).Info("Keyterms are only supported with nova-3 models.")
return nil
}
Expand Down Expand Up @@ -122,7 +122,7 @@ Output parameters:
func (c *Client) DoStream(ctx context.Context, src io.Reader, options *interfaces.PreRecordedTranscriptionOptions, resBody interface{}) error {
klog.V(6).Infof("prerecorded.DoStream() ENTER\n")

if len(options.Keyterms) > 0 && !strings.HasPrefix(options.Model, "nova-3") {
if len(options.Keyterm) > 0 && !strings.HasPrefix(options.Model, "nova-3") {
klog.V(1).Info("Keyterms are only supported with nova-3 models.")
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/listen/v1/websocket/new_using_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFun
if apiKey != "" {
cOptions.APIKey = apiKey
}
if len(tOptions.Keyterms) > 0 && !strings.HasPrefix(tOptions.Model, "nova-3") {
if len(tOptions.Keyterm) > 0 && !strings.HasPrefix(tOptions.Model, "nova-3") {
klog.V(1).Info("Keyterms are only supported with nova-3 models.")
return nil, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/listen/v1/websocket/new_using_chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, a
if apiKey != "" {
cOptions.APIKey = apiKey
}
if len(tOptions.Keyterms) > 0 && !strings.HasPrefix(tOptions.Model, "nova-3") {
if len(tOptions.Keyterm) > 0 && !strings.HasPrefix(tOptions.Model, "nova-3") {
klog.V(1).Info("Keyterms are only supported with nova-3 models.")
return nil, nil
}
Expand Down
Loading