Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultOpenAITranscriptionModel is the built-in OpenAI transcription model. DefaultOpenAITranscriptionModel = "gpt-4o-transcribe" // DefaultGeminiTranscriptionModel is the built-in Gemini transcription model. DefaultGeminiTranscriptionModel = "gemini-2.5-flash" )
Variables ¶
View Source
var ( // ErrProviderNotFound indicates that a requested provider ID does not exist. ErrProviderNotFound = errors.New("AI provider not found") // ErrCapabilityUnsupported indicates that the provider does not support the requested capability. ErrCapabilityUnsupported = errors.New("AI provider capability unsupported") )
Functions ¶
func DefaultTranscriptionModel ¶
func DefaultTranscriptionModel(providerType ProviderType) (string, error)
DefaultTranscriptionModel returns the built-in transcription model for a provider.
Types ¶
type ProviderConfig ¶
type ProviderConfig struct {
ID string
Title string
Type ProviderType
Endpoint string
APIKey string
}
ProviderConfig configures a callable AI provider connection.
func FindProvider ¶
func FindProvider(providers []ProviderConfig, providerID string) (*ProviderConfig, error)
FindProvider returns the provider with the given ID.
type ProviderType ¶
type ProviderType string
ProviderType identifies an AI provider implementation.
const ( // ProviderOpenAI is OpenAI's hosted API. ProviderOpenAI ProviderType = "OPENAI" // ProviderGemini is Google's Gemini API. ProviderGemini ProviderType = "GEMINI" )
type TranscribeRequest ¶
type TranscribeRequest struct {
Model string
Filename string
ContentType string
Audio io.Reader
Size int64
Prompt string
Language string
}
TranscribeRequest contains an audio transcription request.
type TranscribeResponse ¶
TranscribeResponse contains an audio transcription response.
type Transcriber ¶
type Transcriber interface {
Transcribe(ctx context.Context, request TranscribeRequest) (*TranscribeResponse, error)
}
Transcriber transcribes audio into text.
func NewTranscriber ¶
func NewTranscriber(config ProviderConfig, options ...TranscriberOption) (Transcriber, error)
NewTranscriber creates a transcriber for a provider.
type TranscriberOption ¶
type TranscriberOption func(*transcriberOptions)
TranscriberOption configures a transcriber.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) TranscriberOption
WithHTTPClient sets the HTTP client used by a transcriber.
Click to show internal directories.
Click to hide internal directories.