aws

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultBedrockModel = "anthropic.claude-3-haiku-20240307-v1:0"

DefaultBedrockModel is the default Bedrock model when none is specified.

Variables

This section is empty.

Functions

This section is empty.

Types

type LLMService

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

LLMService implements services.LLMService using AWS Bedrock Converse API (streaming).

func NewLLM

func NewLLM(cfg aws.Config, modelID string) *LLMService

NewLLM creates an AWS Bedrock LLM service from an existing AWS config.

func NewLLMWithRegion

func NewLLMWithRegion(ctx context.Context, region, modelID string) (*LLMService, error)

NewLLMWithRegion creates an AWS Bedrock LLM service by loading default config (env/profile) for the given region.

func (*LLMService) Chat

func (s *LLMService) Chat(ctx context.Context, messages []map[string]any, onToken func(*frames.LLMTextFrame)) error

Chat runs a completion via Bedrock ConverseStream and calls onToken for each content delta.

type STTService

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

STTService implements services.STTService using Amazon Transcribe streaming.

func NewSTT

func NewSTT(cfg aws.Config, languageCode types.LanguageCode) *STTService

NewSTT creates an AWS Transcribe STT service from an existing AWS config.

func NewSTTWithRegion

func NewSTTWithRegion(ctx context.Context, region, languageCode string) (*STTService, error)

NewSTTWithRegion creates a Transcribe STT service by loading default config for the given region. languageCode can be empty for default (en-US), or an AWS Transcribe language code (e.g. "en-US", "es-ES").

func (*STTService) Transcribe

func (s *STTService) Transcribe(ctx context.Context, audio []byte, sampleRate, numChannels int) ([]*frames.TranscriptionFrame, error)

Transcribe sends audio to AWS Transcribe streaming and returns the final transcript as TranscriptionFrame(s). Audio must be 16-bit PCM mono at 8000 or 16000 Hz; other sample rates are not supported by Transcribe streaming.

type TTSService

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

TTSService implements services.TTSService using Amazon Polly.

func NewTTS

func NewTTS(cfg aws.Config, voiceID string, engine types.Engine) *TTSService

NewTTS creates an AWS Polly TTS service from an existing AWS config.

func NewTTSWithRegion

func NewTTSWithRegion(ctx context.Context, region, voiceID, engine string) (*TTSService, error)

NewTTSWithRegion creates a Polly TTS service by loading default config for the given region. engine can be empty for default (neural), or "standard", "neural", "long-form", "generative".

func (*TTSService) Speak

func (s *TTSService) Speak(ctx context.Context, text string, sampleRate int) ([]*frames.TTSAudioRawFrame, error)

Speak synthesizes text to speech and returns TTSAudioRawFrame(s). Polly PCM is 16-bit 16kHz mono.

func (*TTSService) SpeakStream

func (s *TTSService) SpeakStream(ctx context.Context, text string, sampleRate int, outCh chan<- frames.Frame)

SpeakStream runs TTS and sends the resulting TTSAudioRawFrame(s) to outCh.

Jump to

Keyboard shortcuts

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