deepgram

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJson

func GetJson(resp *http.Response, target interface{}) error

func SecondsToTimestamp added in v0.5.0

func SecondsToTimestamp(seconds float64) string

Types

type Alternative

type Alternative struct {
	Transcript string       `json:"transcript"`
	Confidence float64      `json:"confidence"`
	Words      []WordBase   `json:"words"`
	Topics     []TopicBase  `json:"topics"`
	Entities   []EntityBase `json:"entities"`
}

type Balance added in v0.6.0

type Balance struct {
	Amount          float64 `json:"amount"`
	BalanceId       string  `json:"balance_id"`
	Units           string  `json:"units"`
	PurchaseOrderId string  `json:"purchase_order_id"`
}

type BalanceList added in v0.6.0

type BalanceList struct {
	Balances []Balance `json:"balances"`
}

type BufferSource

type BufferSource struct {
	Buffer   bytes.Buffer `json:"buffer"`
	Mimetype string       `json:"mimetype"`
}

type Channel

type Channel struct {
	Search       []Search      `json:"search"`
	Alternatives []Alternative `json:"alternatives"`
}

type Client

type Client struct {
	ApiKey string
	Host   string
	Path   string
}

func NewClient

func NewClient(apiKey string) *Client

func (*Client) CreateKey added in v0.6.0

func (dg *Client) CreateKey(projectId string, comment string, scopes []string, options CreateKeyOptions) (Key, error)

func (*Client) DeleteInvitation

func (dg *Client) DeleteInvitation(projectId string, email string) (Message, error)

func (*Client) DeleteKey added in v0.6.0

func (dg *Client) DeleteKey(projectId string, keyId string) (Message, error)

func (*Client) DeleteProject added in v0.6.0

func (dg *Client) DeleteProject(projectId string) (Message, error)

func (*Client) GetBalance added in v0.6.0

func (dg *Client) GetBalance(projectId string, balanceId string) (Balance, error)

func (*Client) GetFields added in v0.6.0

func (dg *Client) GetFields(projectId string, options UsageRequestListOptions) (interface{}, error)

func (*Client) GetKey added in v0.6.0

func (dg *Client) GetKey(projectId string, keyId string) (KeyResponseObj, error)

func (*Client) GetMemberScopes added in v0.6.0

func (dg *Client) GetMemberScopes(projectId string, memberId string) (ScopeList, error)

func (*Client) GetProject added in v0.6.0

func (dg *Client) GetProject(projectId string) (Project, error)

func (*Client) GetRequest added in v0.6.0

func (dg *Client) GetRequest(projectId string, requestId string) (UsageRequest, error)

func (*Client) GetUsage added in v0.6.0

func (dg *Client) GetUsage(projectId string, options UsageOptions) (UsageSummary, error)

func (*Client) LeaveProject added in v0.6.0

func (dg *Client) LeaveProject(projectId string) (Message, error)

func (*Client) ListBalances added in v0.6.0

func (dg *Client) ListBalances(projectId string) (BalanceList, error)

func (*Client) ListInvitations

func (dg *Client) ListInvitations(projectId string) (InvitationList, error)

func (*Client) ListKeys added in v0.6.0

func (dg *Client) ListKeys(projectId string) (KeyResponse, error)

func (*Client) ListMembers added in v0.6.0

func (dg *Client) ListMembers(projectId string) (MemberList, error)

func (*Client) ListProjects added in v0.6.0

func (dg *Client) ListProjects() (ProjectResponse, error)

func (*Client) ListRequests

func (dg *Client) ListRequests(projectId string, options UsageRequestListOptions) (UsageRequestList, error)

func (*Client) LiveTranscription

func (dg *Client) LiveTranscription(options LiveTranscriptionOptions) (*websocket.Conn, *http.Response, error)

func (*Client) PreRecordedFromStream added in v0.7.0

func (dg *Client) PreRecordedFromStream(source ReadStreamSource, options PreRecordedTranscriptionOptions) (*PreRecordedResponse, error)

func (*Client) PreRecordedFromURL

