Documentation
¶
Index ¶
- Variables
- func Bool(v bool) *bool
- func Float(v float64) *float64
- func Int(v int) *int
- func PCM16ToULaw(pcm []byte) []byte
- func ReadAll(in Input) ([]byte, error)
- func ResamplePCM16(pcm []byte, from, to int) []byte
- func String(v string) *string
- func ULawToPCM16(ulaw []byte) []byte
- func UnwrapWAV(data []byte) ([]byte, int, error)
- func WrapWAV(pcm []byte, sampleRate int) []byte
- type Audio
- func (a *Audio) Bytes() []byte
- func (a *Audio) Duration() time.Duration
- func (a *Audio) Format() Format
- func (a *Audio) Len() int
- func (a *Audio) PCM16() ([]byte, int, error)
- func (a *Audio) Read(p []byte) (int, error)
- func (a *Audio) SampleRate() int
- func (a *Audio) Save(path string) error
- func (a *Audio) WriteTo(w io.Writer) (int64, error)
- type AudioChunk
- type BatchRequest
- type ChatChoice
- type ChatChunk
- type ChatChunkChoice
- type ChatDelta
- type ChatRequest
- type ChatResponse
- type Codec
- type FinalTranscript
- type Format
- type FunctionCall
- type FunctionDefinition
- type Input
- type Job
- type JobFile
- type JobState
- type Language
- type Message
- type Mode
- type Model
- type PartialTranscript
- type ReasoningEffort
- type Role
- type SessionEnded
- type SessionStarted
- type SpeakerTurn
- type SpeechEnded
- type SpeechRequest
- type SpeechStarted
- type StreamType
- type Tool
- type ToolCall
- type ToolCallDelta
- type TranscriptionEvent
- type TranscriptionRequest
- type TranscriptionResult
- type TranscriptionStreamRequest
- type Usage
- type Word
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedFormat = errors.New("sarvam: unsupported audio format")
Functions ¶
func PCM16ToULaw ¶ added in v0.3.0
func ResamplePCM16 ¶ added in v0.3.0
func ULawToPCM16 ¶ added in v0.3.0
Types ¶
type Audio ¶
type Audio struct {
// contains filtered or unexported fields
}
func (*Audio) SampleRate ¶
type AudioChunk ¶
type BatchRequest ¶
type ChatChoice ¶ added in v0.2.0
type ChatChunk ¶ added in v0.2.0
type ChatChunkChoice ¶ added in v0.2.0
type ChatDelta ¶ added in v0.2.0
type ChatDelta struct {
Role Role `json:"role"`
Content string `json:"content"`
ReasoningContent string `json:"reasoning_content"`
ToolCalls []ToolCallDelta `json:"tool_calls"`
}
type ChatRequest ¶ added in v0.2.0
type ChatResponse ¶ added in v0.2.0
type ChatResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []ChatChoice `json:"choices"`
Usage *Usage `json:"usage"`
}
func (*ChatResponse) Content ¶ added in v0.2.0
func (r *ChatResponse) Content() string
func (*ChatResponse) FinishReason ¶ added in v0.2.0
func (r *ChatResponse) FinishReason() string
func (*ChatResponse) HasToolCalls ¶ added in v0.2.0
func (r *ChatResponse) HasToolCalls() bool
func (*ChatResponse) Reasoning ¶ added in v0.2.0
func (r *ChatResponse) Reasoning() string
func (*ChatResponse) ToolCalls ¶ added in v0.2.0
func (r *ChatResponse) ToolCalls() []ToolCall
type FinalTranscript ¶
type Format ¶
func (Format) BitrateParam ¶
type FunctionCall ¶ added in v0.2.0
func (FunctionCall) ParseArguments ¶ added in v0.2.0
func (f FunctionCall) ParseArguments(into any) error
type FunctionDefinition ¶ added in v0.2.0
type Input ¶
type Input interface {
Filename() string
ContentType() string
Open() (io.ReadCloser, error)
Size() int64
Replayable() bool
Duration() (time.Duration, bool)
}
func BytesInput ¶
type Language ¶
type Language string
const ( LangEnglish Language = "en-IN" LangHindi Language = "hi-IN" LangBengali Language = "bn-IN" LangGujarati Language = "gu-IN" LangKannada Language = "kn-IN" LangMalayalam Language = "ml-IN" LangMarathi Language = "mr-IN" LangOdia Language = "od-IN" LangPunjabi Language = "pa-IN" LangTamil Language = "ta-IN" LangTelugu Language = "te-IN" )
type Message ¶ added in v0.2.0
type Message struct {
Role Role `json:"role"`
Content string `json:"content"`
Name string `json:"name,omitempty"`
ReasoningContent string `json:"reasoning_content,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
func AssistantMessage ¶ added in v0.2.0
func SystemMessage ¶ added in v0.2.0
func ToolMessage ¶ added in v0.2.0
func UserMessage ¶ added in v0.2.0
type PartialTranscript ¶
type ReasoningEffort ¶ added in v0.2.0
type ReasoningEffort string
const ( ReasoningLow ReasoningEffort = "low" ReasoningMedium ReasoningEffort = "medium" ReasoningHigh ReasoningEffort = "high" ReasoningOff ReasoningEffort = "off" )
type SessionEnded ¶
type SessionStarted ¶
type SessionStarted struct{ RequestID string }
type SpeakerTurn ¶
type SpeechEnded ¶
type SpeechRequest ¶
type SpeechStarted ¶
type StreamType ¶
type StreamType string
const ( StreamFast StreamType = "fast" StreamBalanced StreamType = "balanced" StreamSimulated StreamType = "simulated" )
type Tool ¶ added in v0.2.0
type Tool struct {
Type string `json:"type"`
Function FunctionDefinition `json:"function"`
}
func FunctionTool ¶ added in v0.2.0
type ToolCall ¶ added in v0.2.0
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function FunctionCall `json:"function"`
}
type ToolCallDelta ¶ added in v0.2.0
type TranscriptionEvent ¶
type TranscriptionEvent interface {
// contains filtered or unexported methods
}
type TranscriptionRequest ¶
type TranscriptionResult ¶
type TranscriptionResult struct {
RequestID string
Text string
Language Language
LanguageProbability float64
Words []Word
}
func (*TranscriptionResult) SRT ¶
func (r *TranscriptionResult) SRT() string
func (*TranscriptionResult) SpeakerTurns ¶
func (r *TranscriptionResult) SpeakerTurns() []SpeakerTurn
func (*TranscriptionResult) VTT ¶
func (r *TranscriptionResult) VTT() string
Click to show internal directories.
Click to hide internal directories.