Documentation ¶
Overview ¶
Package whisper provides a client for interacting with the OpenAI Whisper ASR API.
Index ¶
Constants ¶
const ( DefaultBase = "https://api.openai.com/v1" DefaultModel = "whisper-1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main structure for interacting with the Whisper ASR API.
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
NewClient creates a new Whisper ASR API client with the given options.
func (*Client) Transcribe ¶
func (c *Client) Transcribe(h io.Reader, opts ...TranscribeOption) (*TranscribeResponse, error)
Transcribe transcribes the given audio stream using the Whisper ASR API.
func (*Client) TranscribeFile ¶
func (c *Client) TranscribeFile(file string, opts ...TranscribeOption) (*TranscribeResponse, error)
TranscribeFile transcribes the given file using the Whisper ASR API.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function type that allows to set options for the Client.
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
WithBaseURL sets the base URL for the Client.
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the HTTP client for the Client.
type Segment ¶
type Segment struct { ID int `json:"id"` Seek int `json:"seek"` Start float64 `json:"start"` End float64 `json:"end"` Text string `json:"text"` Tokens []int `json:"tokens"` Temperature float64 `json:"temperature"` AvgLogprob float64 `json:"avg_logprob"` CompressionRatio float64 `json:"compression_ratio"` NoSpeechProb float64 `json:"no_speech_prob"` Transient bool `json:"transient"` }
Segment represents a segment of transcribed text in the TranscribeResponse.
type TranscribeConfig ¶
TranscribeConfig is a structure that holds the configuration for the Transcribe method.
type TranscribeOption ¶
type TranscribeOption func(*TranscribeConfig)
TranscribeOption is a function type that allows to set options for the Transcribe method.
func WithFile ¶
func WithFile(file string) TranscribeOption
WithFile sets the file for the Transcribe method.
func WithLanguage ¶
func WithLanguage(lang string) TranscribeOption
WithLanguage sets the language for the Transcribe method.
func WithModel ¶
func WithModel(model string) TranscribeOption
WithModel sets the model for the Transcribe method.