func (dg *Client) PreRecordedFromURL(source UrlSource, options PreRecordedTranscriptionOptions) (PreRecordedResponse, error)

func (*Client) RemoveMember added in v0.6.0

func (dg *Client) RemoveMember(projectId string, memberId string) (Message, error)

func (*Client) SendInvitation

func (dg *Client) SendInvitation(projectId string, options InvitationOptions) (Message, error)

func (*Client) UpdateMemberScopes added in v0.6.0

func (dg *Client) UpdateMemberScopes(projectId string, memberId string, scope string) (Message, error)

func (*Client) UpdateProject added in v0.6.0

func (dg *Client) UpdateProject(projectId string, options ProjectUpdateOptions) (Message, error)

func (*Client) WithHost

func (c *Client) WithHost(host string) *Client

func (*Client) WithPath

func (c *Client) WithPath(path string) *Client

type CreateKeyOptions added in v0.6.0

type CreateKeyOptions struct {
	ExpirationDate time.Time `json:"expiration_date"`
	TimeToLive     int       `json:"time_to_live"`
	Tags           []string  `json:"tags"`
}

type CreateKeyRequest added in v0.6.0

type CreateKeyRequest struct {
	Comment        string   `json:"comment"`
	Scopes         []string `json:"scopes"`
	ExpirationDate string   `json:"expiration_date,omitempty"`
	TimeToLive     int      `json:"time_to_live,omitempty"`
}

type EntityBase added in v0.7.0

type EntityBase struct {
	Label      string  `json:"label"`
	Value      string  `json:"value"`
	Confidence float64 `json:"confidence"`
	StartWord  int     `json:"start_word"`
	EndWord    int     `json:"end_word"`
}

type Hit

type Hit struct {
	Confidence float64 `json:"confidence"`
	Start      float64 `json:"start"`
	End        float64 `json:"end"`
	Snippet    string  `json:"snippet"`
}

type InvitationList

type InvitationList struct {
	Invites []InvitationOptions `json:"invites"`
}

type InvitationOptions

type InvitationOptions struct {
	Email string `json:"email"`
	Scope string `json:"scope"`
}

type Key added in v0.6.0

type Key struct {
	ApiKeyId string   `json:"api_key_id"`
	Key      string   `json:"key"`
	Comment  string   `json:"comment"`
	Created  string   `json:"created"`
	Scopes   []string `json:"scopes"`
}

type KeyResponse added in v0.6.0

type KeyResponse struct {
	ApiKeys []KeyResponseObj `json:"api_keys"`
}

type KeyResponseObj added in v0.6.0

type KeyResponseObj struct {
	Member Member `json:"member"`
	ApiKey Key    `json:"api_key"`
}

type LiveTranscriptionOptions

type LiveTranscriptionOptions struct {
	Alternatives     int      `json:"alternatives" url:"alternatives,omitempty" `
	Callback         string   `json:"callback" url:"callback,omitempty" `
	Channels         int      `json:"channels" url:"channels,omitempty" `
	Dates            bool     `json:"dates" url:"dates,omitempty"` // Indicates whether to convert dates from written format (e.g., january first) to numerical format (e.g., 01-01).
	Diarize          bool     `json:"diarize" url:"diarize,omitempty" `
	Diarize_version  string   `json:"diarize_version" url:"diarize_version,omitempty" `
	Dictation        bool     `json:"dictation" url:"dictation,omitempty"` // Option to format punctuated commands. Eg: "i went to the store period new paragraph then i went home" --> "i went to the store. <\n> then i went home"
	Encoding         string   `json:"encoding" url:"encoding,omitempty" `
	Endpointing      string   `json:"endpointing" url:"endpointing,omitempty" ` // Can be "false" to disable endpointing, or can be the milliseconds of silence to wait before returning a transcript. Default is 10 milliseconds. Is string here so it can accept "false" as a value.
	Interim_results  bool     `json:"interim_results" url:"interim_results,omitempty" `
	Keywords         []string `json:"keywords" url:"keywords,omitempty" `
	KeywordBoost     string   `json:"keyword_boost" url:"keyword_boost,omitempty" `
	Language         string   `json:"language" url:"language,omitempty" `
	Measurements     bool     `json:"measurements" url:"measurements,omitempty" `
	Model            string   `json:"model" url:"model,omitempty" `
	Multichannel     bool     `json:"multichannel" url:"multichannel,omitempty" `
	Ner              bool     `json:"ner" url:"ner,omitempty" `
	Numbers          bool     `json:"numbers" url:"numbers,omitempty" `
	Numerals         bool     `json:"numerals" url:"numerals,omitempty" `
	Profanity_filter bool     `json:"profanity_filter" url:"profanity_filter,omitempty" `
	Punctuate        bool     `json:"punctuate" url:"punctuate,omitempty" `
	Redact           bool     `json:"redact" url:"redact,omitempty" `
	Replace          string   `json:"replace" url:"replace,omitempty" `
	Sample_rate      int      `json:"sample_rate" url:"sample_rate,omitempty" `
	Search           []string `json:"search" url:"search,omitempty" `
	Tag              []string `json:"tag" url:"tag,omitempty" `
	Tier             string   `json:"tier" url:"tier,omitempty" `
	Times            bool     `json:"times" url:"times,omitempty" `
	Vad_turnoff      int      `json:"vad_turnoff" url:"vad_turnoff,omitempty" `
	Version          string   `json:"version" url:"version,omitempty" `
}

