revai

package module
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package revai wraps Rev AI's speech-to-text API.

NewTranscriptionModel orchestrates Rev AI's async /v1/jobs flow (submit → poll → fetch). Rev AI's strength is enterprise- grade accuracy on English / multilingual content plus rich metadata (speaker channels, custom vocabularies, profanity filter, language ID).

Set language through transcription.Options.Language and select machine or human transcription through transcription.Options.Model. Provider extras such as speaker_channels_count, custom_vocabulary_id, and remove_disfluencies belong in Options.Extensions under RequestExtensionKey.

See https://docs.rev.ai/ for the full reference.

Index

Examples

Constants

View Source
const (
	RequestExtensionKey  = Provider + "/request"
	ResponseExtensionKey = Provider + "/response"
	DefaultBaseURL       = "https://api.rev.ai/speechtotext/v1"
	DefaultPollInterval  = 3 * time.Second
	DefaultPollTimeout   = 30 * time.Minute
)
View Source
const (
	ModelMachine = "machine"
	ModelHuman   = "human"
)
View Source
const (
	Provider = "revai"
)

Provider is the stable backend name for host-side attribution.

Variables

This section is empty.

Functions

This section is empty.

Types

type TranscriptionModel added in v0.41.0

type TranscriptionModel struct {
	// contains filtered or unexported fields
}

TranscriptionModel wraps Rev AI's async transcription flow. Rev is async-only: Call submits the audio, polls /jobs/{id} until "transcribed", then fetches the plain-text transcript.

Language and transcriber selection use transcription.Options.Language and transcription.Options.Model (ModelMachine or ModelHuman). Diarization, custom vocabularies, and profanity filtering use Options.Extensions under RequestExtensionKey. Audio.Source alone chooses the media location. URI sources use source_config.url; the native source_config extension may supply auth_headers only, for URI audio.

func NewTranscriptionModel added in v0.41.0

func NewTranscriptionModel(ctx context.Context, config TranscriptionModelConfig) (*TranscriptionModel, error)

func (*TranscriptionModel) Call added in v0.41.0

type TranscriptionModelConfig added in v0.41.0

type TranscriptionModelConfig struct {
	APIKey         string
	DefaultOptions transcription.Options
	BaseURL        string
	HTTPClient     *http.Client
	PollInterval   time.Duration
	PollTimeout    time.Duration
}
Example
package main

import (
	"context"
	"fmt"

	"github.com/Tangerg/scope/core/transcription"
	"github.com/Tangerg/scope/models/revai"
)

func main() {
	options := transcription.Options{Model: revai.ModelMachine, Language: "en"}
	_, err := revai.NewTranscriptionModel(context.Background(), revai.TranscriptionModelConfig{
		APIKey: "example-key", DefaultOptions: options,
	})
	fmt.Println(options.Model, options.Language, err)
}
Output:
machine en <nil>

func (TranscriptionModelConfig) Validate added in v0.41.0

func (t TranscriptionModelConfig) Validate() error

Jump to

Keyboard shortcuts

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