client

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CheckHealth(ctx context.Context)
}

type LLM

type LLM interface {
	Client
	Completion(ctx context.Context, ms []Message, t ability.LLMOption) (string, error)
	// CompletionStream
	//
	// return a chunk that contains an error if stream is not supported
	CompletionStream(ctx context.Context, ms []Message, t ability.LLMOption) *util.SmoothStream
	SetAbility(ctx context.Context, a *ability.LLMAblt) error
	// Support
	//
	// read ability.LLMOption to check if current provider support the option
	Support(o ability.LLMOption) bool
}

type Message

type Message struct {
	Role    Role   `json:"role" validate:"required"` // options: system, user, assistant and function
	Content string `json:"content" validate:"required"`
}

type Role

type Role string
const (
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
	RoleSystem    Role = "system"
)

type SpeechToText

type SpeechToText interface {
	Client
	// SpeechToText transcribes voice into text
	SpeechToText(ctx context.Context, audio io.Reader, fileName string, option ability.STTOption) (string, error)
	SetAbility(ctx context.Context, a *ability.STTAblt) error
	// Support
	//
	// read ability.STTOption to check if current provider support the option
	Support(o ability.STTOption) bool
}

type TextToSpeech

type TextToSpeech interface {
	Client
	// TextToSpeech
	// text is the result of removing code from originalText by calling RemoveCodeFromText
	TextToSpeech(ctx context.Context, text string, originalText string, o ability.TTSOption) ([]byte, error)
	SetAbility(ctx context.Context, a *ability.TTSAblt) error
	// Support
	//
	// read ability.TTSOption to check if current provider support the option
	Support(o ability.TTSOption) bool
}

Jump to

Keyboard shortcuts

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