type Member added in v0.6.0

type Member struct {
	Email     string   `json:"email"`
	MemberId  string   `json:"member_id"`
	FirstName string   `json:"first_name"`
	LastName  string   `json:"last_name"`
	Scopes    []string `json:"scopes"`
}

type MemberList added in v0.6.0

type MemberList struct {
	Members []Member `json:"members"`
}

type MemberScope added in v0.6.0

type MemberScope struct {
	Scope string `json:"scope"`
}

type Message

type Message struct {
	Message string `json:"message"`
}

type Metadata

type Metadata struct {
	RequestId      string  `json:"request_id"`
	TransactionKey string  `json:"transaction_key"`
	Sha256         string  `json:"sha256"`
	Created        string  `json:"created"`
	Duration       float64 `json:"duration"`
	Channels       int     `json:"channels"`
}

type PreRecordedResponse

type PreRecordedResponse struct {
	Request_id string   `json:"request_id"`
	Metadata   Metadata `json:"metadata"`
	Results    Results  `json:"results"`
}

func (*PreRecordedResponse) ToSRT added in v0.5.0

func (resp *PreRecordedResponse) ToSRT() (string, error)

func (*PreRecordedResponse) ToWebVTT added in v0.5.0

func (resp *PreRecordedResponse) ToWebVTT() (string, error)

type PreRecordedTranscriptionOptions

