Documentation
¶
Overview ¶
Index ¶
Constants ¶
View Source
const ( Endpoint = "https://api.elevenlabs.io/v1" TranscribePath = "speech-to-text" // Endpoint for transcription TranscriptPath = "speech-to-text/transcripts" // Base path for transcript get/delete )
Variables ¶
View Source
var (
Models = []string{"scribe_v2", "scribe_v1", "scribe_v1_experimental"}
)
Functions ¶
func LanguageCode ¶
LanguageCode returns the language and three-letter ElevenLabs language code for a given tuple, or an empty string if the language is not recognized.
Types ¶
type Client ¶
func (*Client) DeleteTranscript ¶
DeleteTranscript deletes a previously created transcript by ID.
func (*Client) GetTranscript ¶
func (c *Client) GetTranscript(ctx context.Context, transcriptionID string) (*TranscribeResponse, error)
GetTranscript retrieves a previously created transcript by ID.
func (*Client) Transcribe ¶
func (c *Client) Transcribe(ctx context.Context, req TranscribeRequest) (*TranscribeResponse, error)
type TranscribeChar ¶
type TranscribeRequest ¶
type TranscribeRequest struct {
Model string `json:"model_id"` // scribe_v1, scribe_v1_experimental
File multipart.File `json:"file"`
Language *string `json:"language_code,omitempty"`
TagAudioEvents *bool `json:"tag_audio_events,omitempty"`
NumSpeakers *uint64 `json:"num_speakers,omitempty"`
Timestamps *string `json:"timestamps_granularity,omitempty"` // none, word, character
Diarize *bool `json:"diarize,omitempty"`
DiarizationThr *float64 `json:"diarization_threshold,omitempty"`
FileFormat *string `json:"file_format,omitempty"` // pcm_s16le_16, other
CloudURL *string `json:"cloud_storage_url,omitempty"`
EnableLogging *bool `json:"enable_logging,omitempty"`
Webhook *bool `json:"webhook,omitempty"`
WebhookID *string `json:"webhook_id,omitempty"`
WebhookMeta json.RawMessage `json:"webhook_metadata,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
Seed *int64 `json:"seed,omitempty"`
UseMultiChan *bool `json:"use_multi_channel,omitempty"`
EntityDetect any `json:"entity_detection,omitempty"`
Keyterms []string `json:"keyterms,omitempty"`
AdditionalFmt []map[string]any `json:"additional_formats,omitempty"`
}
type TranscribeResponse ¶
type TranscribeResponse struct {
Language string `json:"language_code"`
Probability float64 `json:"language_probability"`
Text string `json:"text"`
Words []TranscribeWord `json:"words,omitempty"` // Only present if timestamps_granularity is set to word or character
}
func (*TranscribeResponse) Segments ¶
func (r *TranscribeResponse) Segments() *schema.Transcription
Return segments of a transcription response
func (TranscribeResponse) String ¶
func (s TranscribeResponse) String() string
type TranscribeWord ¶
type TranscribeWord struct {
Text string `json:"text"`
Type string `json:"type"` // word, spacing, audio_event
Logprob float64 `json:"logprob,omitempty"` // -inf -> 0.0
Start float64 `json:"start"`
End float64 `json:"end"`
Speaker *string `json:"speaker_id,omitempty"`
Chars []TranscribeChar `json:"characters,omitempty"` // Only present if timestamps_granularity is set to character
}
func (TranscribeWord) String ¶
func (s TranscribeWord) String() string
Click to show internal directories.
Click to hide internal directories.