Skip to content

Commit

Permalink
Keep Backwards Compatibility of Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
dvonthenen committed Nov 13, 2023
1 parent e562aaf commit a68b9d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
6 changes: 4 additions & 2 deletions examples/prerecorded/callback/callback/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"

Expand All @@ -18,7 +19,8 @@ import (
)

const (
url string = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"
url string = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"
hostport string = "<REPLACE WITH YOUR HOSTPORT - FORMAT: 127.0.0.1:3000>"
)

func main() {
Expand All @@ -41,7 +43,7 @@ func main() {
Diarize: true,
Language: "en-US",
Utterances: true,
Callback: "https://136.22.14.123:3000/v1/callback",
Callback: fmt.Sprintf("https://%s/v1/callback", hostport),
},
)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions pkg/api/prerecorded/v1/interfaces/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Alternatives struct {
Words []Words `json:"words,omitempty"`
Paragraphs Paragraphs `json:"paragraphs,omitempty"`
Entities []Entities `json:"entities,omitempty"`
Summaries []Summaries `json:"summaries,omitempty"`
Summaries []SummaryV1 `json:"summaries,omitempty"`
Topics []Topics `json:"topics,omitempty"`
}

Expand Down Expand Up @@ -118,21 +118,21 @@ type Utterances struct {
type Results struct {
Channels []Channels `json:"channels,omitempty"`
Utterances []Utterances `json:"utterances,omitempty"`
Summary Summary `json:"summary,omitempty"`
Summary SummaryV2 `json:"summary,omitempty"`
}

type Summaries struct {
type SummaryV1 struct {
Summary string `json:"summary,omitempty"`
StartWord int `json:"start_word,omitempty"`
EndWord int `json:"end_word,omitempty"`
}
type SummaryV1 Summaries
type Summaries SummaryV1 // internal reference to old name

type Summary struct {
type SummaryV2 struct {
Short string `json:"short,omitempty"`
Result string `json:"result,omitempty"`
}
type SummaryV2 Summary
type Summary SummaryV2 // internal reference to old name

// Response
type PreRecordedResponse struct {
Expand Down
9 changes: 9 additions & 0 deletions pkg/api/prerecorded/v1/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT

package prerecorded

// type urlSource struct {
// Url string `json:"url"`
// }

0 comments on commit a68b9d2

Please sign in to comment.