type PreRecordedTranscriptionOptions struct {
	Alternatives       int      `json:"alternatives" url:"alternatives,omitempty" `
	AnalyzeSentiment   bool     `json:"analyze_sentiment" url:"analyze_sentiment,omitempty" `
	Callback           string   `json:"callback" url:"callback,omitempty" `
	Dates              bool     `json:"dates" url:"dates,omitempty"` // Indicates whether to convert dates from written format (e.g., january first) to numerical format (e.g., 01-01).
	DetectEntities     bool     `json:"detect_entities" url:"detect_entities,omitempty"`
	DetectLanguage     bool     `json:"detect_language" url:"detect_language,omitempty" `
	DetectTopics       bool     `json:"detect_topics" url:"detect_topics,omitempty" `
	Diarize            bool     `json:"diarize" url:"diarize,omitempty" `
	Diarize_version    string   `json:"diarize_version" url:"diarize_version,omitempty" `
	Dictation          bool     `json:"dictation" url:"dictation,omitempty"` // Option to format punctuated commands. Eg: "i went to the store period new paragraph then i went home" --> "i went to the store. <\n> then i went home"
	Keywords           []string `json:"keywords" url:"keywords,omitempty" `
	KeywordBoost       string   `json:"keyword_boost" url:"keyword_boost,omitempty" `
	Language           string   `json:"language" url:"language,omitempty" `
	Measurements       bool     `json:"measurements" url:"measurements,omitempty"`
	Model              string   `json:"model" url:"model,omitempty" `
	Multichannel       bool     `json:"multichannel" url:"multichannel,omitempty" `
	Ner                bool     `json:"ner" url:"ner,omitempty" `
	Numbers            bool     `json:"numbers" url:"numbers,omitempty" `
	Numerals           bool     `json:"numerals" url:"numerals,omitempty" ` // Same as Numbers, old name for same option
	Paragraphs         bool     `json:"paragraphs" url:"paragraphs,omitempty" `
	Profanity_filter   bool     `json:"profanity_filter" url:"profanity_filter,omitempty" `
	Punctuate          bool     `json:"punctuate" url:"punctuate,omitempty" `
	Redact             bool     `json:"redact" url:"redact,omitempty" `
	Replace            []string `json:"replace" url:"replace,omitempty" `
	Search             []string `json:"search" url:"search,omitempty" `
	Sentiment          bool     `json:"sentiment" url:"sentiment,omitempty" `
	SentimentThreshold float64  `json:"sentiment_threshold" url:"sentiment_threshold,omitempty" `
	Summarize          bool     `json:"summarize" url:"summarize,omitempty" `
	Tag                []string `json:"tag" url:"tag,omitempty"`
	Tier               string   `json:"tier" url:"tier,omitempty" `
	Times              bool     `json:"times" url:"times,omitempty"` // Indicates whether to convert times from written format (e.g., 3:00 pm) to numerical format (e.g., 15:00).
	Translate          string   `json:"translate" url:"translate,omitempty" `
	Utterances         bool     `json:"utterances" url:"utterances,omitempty" `
	Utt_split          int      `json:"utt_split" url:"utt_split,omitempty" `
	Version            string   `json:"version" url:"version,omitempty" `
}

type Project added in v0.6.0

type Project struct {
	ProjectId string `json:"project_id"`
	Name      string `json:"name,omitempty"`
	Company   string `json:"company,omitempty"`
}

type ProjectResponse added in v0.6.0

type ProjectResponse struct {
	Projects []Project `json:"projects"`
}

type ProjectUpdateOptions added in v0.6.0

type ProjectUpdateOptions struct {
	Name    string `json:"name,omitempty"`
	Company string `json:"company,omitempty"`
}

type ReadStreamSource

type ReadStreamSource struct {
	Stream   io.Reader `json:"stream"`
	Mimetype string    `json:"mimetype"`
}

type Results

type Results struct {
	Utterances []Utterance `json:"utterances"`
	Channels   []Channel   `json:"channels"`
}

type ScopeList added in v0.6.0

type ScopeList struct {
	Scopes []string `json:"scopes"`
}
type Search struct {
	Query string `json:"query"`
	Hits  []Hit  `json:"hits"`
}

type Topic added in v0.7.0

type Topic struct {
	Topic      string  `json:"topic"`
	Confidence float64 `json:"confidence"`
}

type TopicBase added in v0.7.0

type TopicBase struct {
	Text      string  `json:"text"`
	StartWord int     `json:"start_word"`
	EndWord   int     `json:"end_word"`
	Topics    []Topic `json:"topics"`
}

type TranscriptionSource

type TranscriptionSource interface {
	ReadStreamSource | UrlSource | BufferSource
}

type UrlSource

type UrlSource struct {
	Url string `json:"url"`
}

type UsageOptions added in v0.6.0

