Documentation
¶
Index ¶
- Constants
- Variables
- func ASRFilterSenderName(senderName, direction string, h media.MediaHandler) string
- func AudioIntercept() media.MediaHandlerFunc
- func ConvertToWAV(audioPath string, sampleRate int) ([]byte, error)
- func GenerateCorpusContext(hotwords []HotWord) string
- func GzipCompress(input []byte) []byte
- func GzipDecompress(input []byte) []byte
- func IsWAVFile(data []byte) bool
- func NewAudioOnlyRequest(seq int, segment []byte) []byte
- func NewAuthHeader(auth AuthConfig) http.Header
- func NewFullClientRequest(config *Config) []byte
- func ReadWAVInfo(data []byte) (int, int, int, int, []byte, error)
- func WithAwsASR(opt AwsASROption) media.MediaHandlerFunc
- func WithBaiduASR(opt BaiduASROption) media.MediaHandlerFunc
- func WithDeepgramASR(opt DeepgramASROption) media.MediaHandlerFunc
- func WithQCloudASR(opt QCloudASROption) media.MediaHandlerFunc
- func WithTranscribeFilter(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
- func WithTranscribeFilterState(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
- func WithTranscribeFilterStateV2(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
- func WithVoiceapiASR(opt VoiceapiASROption) media.MediaHandlerFunc
- func WithVolcengineASR(opt VolcengineOption) media.MediaHandlerFunc
- func WithWhisperASR(opt WhisperASROption) media.MediaHandlerFunc
- type AsrCorrector
- type AsrCorrectorOption
- type AudioConfig
- type AudioFrame
- type AudioMeta
- type AuthConfig
- type AwsASR
- type AwsASROption
- type BaiduASR
- type BaiduASRBeginParam
- type BaiduASROption
- type BaiduASRWSResponse
- type BufferConfig
- type Client
- func (c *Client) Close()
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) GetTraceID() string
- func (c *Client) IsClosed() bool
- func (c *Client) ReceiveResult() (*Response, error)
- func (c *Client) SendAudioFrame(frame *AudioFrame) error
- func (c *Client) SetErrorCallback(callback func(error))
- func (c *Client) SetTimeouts(writeTimeout, readTimeout time.Duration)
- type CompressionType
- type Config
- func (c *Config) CalculateBufferSize() int
- func (c *Config) WithAudio(audio AudioConfig) *Config
- func (c *Config) WithAuth(auth AuthConfig) *Config
- func (c *Config) WithBuffer(buffer BufferConfig) *Config
- func (c *Config) WithRequest(request RequestConfig) *Config
- func (c *Config) WithURL(url string) *Config
- func (c *Config) WithUser(user UserConfig) *Config
- type ConfigReader
- type CorpusConfig
- type CorpusMeta
- type Data
- type DeepgramASR
- func (dg *DeepgramASR) Close(cr *interfacesv1.CloseResponse) error
- func (dg *DeepgramASR) Error(er *interfacesv1.ErrorResponse) error
- func (dg *DeepgramASR) Message(mr *interfacesv1.MessageResponse) error
- func (dg *DeepgramASR) Metadata(md *interfacesv1.MetadataResponse) error
- func (dg *DeepgramASR) Open(or *interfacesv1.OpenResponse) error
- func (dg *DeepgramASR) SpeechStarted(ssr *interfacesv1.SpeechStartedResponse) error
- func (dg *DeepgramASR) UnhandledEvent(byData []byte) error
- func (dg *DeepgramASR) UtteranceEnd(ur *interfacesv1.UtteranceEndResponse) error
- type DeepgramASROption
- type DefaultTranscriberFactory
- func (f *DefaultTranscriberFactory) CreateTranscriber(config TranscriberConfig) (TranscribeService, error)
- func (f *DefaultTranscriberFactory) GetSupportedVendors() []Vendor
- func (f *DefaultTranscriberFactory) IsVendorSupported(vendor Vendor) bool
- func (f *DefaultTranscriberFactory) RegisterCreator(vendor Vendor, creator func(TranscriberConfig) (TranscribeService, error))
- type Event
- type FunASRCallback
- func (fun *FunASRCallback) Activity() bool
- func (fun *FunASRCallback) ConnAndReceive(dialogID string) error
- func (fun *FunASRCallback) Init(tr TranscribeResult, er ProcessError)
- func (fun *FunASRCallback) RestartClient()
- func (fun *FunASRCallback) SendAudioBytes(data []byte) error
- func (fun *FunASRCallback) SendEnd() error
- func (fun *FunASRCallback) StopConn() error
- func (fun *FunASRCallback) Vendor() string
- type FunASRClient
- type FunASRMessage
- type FunASROption
- type FunASRRequestOption
- type FunAsrRealtime
- func (fun *FunAsrRealtime) Activity() bool
- func (fun *FunAsrRealtime) ConnAndReceive(dialogID string) error
- func (fun *FunAsrRealtime) Init(tr TranscribeResult, er ProcessError)
- func (fun *FunAsrRealtime) RestartClient()
- func (fun *FunAsrRealtime) SendAudioBytes(data []byte) error
- func (fun *FunAsrRealtime) SendEnd() error
- func (fun *FunAsrRealtime) StopConn() error
- func (fun *FunAsrRealtime) Vendor() string
- type FunAsrRealtimeClient
- type FunAsrRealtimeOption
- type FunHeader
- type FunPayload
- type GladiaASR
- func (gla *GladiaASR) Activity() bool
- func (gla *GladiaASR) ConnAndReceive(dialogID string) error
- func (gla *GladiaASR) Init(tr TranscribeResult, er ProcessError)
- func (gla *GladiaASR) RestartClient()
- func (gla *GladiaASR) SendAudioBytes(data []byte) error
- func (gla *GladiaASR) SendEnd() error
- func (gla *GladiaASR) StopConn() error
- func (gla *GladiaASR) Vendor() string
- type GladiaASROption
- type GladiaUtterance
- type GoogleASR
- func (google *GoogleASR) Activity() bool
- func (google *GoogleASR) ConnAndReceive(dialogID string) error
- func (google *GoogleASR) Init(tr TranscribeResult, er ProcessError)
- func (google *GoogleASR) RestartClient()
- func (google *GoogleASR) SendAudioBytes(data []byte) error
- func (google *GoogleASR) SendEnd() error
- func (google *GoogleASR) StopConn() error
- func (google *GoogleASR) Vendor() string
- type GoogleASROption
- type HotWord
- type Input
- type LocalASRConfig
- type LocalASRProvider
- type LocalASRService
- func (s *LocalASRService) Activity() bool
- func (s *LocalASRService) Close() error
- func (s *LocalASRService) ConnAndReceive(dialogId string) error
- func (s *LocalASRService) Init(tr TranscribeResult, er ProcessError)
- func (s *LocalASRService) RestartClient()
- func (s *LocalASRService) SendAudioBytes(data []byte) error
- func (s *LocalASRService) SendEnd() error
- func (s *LocalASRService) StopConn() error
- func (s *LocalASRService) Vendor() string
- type MessageType
- type MessageTypeSpecificFlags
- type Output
- type Params
- type ProcessError
- type ProtocolVersion
- type QCloudASR
- func (asq *QCloudASR) Activity() bool
- func (asq *QCloudASR) ConnAndReceive(dialogID string) error
- func (asq *QCloudASR) Init(tr TranscribeResult, er ProcessError)
- func (asq *QCloudASR) OnFail(response *asr.SpeechRecognitionResponse, err error)
- func (asq *QCloudASR) OnRecognitionComplete(response *asr.SpeechRecognitionResponse)
- func (asq *QCloudASR) OnRecognitionResultChange(response *asr.SpeechRecognitionResponse)
- func (asq *QCloudASR) OnRecognitionStart(response *asr.SpeechRecognitionResponse)
- func (asq *QCloudASR) OnSentenceBegin(response *asr.SpeechRecognitionResponse)
- func (asq *QCloudASR) OnSentenceEnd(response *asr.SpeechRecognitionResponse)
- func (asq *QCloudASR) RestartClient()
- func (asq *QCloudASR) SendAudioBytes(data []byte) error
- func (asq *QCloudASR) SendEnd() error
- func (asq *QCloudASR) StopConn() error
- func (asq *QCloudASR) Vendor() string
- type QCloudASROption
- type Recognizer
- type RequestConfig
- type RequestHeader
- func (h *RequestHeader) WithCompressionType(compressionType CompressionType) *RequestHeader
- func (h *RequestHeader) WithMessageType(messageType MessageType) *RequestHeader
- func (h *RequestHeader) WithMessageTypeSpecificFlags(messageTypeSpecificFlags MessageTypeSpecificFlags) *RequestHeader
- func (h *RequestHeader) WithReservedData(reservedData []byte) *RequestHeader
- func (h *RequestHeader) WithSerializationType(serializationType SerializationType) *RequestHeader
- type RequestMeta
- type RequestPayload
- type Response
- type ResponsePayload
- type Result
- type ResultCallback
- type RingBuffer
- type SerializationType
- type TranscribeOneShot
- type TranscribeOption
- type TranscribeResult
- type TranscribeService
- type TranscriberConfig
- type TranscriberFactory
- type Transcript
- type UserConfig
- type UserMeta
- type Utterance
- type Vendor
- type VoiceapiASR
- type VoiceapiASROption
- type VoiceapiResponse
- type VolcEngineResponse
- type Volcengine
- type VolcengineClient
- type VolcengineLLMASR
- func (v *VolcengineLLMASR) Activity() bool
- func (v *VolcengineLLMASR) ConnAndReceive(dialogID string) error
- func (v *VolcengineLLMASR) Init(tr TranscribeResult, er ProcessError)
- func (v *VolcengineLLMASR) RestartClient()
- func (v *VolcengineLLMASR) SendAudioBytes(data []byte) error
- func (v *VolcengineLLMASR) SendEnd() error
- func (v *VolcengineLLMASR) StopConn() error
- func (v *VolcengineLLMASR) Vendor() string
- type VolcengineLLMOption
- type VolcengineOption
- type VolcengineResult
- type WAVHeader
- type WhisperASR
- type WhisperASROption
- type WhisperResult
- type Word
Constants ¶
const ( ProtocolVersionV1 = ProtocolVersion(0b0001) // Message Type MessageTypeClientFullRequest = MessageType(0b0001) MessageTypeClientAudioOnlyRequest = MessageType(0b0010) MessageTypeServerFullResponse = MessageType(0b1001) MessageTypeServerErrorResponse = MessageType(0b1111) // Message Type Specific Flags FlagNoSequence = MessageTypeSpecificFlags(0b0000) // no check sequence FlagPosSequence = MessageTypeSpecificFlags(0b0001) FlagNegSequence = MessageTypeSpecificFlags(0b0010) FlagNegWithSequence = MessageTypeSpecificFlags(0b0011) // Message Serialization SerializationNone = SerializationType(0b0000) SerializationJSON = SerializationType(0b0001) // Message Compression CompressionGZIP = CompressionType(0b0001) )
const ( SuccessCode = 1000 ServerFullResponse = MessageType(0b1001) ServerAck = MessageType(0b1011) ServerErrorResponse = MessageType(0b1111) )
const DefaultSampleRate = 16000
Variables ¶
var DefaultAudioOnlyWsHeader = []byte{0x11, 0x20, 0x11, 0x00}
var DefaultFullClientWsHeader = []byte{0x11, 0x10, 0x11, 0x00}
var DefaultLastAudioWsHeader = []byte{0x11, 0x22, 0x11, 0x00}
var ErrClientClosed = errors.New("asr client closed")
var FussyMap = map[string]string{
"s": "sh", "sh": "s",
"c": "ch", "ch": "c",
"z": "zh", "zh": "z",
"l": "n", "n": "l",
"f": "h", "h": "f",
"r": "l",
"an": "ang", "ang": "an",
"en": "eng", "eng": "en",
"in": "ing", "ing": "in",
"ian": "iang", "iang": "ian",
"uan": "uang", "uang": "uan",
}
Functions ¶
func ASRFilterSenderName ¶
func ASRFilterSenderName(senderName, direction string, h media.MediaHandler) string
func AudioIntercept ¶
func AudioIntercept() media.MediaHandlerFunc
func ConvertToWAV ¶
ConvertToWAV converts an audio file to WAV format with the specified sample rate
func GenerateCorpusContext ¶
func GzipCompress ¶
GzipCompress compresses input data using gzip
func GzipDecompress ¶
GzipDecompress decompresses input data using gzip
func NewAudioOnlyRequest ¶
func NewAuthHeader ¶
func NewAuthHeader(auth AuthConfig) http.Header
func NewFullClientRequest ¶
NewFullClientRequest creates a full client request payload
func ReadWAVInfo ¶
ReadWAVInfo reads WAV file info and returns channels, sample width, sample rate, packet count, data, and error
func WithAwsASR ¶
func WithAwsASR(opt AwsASROption) media.MediaHandlerFunc
func WithBaiduASR ¶
func WithBaiduASR(opt BaiduASROption) media.MediaHandlerFunc
func WithDeepgramASR ¶
func WithDeepgramASR(opt DeepgramASROption) media.MediaHandlerFunc
func WithQCloudASR ¶
func WithQCloudASR(opt QCloudASROption) media.MediaHandlerFunc
func WithTranscribeFilter ¶
func WithTranscribeFilter(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
func WithTranscribeFilterState ¶
func WithTranscribeFilterState(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
func WithTranscribeFilterStateV2 ¶
func WithTranscribeFilterStateV2(asr TranscribeService, h media.MediaHandler, opt TranscribeOption) media.PacketFilter
func WithVoiceapiASR ¶
func WithVoiceapiASR(opt VoiceapiASROption) media.MediaHandlerFunc
func WithVolcengineASR ¶
func WithVolcengineASR(opt VolcengineOption) media.MediaHandlerFunc
func WithWhisperASR ¶
func WithWhisperASR(opt WhisperASROption) media.MediaHandlerFunc
Types ¶
type AsrCorrector ¶
type AsrCorrector struct {
ReplaceWords map[string]string
FuzzyWords map[string]string
// contains filtered or unexported fields
}
func NewAsrCorrector ¶
func NewAsrCorrector(opt AsrCorrectorOption) *AsrCorrector
func (*AsrCorrector) Correct ¶
func (ac *AsrCorrector) Correct(text string) string
func (*AsrCorrector) SegmentWords ¶
func (ac *AsrCorrector) SegmentWords(s string) []string
type AsrCorrectorOption ¶
type AudioConfig ¶
type AudioConfig struct {
Format string `json:"format" yaml:"format" default:"pcm"`
Codec string `json:"codec" yaml:"codec" default:"raw"`
Rate int `json:"rate" yaml:"rate" default:"16000"`
Bits int `json:"bits" yaml:"bits" default:"16"`
Channel int `json:"channel" yaml:"channel" default:"1"`
}
AudioConfig represents audio format configuration
type AudioFrame ¶
type AuthConfig ¶
type AuthConfig struct {
ResourceId string `json:"resource_id" yaml:"resource_id"`
AccessKey string `json:"access_key" yaml:"access_key"`
AppKey string `json:"app_key" yaml:"app_key"`
}
AuthConfig represents authentication configuration
type AwsASROption ¶
type AwsASROption struct {
AppID string `json:"appId" yaml:"app_id"`
Region string `json:"region" yaml:"region"`
Encoding types.MediaEncoding `json:"encoding" yaml:"encoding"`
SampleRate int32 `json:"sampleRate" yaml:"sample_rate"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewAwsASROption ¶
func NewAwsASROption(appId, region string, language string) AwsASROption
func (*AwsASROption) GetVendor ¶
func (opt *AwsASROption) GetVendor() Vendor
type BaiduASRBeginParam ¶
func NewBeginParam ¶
func NewBeginParam(opt BaiduASROption) BaiduASRBeginParam
type BaiduASROption ¶
type BaiduASROption struct {
Url string `json:"url" yaml:"url" default:"wss://vop.baidu.com/realtime_asr"`
AppID int `json:"appId" yaml:"app_id"`
AppKey string `json:"appKey" yaml:"app_key"`
DevPid int `json:"devPid" yaml:"dev_pid"`
LmId int `json:"lmId" yaml:"lm_id"`
CuId string `json:"cuId" yaml:"cu_id"`
Format string `json:"format" yaml:"format"`
Sample int `json:"sample" yaml:"sample"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewBaiduASROption ¶
func (*BaiduASROption) GetVendor ¶
func (opt *BaiduASROption) GetVendor() Vendor
type BaiduASRWSResponse ¶
type BufferConfig ¶
type BufferConfig struct {
SegmentDurationMs int `json:"segment_duration_ms" yaml:"segment_duration_ms" default:"200"`
MaxBufferSize int `json:"max_buffer_size" yaml:"max_buffer_size"`
}
BufferConfig represents buffer configuration
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetTraceID ¶
GetTraceID returns the trace ID from the connection
func (*Client) ReceiveResult ¶
func (*Client) SendAudioFrame ¶
func (c *Client) SendAudioFrame(frame *AudioFrame) error
func (*Client) SetErrorCallback ¶
SetErrorCallback sets the error callback function
func (*Client) SetTimeouts ¶
SetTimeouts sets the timeouts for write and read operations
type CompressionType ¶
type CompressionType byte
type Config ¶
type Config struct {
// Connection settings
URL string `json:"url" yaml:"url"`
// Auth settings
Auth AuthConfig `json:"auth" yaml:"auth"`
// User metadata
User UserConfig `json:"user" yaml:"user"`
// Audio format settings
Audio AudioConfig `json:"audio" yaml:"audio"`
// Request settings
Request RequestConfig `json:"request" yaml:"request"`
// Buffer settings
Buffer BufferConfig `json:"buffer" yaml:"buffer"`
}
Config represents the configuration for SAUC ASR client
func (*Config) CalculateBufferSize ¶
CalculateBufferSize calculates the buffer size based on audio format and segment duration
func (*Config) WithAudio ¶
func (c *Config) WithAudio(audio AudioConfig) *Config
WithAudio sets the audio configuration
func (*Config) WithAuth ¶
func (c *Config) WithAuth(auth AuthConfig) *Config
WithAuth sets the auth configuration
func (*Config) WithBuffer ¶
func (c *Config) WithBuffer(buffer BufferConfig) *Config
WithBuffer sets the buffer configuration
func (*Config) WithRequest ¶
func (c *Config) WithRequest(request RequestConfig) *Config
WithRequest sets the request configuration
func (*Config) WithUser ¶
func (c *Config) WithUser(user UserConfig) *Config
WithUser sets the user configuration
type ConfigReader ¶
type ConfigReader struct {
// contains filtered or unexported fields
}
ConfigReader 配置读取器 - 简化配置读取逻辑
func NewConfigReader ¶
func NewConfigReader(config map[string]interface{}) *ConfigReader
NewConfigReader 创建配置读取器
func (*ConfigReader) Int ¶
func (r *ConfigReader) Int(keys ...interface{}) int
Int 获取整数值,支持多个键名和默认值 用法: Int("key1", "key2", 100)
func (*ConfigReader) String ¶
func (r *ConfigReader) String(keysAndDefault ...string) string
String 获取字符串值,支持多个键名和默认值 用法: String("key1", "key2", "default_value")
type CorpusConfig ¶
type CorpusConfig struct {
BoostingTableName string `json:"boosting_table_name" yaml:"boosting_table_name"`
CorrectTableName string `json:"correct_table_name" yaml:"correct_table_name"`
Context string `json:"context" yaml:"context"`
}
CorpusConfig represents corpus configuration
type CorpusMeta ¶
type DeepgramASR ¶
type DeepgramASR struct {
Sentence string
EndTime uint32
// contains filtered or unexported fields
}
func (*DeepgramASR) Close ¶
func (dg *DeepgramASR) Close(cr *interfacesv1.CloseResponse) error
func (*DeepgramASR) Error ¶
func (dg *DeepgramASR) Error(er *interfacesv1.ErrorResponse) error
func (*DeepgramASR) Message ¶
func (dg *DeepgramASR) Message(mr *interfacesv1.MessageResponse) error
func (*DeepgramASR) Metadata ¶
func (dg *DeepgramASR) Metadata(md *interfacesv1.MetadataResponse) error
func (*DeepgramASR) Open ¶
func (dg *DeepgramASR) Open(or *interfacesv1.OpenResponse) error
func (*DeepgramASR) SpeechStarted ¶
func (dg *DeepgramASR) SpeechStarted(ssr *interfacesv1.SpeechStartedResponse) error
func (*DeepgramASR) UnhandledEvent ¶
func (dg *DeepgramASR) UnhandledEvent(byData []byte) error
func (*DeepgramASR) UtteranceEnd ¶
func (dg *DeepgramASR) UtteranceEnd(ur *interfacesv1.UtteranceEndResponse) error
type DeepgramASROption ¶
type DeepgramASROption struct {
ApiKey string `json:"apiKey" yaml:"api_key" env:"DEEPGRAM_API_KEY"`
Model string `json:"model" yaml:"model" default:"nova-2"`
Language string `json:"language" yaml:"language" default:"en-US"`
SampleRate int `json:"sampleRate" yaml:"sample_rate" default:"16000"`
Channels int `json:"channels" yaml:"channels" default:"1"`
Encoding string `json:"encoding" yaml:"encoding" default:"linear16"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
KeepAliveDuration string `json:"keepAlineDuration" yaml:"keep_aline_duration" default:"3s"`
}
func NewDeepgramASROption ¶
func NewDeepgramASROption(apiKey string, model string, language string) DeepgramASROption
func (*DeepgramASROption) GetVendor ¶
func (opt *DeepgramASROption) GetVendor() Vendor
type DefaultTranscriberFactory ¶
type DefaultTranscriberFactory struct {
// contains filtered or unexported fields
}
DefaultTranscriberFactory 默认工厂实现
func GetGlobalFactory ¶
func GetGlobalFactory() *DefaultTranscriberFactory
GetGlobalFactory 获取全局工厂实例(单例模式)
func NewTranscriberFactory ¶
func NewTranscriberFactory() *DefaultTranscriberFactory
NewTranscriberFactory 创建新的工厂实例
func (*DefaultTranscriberFactory) CreateTranscriber ¶
func (f *DefaultTranscriberFactory) CreateTranscriber(config TranscriberConfig) (TranscribeService, error)
CreateTranscriber 创建 TranscribeService
func (*DefaultTranscriberFactory) GetSupportedVendors ¶
func (f *DefaultTranscriberFactory) GetSupportedVendors() []Vendor
GetSupportedVendors 获取支持的供应商列表
func (*DefaultTranscriberFactory) IsVendorSupported ¶
func (f *DefaultTranscriberFactory) IsVendorSupported(vendor Vendor) bool
IsVendorSupported 检查供应商是否支持
func (*DefaultTranscriberFactory) RegisterCreator ¶
func (f *DefaultTranscriberFactory) RegisterCreator(vendor Vendor, creator func(TranscriberConfig) (TranscribeService, error))
RegisterCreator 注册创建函数
type Event ¶
type Event struct {
Header FunHeader `json:"header"`
Payload FunPayload `json:"payload"`
}
type FunASRCallback ¶
type FunASRCallback struct {
// contains filtered or unexported fields
}
func NewFunASR ¶
func NewFunASR(opt FunASROption) FunASRCallback
func (*FunASRCallback) Activity ¶
func (fun *FunASRCallback) Activity() bool
func (*FunASRCallback) ConnAndReceive ¶
func (fun *FunASRCallback) ConnAndReceive(dialogID string) error
func (*FunASRCallback) Init ¶
func (fun *FunASRCallback) Init(tr TranscribeResult, er ProcessError)
func (*FunASRCallback) RestartClient ¶
func (fun *FunASRCallback) RestartClient()
func (*FunASRCallback) SendAudioBytes ¶
func (fun *FunASRCallback) SendAudioBytes(data []byte) error
func (*FunASRCallback) SendEnd ¶
func (fun *FunASRCallback) SendEnd() error
func (*FunASRCallback) StopConn ¶
func (fun *FunASRCallback) StopConn() error
func (*FunASRCallback) Vendor ¶
func (fun *FunASRCallback) Vendor() string
type FunASRClient ¶
type FunASRClient struct {
// contains filtered or unexported fields
}
type FunASRMessage ¶
type FunASROption ¶
type FunASROption struct {
Url string `json:"url" yaml:"url" env:"FUNASR_URL"`
Mode string `json:"mode" yaml:"mode"`
ChunkSize []int `json:"chunkSize" yaml:"chunk_size"`
ChunkInterval int `json:"chunkInterval" yaml:"chunk_interval"`
EncoderChunkLookBack int `json:"encoderChunkLookBack" yaml:"encoder_chunk_look_back"`
DecoderChunkLookBack int `json:"decoderChunkLookBack" yaml:"decoder_chunk_look_back"`
AudioFs int `json:"audioFs" yaml:"audio_fs"`
WavName string `json:"wavName" yaml:"wav_name"`
WavFormat string `json:"wavFormat" yaml:"wav_format"`
IsSpeaking bool `json:"isSpeaking" yaml:"is_speaking"`
Hotwords string `json:"hotwords" yaml:"hotwords"`
Itn bool `json:"itn" yaml:"itn"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewFunASROption ¶
func NewFunASROption(url string) FunASROption
func (*FunASROption) GetVendor ¶
func (opt *FunASROption) GetVendor() Vendor
type FunASRRequestOption ¶
type FunASRRequestOption struct {
Mode string `json:"mode"`
ChunkSize []int `json:"chunk_size"`
ChunkInterval int `json:"chunk_interval"`
EncoderChunkLookBack int `json:"encoder_chunk_look_back"`
DecoderChunkLookBack int `json:"decoder_chunk_look_back"`
AudioFs int `json:"audio_fs"`
WavName string `json:"wav_name"`
WavFormat string `json:"wav_format"`
IsSpeaking bool `json:"is_speaking"`
Hotwords string `json:"hotwords"`
Itn bool `json:"itn"`
}
func NewFunASRRequestOption ¶
func NewFunASRRequestOption(opt FunASROption) FunASRRequestOption
type FunAsrRealtime ¶
type FunAsrRealtime struct {
Handler media.MediaHandler
// contains filtered or unexported fields
}
func NewFunAsrRealtime ¶
func NewFunAsrRealtime(opt FunAsrRealtimeOption) FunAsrRealtime
func (*FunAsrRealtime) Activity ¶
func (fun *FunAsrRealtime) Activity() bool
func (*FunAsrRealtime) ConnAndReceive ¶
func (fun *FunAsrRealtime) ConnAndReceive(dialogID string) error
func (*FunAsrRealtime) Init ¶
func (fun *FunAsrRealtime) Init(tr TranscribeResult, er ProcessError)
func (*FunAsrRealtime) RestartClient ¶
func (fun *FunAsrRealtime) RestartClient()
func (*FunAsrRealtime) SendAudioBytes ¶
func (fun *FunAsrRealtime) SendAudioBytes(data []byte) error
func (*FunAsrRealtime) SendEnd ¶
func (fun *FunAsrRealtime) SendEnd() error
func (*FunAsrRealtime) StopConn ¶
func (fun *FunAsrRealtime) StopConn() error
func (*FunAsrRealtime) Vendor ¶
func (fun *FunAsrRealtime) Vendor() string
type FunAsrRealtimeClient ¶
type FunAsrRealtimeClient struct {
// contains filtered or unexported fields
}
type FunAsrRealtimeOption ¶
type FunAsrRealtimeOption struct {
Url string `json:"url" yaml:"url" env:"FUNASR_URL" default:"wss://dashscope.aliyuncs.com/api-ws/v1/inference"`
ApiKey string `json:"apiKey" yaml:"api_key" env:"DASHSCOPE_API_KEY"`
Model string `json:"model" yaml:"model" default:"fun-asr-realtime"`
SampleRate int `json:"sampleRate" yaml:"sample_rate" default:"16000"`
Format string `json:"format" yaml:"format" default:"pcm"`
LanguageHints string `json:"languageHints" yaml:"language_hints" default:"zh"`
EnableWords bool `json:"enableWords" yaml:"enable_words" default:"false"`
EnableITN bool `json:"enableITN" yaml:"enable_itn" default:"false"`
MaxSentenceSilence uint `json:"maxSentenceSilence" yaml:"max_sentence_silence" default:"1300"` // ms
Heartbeat bool `json:"heartbeat" yaml:"heartbeat" default:"false"`
DisfluencyRemovalEnabled bool `json:"disfluencyRemovalEnabled" yaml:"disfluency_removal_enabled" default:"false"`
}
func (*FunAsrRealtimeOption) GetVendor ¶
func (opt *FunAsrRealtimeOption) GetVendor() Vendor
type FunHeader ¶
type FunHeader struct {
Action string `json:"action"`
TaskID string `json:"task_id"`
Streaming string `json:"streaming"`
Event string `json:"event"`
ErrorCode string `json:"error_code,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Attributes map[string]interface{} `json:"attributes"`
}
type FunPayload ¶
type FunPayload struct {
TaskGroup string `json:"task_group"`
Task string `json:"task"`
Function string `json:"function"`
Model string `json:"model"`
Parameters Params `json:"parameters"`
Input Input `json:"input"`
Output Output `json:"output,omitempty"`
Usage *struct {
Duration int `json:"duration"`
} `json:"usage,omitempty"`
}
type GladiaASR ¶
type GladiaASR struct {
Sentence string
// contains filtered or unexported fields
}
func NewGladiaASR ¶
func NewGladiaASR(opt GladiaASROption) GladiaASR
func (*GladiaASR) ConnAndReceive ¶
func (*GladiaASR) Init ¶
func (gla *GladiaASR) Init(tr TranscribeResult, er ProcessError)
func (*GladiaASR) RestartClient ¶
func (gla *GladiaASR) RestartClient()
func (*GladiaASR) SendAudioBytes ¶
type GladiaASROption ¶
type GladiaASROption struct {
Url string `json:"url" yaml:"url" default:"wss://api.gladia.io/audio/text/audio-transcription"`
ApiKey string `json:"apiKey" yaml:"api_key"`
Encoding string `json:"encoding" yaml:"encoding" default:"WAV/PCM"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewGladiaASROption ¶
func NewGladiaASROption(apiKey string, encoding string) GladiaASROption
func (*GladiaASROption) GetVendor ¶
func (opt *GladiaASROption) GetVendor() Vendor
type GladiaUtterance ¶
type GoogleASR ¶
type GoogleASR struct {
Sentence string
// contains filtered or unexported fields
}
func NewGoogleASR ¶
func NewGoogleASR(opt GoogleASROption) GoogleASR
func (*GoogleASR) ConnAndReceive ¶
func (*GoogleASR) Init ¶
func (google *GoogleASR) Init(tr TranscribeResult, er ProcessError)
func (*GoogleASR) RestartClient ¶
func (google *GoogleASR) RestartClient()
func (*GoogleASR) SendAudioBytes ¶
type GoogleASROption ¶
type GoogleASROption struct {
Encoding speechpb.RecognitionConfig_AudioEncoding `json:"encoding" yaml:"encoding"`
SampleRateHertz int32 `json:"sampleRateHertz" yaml:"sample_rate_hertz"`
LanguageCode string `json:"languageCode" yaml:"language_code"`
ReqChainSize int `json:"reqChainSize" yaml:"req_chain_size" default:"128"`
}
func NewGoogleASROption ¶
func NewGoogleASROption(encoding speechpb.RecognitionConfig_AudioEncoding, sampleRateHertz int32, languageCode string) GoogleASROption
func (*GoogleASROption) GetVendor ¶
func (opt *GoogleASROption) GetVendor() Vendor
type LocalASRConfig ¶
type LocalASRConfig struct {
Provider LocalASRProvider `json:"provider"` // ASR提供商
ModelPath string `json:"modelPath"` // 模型文件路径
Language string `json:"language"` // 语言代码
SampleRate int `json:"sampleRate"` // 采样率
Channels int `json:"channels"` // 声道数
BitDepth int `json:"bitDepth"` // 位深度
BufferSize int `json:"bufferSize"` // 缓冲区大小(毫秒)
EnableVAD bool `json:"enableVAD"` // 是否启用VAD
VADThreshold float32 `json:"vadThreshold"` // VAD阈值
Command string `json:"command"` // 外部命令(用于 local_cmd 模式)
}
LocalASRConfig 本地ASR配置
func NewLocalASRConfig ¶
func NewLocalASRConfig(provider LocalASRProvider, modelPath string) *LocalASRConfig
NewLocalASRConfig 创建默认本地ASR配置
func (*LocalASRConfig) GetVendor ¶
func (opt *LocalASRConfig) GetVendor() Vendor
type LocalASRProvider ¶
type LocalASRProvider string
LocalASRProvider 本地ASR提供商类型
const ( LocalASRProviderWhisperCpp LocalASRProvider = "whisper_cpp" LocalASRProviderLocal LocalASRProvider = "local_cmd" )
type LocalASRService ¶
type LocalASRService struct {
// contains filtered or unexported fields
}
LocalASRService 本地ASR服务
func NewLocalASRService ¶
func NewLocalASRService(config *LocalASRConfig) (*LocalASRService, error)
NewLocalASRService 创建本地ASR服务
func (*LocalASRService) ConnAndReceive ¶
func (s *LocalASRService) ConnAndReceive(dialogId string) error
ConnAndReceive 连接并接收
func (*LocalASRService) Init ¶
func (s *LocalASRService) Init(tr TranscribeResult, er ProcessError)
Init 初始化服务
func (*LocalASRService) RestartClient ¶
func (s *LocalASRService) RestartClient()
RestartClient 重启客户端
func (*LocalASRService) SendAudioBytes ¶
func (s *LocalASRService) SendAudioBytes(data []byte) error
SendAudioBytes 发送音频数据
type MessageType ¶
type MessageType byte
type MessageTypeSpecificFlags ¶
type MessageTypeSpecificFlags byte
type Output ¶
type Output struct {
Sentence struct {
SentenceEnd bool `json:"sentence_end"`
BeginTime int64 `json:"begin_time"`
EndTime *int64 `json:"end_time"`
Text string `json:"text"`
Words []struct {
BeginTime int64 `json:"begin_time"`
EndTime *int64 `json:"end_time"`
Text string `json:"text"`
Punctuation string `json:"punctuation"`
} `json:"words"`
} `json:"sentence"`
}
type Params ¶
type Params struct {
Format string `json:"format"`
SampleRate int `json:"sample_rate"`
VocabularyID string `json:"vocabulary_id"`
DisfluencyRemovalEnabled bool `json:"disfluency_removal_enabled"`
LanguageHints []string `json:"language_hints"`
// fun asr special
MaxSentenceSilence uint `json:"maxSentenceSilence"` // ms
Heartbeat bool `json:"heartbeat"`
}
type ProcessError ¶
type ProtocolVersion ¶
type ProtocolVersion byte
type QCloudASR ¶
type QCloudASR struct {
Handler media.MediaHandler
// contains filtered or unexported fields
}
func NewQcloudASR ¶
func NewQcloudASR(opt QCloudASROption) *QCloudASR
func (*QCloudASR) ConnAndReceive ¶
func (*QCloudASR) Init ¶
func (asq *QCloudASR) Init(tr TranscribeResult, er ProcessError)
func (*QCloudASR) OnFail ¶
func (asq *QCloudASR) OnFail(response *asr.SpeechRecognitionResponse, err error)
OnFail implementation of SpeechRecognitionListener
func (*QCloudASR) OnRecognitionComplete ¶
func (asq *QCloudASR) OnRecognitionComplete(response *asr.SpeechRecognitionResponse)
OnRecognitionComplete implementation of SpeechRecognitionListener
func (*QCloudASR) OnRecognitionResultChange ¶
func (asq *QCloudASR) OnRecognitionResultChange(response *asr.SpeechRecognitionResponse)
OnRecognitionResultChange implementation of SpeechRecognitionListener
func (*QCloudASR) OnRecognitionStart ¶
func (asq *QCloudASR) OnRecognitionStart(response *asr.SpeechRecognitionResponse)
OnRecognitionStart implementation of SpeechRecognitionListener
func (*QCloudASR) OnSentenceBegin ¶
func (asq *QCloudASR) OnSentenceBegin(response *asr.SpeechRecognitionResponse)
OnSentenceBegin implementation of SpeechRecognitionListener
func (*QCloudASR) OnSentenceEnd ¶
func (asq *QCloudASR) OnSentenceEnd(response *asr.SpeechRecognitionResponse)
OnSentenceEnd implementation of SpeechRecognitionListener
func (*QCloudASR) RestartClient ¶
func (asq *QCloudASR) RestartClient()
func (*QCloudASR) SendAudioBytes ¶
type QCloudASROption ¶
type QCloudASROption struct {
AppID string `json:"appId" yaml:"app_id" env:"QCLOUD_APP_ID"`
SecretID string `json:"secretId" yaml:"secret_id" env:"QCLOUD_SECRET_ID"`
SecretKey string `json:"secret" yaml:"secret" env:"QCLOUD_SECRET"`
Format int `json:"format" yaml:"format" default:"1"`
ModelType string `json:"modelType" yaml:"model_type" env:"QCLOUD_MODEL_TYPE" default:"16k_zh"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
HotWords []HotWord `json:"hotWords" yaml:"hot_words"`
}
func NewQcloudASROption ¶
func NewQcloudASROption(appId string, secretId string, secretKey string) QCloudASROption
func (*QCloudASROption) GetVendor ¶
func (opt *QCloudASROption) GetVendor() Vendor
func (QCloudASROption) String ¶
func (opt QCloudASROption) String() string
type Recognizer ¶
type Recognizer struct {
// contains filtered or unexported fields
}
func NewRecognizer ¶
func NewRecognizer(config *Config) *Recognizer
func (*Recognizer) GetTraceID ¶
func (r *Recognizer) GetTraceID() string
func (*Recognizer) SendAudioFrame ¶
func (r *Recognizer) SendAudioFrame(frame []byte, end bool) error
func (*Recognizer) SetErrorCallback ¶
func (r *Recognizer) SetErrorCallback(callback func(error))
SetErrorCallback sets the callback function for handling errors
func (*Recognizer) SetResultCallback ¶
func (r *Recognizer) SetResultCallback(callback ResultCallback)
SetResultCallback sets the callback function for handling recognition results
func (*Recognizer) Start ¶
func (r *Recognizer) Start() error
func (*Recognizer) Stop ¶
func (r *Recognizer) Stop()
type RequestConfig ¶
type RequestConfig struct {
ModelName string `json:"model_name" yaml:"model_name" default:"bigmodel"`
EnableITN bool `json:"enable_itn" yaml:"enable_itn" default:"true"`
EnablePUNC bool `json:"enable_punc" yaml:"enable_punc" default:"true"`
EnableDDC bool `json:"enable_ddc" yaml:"enable_ddc" default:"true"`
ShowUtterances bool `json:"show_utterances" yaml:"show_utterances" default:"true"`
EnableNonstream bool `json:"enable_nonstream" yaml:"enable_nonstream" default:"false"`
Corpus CorpusConfig `json:"corpus" yaml:"corpus"`
}
RequestConfig represents request configuration
type RequestHeader ¶
type RequestHeader struct {
// contains filtered or unexported fields
}
func DefaultHeader ¶
func DefaultHeader() *RequestHeader
func (*RequestHeader) WithCompressionType ¶
func (h *RequestHeader) WithCompressionType(compressionType CompressionType) *RequestHeader
func (*RequestHeader) WithMessageType ¶
func (h *RequestHeader) WithMessageType(messageType MessageType) *RequestHeader
func (*RequestHeader) WithMessageTypeSpecificFlags ¶
func (h *RequestHeader) WithMessageTypeSpecificFlags(messageTypeSpecificFlags MessageTypeSpecificFlags) *RequestHeader
func (*RequestHeader) WithReservedData ¶
func (h *RequestHeader) WithReservedData(reservedData []byte) *RequestHeader
func (*RequestHeader) WithSerializationType ¶
func (h *RequestHeader) WithSerializationType(serializationType SerializationType) *RequestHeader
type RequestMeta ¶
type RequestMeta struct {
ModelName string `json:"model_name,omitempty"`
EnableITN bool `json:"enable_itn,omitempty"`
EnablePUNC bool `json:"enable_punc,omitempty"`
EnableDDC bool `json:"enable_ddc,omitempty"`
ShowUtterances bool `json:"show_utterances"`
EnableNonstream bool `json:"enable_nonstream"`
Corpus CorpusMeta `json:"corpus,omitempty"`
}
type RequestPayload ¶
type RequestPayload struct {
User UserMeta `json:"user"`
Audio AudioMeta `json:"audio"`
Request RequestMeta `json:"request"`
}
type Response ¶
type Response struct {
Code int `json:"code"`
Event int `json:"event"`
IsLastPackage bool `json:"is_last_package"`
PayloadSequence int32 `json:"payload_sequence"`
PayloadSize int `json:"payload_size"`
PayloadMsg *ResponsePayload `json:"payload_msg"`
Err error
}
func ParseResponse ¶
ParseResponse parses the response message
type ResponsePayload ¶
type ResponsePayload struct {
AudioInfo struct {
Duration int `json:"duration"`
} `json:"audio_info"`
Result struct {
Text string `json:"text"`
Utterances []struct {
Definite bool `json:"definite"`
EndTime int `json:"end_time"`
StartTime int `json:"start_time"`
Text string `json:"text"`
Words []struct {
EndTime int `json:"end_time"`
StartTime int `json:"start_time"`
Text string `json:"text"`
} `json:"words"`
} `json:"utterances,omitempty"`
} `json:"result"`
Error string `json:"error,omitempty"`
}
type ResultCallback ¶
type ResultCallback func(*Result)
ResultCallback defines the callback interface for handling recognition results
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
func NewRingBuffer ¶
func NewRingBuffer(size int) *RingBuffer
func (*RingBuffer) Read ¶
func (r *RingBuffer) Read(n int) []byte
func (*RingBuffer) Write ¶
func (r *RingBuffer) Write(data []byte) int
type SerializationType ¶
type SerializationType byte
type TranscribeOneShot ¶
type TranscribeOneShot struct {
Padding int
// contains filtered or unexported fields
}
type TranscribeOption ¶
type TranscribeOption struct {
Direction string `json:"direction,omitempty"`
AsrOptions map[string]any `json:"asrOptions,omitempty"`
FuzzyOptions AsrCorrectorOption `json:"fuzzyOptions,omitempty"`
}
type TranscribeResult ¶
type TranscribeService ¶
type TranscribeService interface {
Init(tr TranscribeResult, er ProcessError)
Vendor() string
ConnAndReceive(dialogId string) error
Activity() bool
RestartClient()
SendAudioBytes(data []byte) error
SendEnd() error
StopConn() error
}
type TranscriberConfig ¶
type TranscriberConfig interface {
GetVendor() Vendor
}
TranscriberConfig 统一的配置接口
func NewTranscriberConfigFromMap ¶
func NewTranscriberConfigFromMap( provider string, config map[string]interface{}, language string, ) (TranscriberConfig, error)
NewTranscriberConfigFromMap 从 map[string]interface{} 创建 TranscriberConfig 这是统一的配置入口,所有配置解析逻辑都在这里
type TranscriberFactory ¶
type TranscriberFactory interface {
// CreateTranscriber 根据配置创建 TranscribeService
CreateTranscriber(config TranscriberConfig) (TranscribeService, error)
// GetSupportedVendors 获取支持的供应商列表
GetSupportedVendors() []Vendor
// IsVendorSupported 检查供应商是否支持
IsVendorSupported(vendor Vendor) bool
}
TranscriberFactory 工厂接口
type Transcript ¶
type Transcript struct {
Type string `json:"type"`
Transcription string `json:"transcription"`
TimeBegin float64 `json:"time_begin"`
TimeEnd float64 `json:"time_end"`
Confidence float64 `json:"confidence"`
Language string `json:"language"`
Utterances []GladiaUtterance `json:"utterances"`
RequestID string `json:"request_id"`
InferenceTime float64 `json:"inference_time"`
Duration float64 `json:"duration"`
Event string `json:"event"`
Code string `json:"code"`
Message string `json:"message"`
}
type UserConfig ¶
type UserConfig struct {
UID string `json:"uid" yaml:"uid" default:"demo_uid"`
DID string `json:"did" yaml:"did"`
Platform string `json:"platform" yaml:"platform"`
SDKVersion string `json:"sdk_version" yaml:"sdk_version"`
APPVersion string `json:"app_version" yaml:"app_version"`
}
UserConfig represents user metadata configuration
type Vendor ¶
type Vendor string
Vendor 供应商类型
const ( // VendorQCloud 腾讯云 VendorQCloud Vendor = "qcloud" // VendorGoogle Google VendorGoogle Vendor = "google" // VendorAliyun 阿里云 VendorAliyun Vendor = "aliyun" // VendorFunASR FunASR VendorFunASR Vendor = "funasr" // VendorVolcengine 火山引擎 VendorVolcengine Vendor = "volcengine" // VendorVolcengineLLM 火山引擎LLM VendorVolcengineLLM Vendor = "volcllmasr" // VendorXfyunMul 科大讯飞多语言 // 注意:Xfyun (非Mul版本) 未实现 TranscribeService 接口,只有 WithXfyunASR 函数 VendorXfyunMul Vendor = "xfyun_mul" // VendorGladia Gladia VendorGladia Vendor = "gladia" // VendorFunASRRealtime FunASR实时 VendorFunASRRealtime Vendor = "funasr_realtime" // VendorWhisper Whisper VendorWhisper Vendor = "whisper" // VendorDeepgram Deepgram VendorDeepgram Vendor = "deepgram" // VendorAWS AWS VendorAWS Vendor = "aws" // VendorBaidu 百度 VendorBaidu Vendor = "baidu" // VendorVoiceAPI VoiceAPI VendorVoiceAPI Vendor = "voiceapi" // VendorLocal 本地ASR VendorLocal Vendor = "local" )
type VoiceapiASR ¶
type VoiceapiASR struct {
Sentence string
// contains filtered or unexported fields
}
type VoiceapiASROption ¶
type VoiceapiASROption struct {
Url string `json:"url" yaml:"url" env:"ASR_VOICEAPI_URL"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewVoiceapiASROption ¶
func NewVoiceapiASROption(url string) VoiceapiASROption
func (*VoiceapiASROption) GetVendor ¶
func (opt *VoiceapiASROption) GetVendor() Vendor
type VoiceapiResponse ¶
type VolcEngineResponse ¶
type VolcEngineResponse struct {
Reqid string `json:"reqid"`
Code int `json:"code"`
Message string `json:"message"`
Sequence int `json:"sequence"`
Results []VolcengineResult `json:"result,omitempty"`
}
type Volcengine ¶
type Volcengine struct {
Sentence string
// contains filtered or unexported fields
}
type VolcengineClient ¶
type VolcengineClient struct {
// contains filtered or unexported fields
}
func (*VolcengineClient) String ¶
func (c *VolcengineClient) String() string
type VolcengineLLMASR ¶
type VolcengineLLMASR struct {
// contains filtered or unexported fields
}
func NewVolcengineLLM ¶
func NewVolcengineLLM(opt VolcengineLLMOption) VolcengineLLMASR
func (*VolcengineLLMASR) Activity ¶
func (v *VolcengineLLMASR) Activity() bool
func (*VolcengineLLMASR) ConnAndReceive ¶
func (v *VolcengineLLMASR) ConnAndReceive(dialogID string) error
func (*VolcengineLLMASR) Init ¶
func (v *VolcengineLLMASR) Init(tr TranscribeResult, er ProcessError)
func (*VolcengineLLMASR) RestartClient ¶
func (v *VolcengineLLMASR) RestartClient()
func (*VolcengineLLMASR) SendAudioBytes ¶
func (v *VolcengineLLMASR) SendAudioBytes(data []byte) error
func (*VolcengineLLMASR) SendEnd ¶
func (v *VolcengineLLMASR) SendEnd() error
func (*VolcengineLLMASR) StopConn ¶
func (v *VolcengineLLMASR) StopConn() error
func (*VolcengineLLMASR) Vendor ¶
func (v *VolcengineLLMASR) Vendor() string
type VolcengineLLMOption ¶
type VolcengineLLMOption struct {
Url string `json:"url" yaml:"url" default:"wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async"`
ResourceId string `json:"resourceId" yaml:"resource_id" default:"volc.bigasr.sauc.duration"`
AppID string `json:"appId" yaml:"app_id" env:"ASR_VOLC_LLM_APPID"`
AccessToken string `json:"accessToken" yaml:"access_token" env:"ASR_VOLC_LLM_ACCESS_TOKEN"`
Format string `json:"format" yaml:"format" default:"pcm"`
SampleRate int `json:"sampleRate" yaml:"sample_rate" default:"16000"`
BitDepth int `json:"bitDepth" yaml:"bit_depth" default:"16"`
Channel int `json:"channel" yaml:"channel" default:"1"`
Codec string `json:"codec" yaml:"codec" default:"raw"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
HotWords []HotWord `json:"hotWords" yaml:"hot_words"`
}
func NewVolcengineLLMOption ¶
func NewVolcengineLLMOption(token, appID string) VolcengineLLMOption
func (*VolcengineLLMOption) GetVendor ¶
func (opt *VolcengineLLMOption) GetVendor() Vendor
type VolcengineOption ¶
type VolcengineOption struct {
Url string `json:"url" yaml:"url" default:"wss://openspeech.bytedance.com/api/v2/asr"`
AppID string `json:"appId" yaml:"app_id" env:"VOLC_APPID"`
Token string `json:"token" yaml:"token" env:"VOLC_TOKEN"`
Cluster string `json:"cluster" yaml:"cluster" env:"VOLC_CLUSTER"`
WorkFlow string `json:"workFlow" yaml:"work_flow" default:"audio_in,resample,partition,vad,fe,decode"`
Format string `json:"format" yaml:"format" default:"raw" env:"VOLC_FORMAT"`
Codec string `json:"codec" yaml:"codec" default:"raw"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewVolcengineOption ¶
func NewVolcengineOption(appId string, token string, cluster string, format string) VolcengineOption
func (*VolcengineOption) GetVendor ¶
func (opt *VolcengineOption) GetVendor() Vendor
type VolcengineResult ¶
type WhisperASR ¶
type WhisperASROption ¶
type WhisperASROption struct {
Url string `json:"url" yaml:"url"`
Model string `json:"model" yaml:"model"`
ReqChanSize int `json:"reqChanSize" yaml:"req_chan_size" default:"128"`
}
func NewWhisperASROption ¶
func NewWhisperASROption(url, model string) WhisperASROption
func (*WhisperASROption) GetVendor ¶
func (opt *WhisperASROption) GetVendor() Vendor