Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func Initialize(mode TranscriptionMode, config *OpenAIWhisperConfig) error
Initialize initializes the transcription service
func TranscribePCM ¶
TranscribePCM transcribes PCM audio data
Types ¶
type MultipartWriter ¶
MultipartWriter is a helper to create multipart form data
func NewMultipartWriterWithFile ¶
func NewMultipartWriterWithFile(buffer *bytes.Buffer, fieldName, fileName string, fileData []byte) *MultipartWriter
NewMultipartWriterWithFile creates a new multipart writer with a file
func (*MultipartWriter) WriteField ¶
func (m *MultipartWriter) WriteField(fieldName, value string)
WriteField adds a form field to the multipart writer
type OpenAIWhisperClient ¶
type OpenAIWhisperClient struct { Config *OpenAIWhisperConfig Client *http.Client }
OpenAIWhisperClient is a client for the OpenAI Whisper API
func NewOpenAIWhisperClient ¶
func NewOpenAIWhisperClient(config *OpenAIWhisperConfig) *OpenAIWhisperClient
NewOpenAIWhisperClient creates a new client for the OpenAI Whisper API
func (*OpenAIWhisperClient) TranscribePCMWithAPI ¶
func (c *OpenAIWhisperClient) TranscribePCMWithAPI(samples []int16) error
TranscribePCMWithAPI transcribes PCM audio using the OpenAI Whisper API
type OpenAIWhisperConfig ¶
type OpenAIWhisperConfig struct { APIKey string Model string Language string Temperature float64 Timeout time.Duration }
OpenAIWhisperConfig holds the configuration for the OpenAI Whisper API
func DefaultOpenAIConfig ¶
func DefaultOpenAIConfig() *OpenAIWhisperConfig
DefaultOpenAIConfig returns a default configuration for the OpenAI Whisper API
type TranscriptionMode ¶
type TranscriptionMode string
TranscriptionMode represents the mode of transcription (local or API)
const ( // LocalMode uses the local Whisper model LocalMode TranscriptionMode = "local" // APIMode uses the OpenAI Whisper API APIMode TranscriptionMode = "api" )
type WhisperResponse ¶
type WhisperResponse struct {
Text string `json:"text"`
}
WhisperResponse is the response from the OpenAI Whisper API