type UsageOptions struct {
	Accessor           string   `json:"accessor" url:"accessor,omitempty"`
	Alternatives       bool     `json:"alternatives" url:"alternatives,omitempty"`
	AnalyzeSentiment   bool     `json:"analyze_sentiment" url:"analyze_sentiment,omitempty"`
	DetectEntities     bool     `json:"detect_entities" url:"detect_entities,omitempty"`
	DetectLanguage     bool     `json:"detect_language" url:"detect_language,omitempty"`
	DetectTopics       bool     `json:"detect_topics" url:"detect_topics,omitempty"`
	Diarize            bool     `json:"diarize" url:"diarize,omitempty"`
	End                string   `json:"end" url:"end,omitempty"`
	InterimResults     bool     `json:"interim_results" url:"interim_results,omitempty"`
	Keywords           bool     `json:"keywords" url:"keywords,omitempty"`
	Method             string   `json:"method" url:"method,omitempty"` // Must be one of "sync" | "async" | "streaming"
	Model              string   `json:"model" url:"model,omitempty"`
	Multichannel       bool     `json:"multichannel" url:"multichannel,omitempty"`
	Ner                bool     `json:"ner" url:"ner,omitempty"`
	Numbers            bool     `json:"numbers" url:"numbers,omitempty"`
	Numerals           bool     `json:"numerals" url:"numerals,omitempty"`
	Paragraphs         bool     `json:"paragraphs" url:"paragraphs,omitempty"`
	ProfanityFilter    bool     `json:"profanity_filter" url:"profanity_filter,omitempty"`
	Punctuate          bool     `json:"punctuate" url:"punctuate,omitempty"`
	Redact             bool     `json:"redact" url:"redact,omitempty"`
	Replace            bool     `json:"replace" url:"replace,omitempty"`
	Search             bool     `json:"search" url:"search,omitempty"`
	Sentiment          bool     `json:"sentiment" url:"sentiment,omitempty"`
	SentimentThreshold float64  `json:"sentiment_threshold" url:"sentiment_threshold,omitempty"`
	SmartFormat        bool     `json:"smart_format" url:"smart_format,omitempty"`
	Start              string   `json:"start" url:"start,omitempty"`
	Summarize          bool     `json:"summarize" url:"summarize,omitempty"`
	Tag                []string `json:"tag" url:"tag,omitempty"`
	Translate          bool     `json:"translate" url:"translate,omitempty"`
	Utterances         bool     `json:"utterances" url:"utterances,omitempty"`
	UttSplit           bool     `json:"utt_split" url:"utt_split,omitempty"`
}

type UsageRequest

type UsageRequest struct {
	RequestId string      `json:"request_id" url:"request_id,omitempty"`
	Created   string      `json:"created" url:"created,omitempty"`
	Path      string      `json:"path" url:"path,omitempty"`
	Accessor  string      `json:"accessor" url:"accessor,omitempty"`
	Response  interface{} `json:"response" url:"response,omitempty"`
	Callback  interface{} `json:"callback" url:"callback,omitempty"`
}

type UsageRequestList

type UsageRequestList struct {
	Page     int         `json:"page" url:"page,omitempty"`
	Limit    int         `json:"limit" url:"limit,omitempty"`
	Requests interface{} `json:"requests" url:"requests,omitempty"`
}

type UsageRequestListOptions

type UsageRequestListOptions struct {
	Start  string `json:"start" url:"start,omitempty"`
	End    string `json:"end" url:"end,omitempty"`
	Page   int    `json:"page" url:"page,omitempty"`
	Limit  int    `json:"limit" url:"limit,omitempty"`
	Status string `json:"status" url:"status,omitempty"`
}

type UsageResponseDetail added in v0.6.0

type UsageResponseDetail struct {
	Start    string  `json:"start"`
	End      string  `json:"end"`
	Hours    float64 `json:"hours"`
	Requests int     `json:"requests"`
}

type UsageSummary added in v0.6.0

type UsageSummary struct {
	Start      string                `json:"start"`
	End        string                `json:"end"`
	Resolution interface{}           `json:"resolution"`
	Results    []UsageResponseDetail `json:"results"`
}

type Utterance

type Utterance struct {
	Start      float64    `json:"start"`
	End        float64    `json:"end"`
	Confidence float64    `json:"confidence"`
	Channel    int        `json:"channel"`
	Transcript string     `json:"transcript"`
	Words      []WordBase `json:"words"`
	Speaker    int        `json:"speaker"`
	Id         string     `json:"id"`
}

type WordBase

type WordBase struct {
	Word            string  `json:"word"`
	Start           float64 `json:"start"`
	End             float64 `json:"end"`
	Confidence      float64 `json:"confidence"`
	Punctuated_Word string  `json:"punctuated_word"`
	Speaker         int     `json:"speaker"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL