ai_provider

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinishReasonUnspecified     = "FINISH_REASON_UNSPECIFIED"
	FinishStop                  = "STOP"
	FinishMaxTokens             = "MAX_TOKENS"
	FinishSafety                = "SAFETY"
	FinishRecitation            = "RECITATION"
	FinishLanguage              = "LANGUAGE"
	FinishOther                 = "OTHER"
	FinishBlocklist             = "BLOCKLIST"
	FinishProhibitedContent     = "PROHIBITED_CONTENT"
	FinishSPII                  = "SPII"
	FinishMalformedFunctionCall = "MALFORMED_FUNCTION_CALL"
)

Variables

This section is empty.

Functions

func LoadModels

func LoadModels(providerContent []byte, dirFs embed.FS) (map[string]*Model, error)

func MapToStruct

func MapToStruct[T any](tmp map[string]interface{}) *T

func NewBalanceHandler

func NewBalanceHandler(id string, base string, timeout time.Duration) (eocontext.BalanceHandler, error)

func NewBaseNode

func NewBaseNode(id string, ip string, port int) *_BaseNode

Types

type ClientRequest

type ClientRequest struct {
	Messages []*Message `json:"messages"`
}

type ClientResponse

type ClientResponse struct {
	Message      Message `json:"message,omitempty"`
	FinishReason string  `json:"finish_reason,omitempty"`
	Code         int     `json:"code"`
	Error        string  `json:"error"`
}

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Mode

type Mode string
const (
	ModeChat     Mode = "chat"
	ModeComplete Mode = "complete"
)

func (Mode) String

func (m Mode) String() string

type Model

type Model struct {
	Model           string     `json:"model" yaml:"model"`
	ModelType       ModelType  `json:"model_type" yaml:"model_type"`
	ModelProperties *ModelMode `json:"model_properties" yaml:"model_properties"`
}

type ModelMode

type ModelMode struct {
	Mode        string `json:"mode" yaml:"mode"`
	ContextSize int    `json:"context_size" yaml:"context_size"`
}

type ModelType

type ModelType string
const (
	ModelTypeLLM           ModelType = "llm"
	ModelTypeTextEmbedding ModelType = "text-embedding"
	ModelTypeSpeech2Text   ModelType = "speech2text"
	ModelTypeModeration    ModelType = "moderation"
	ModelTypeTTS           ModelType = "tts"
)

type Provider

type Provider struct {
	Provider            string   `json:"provider" yaml:"provider"`
	SupportedModelTypes []string `json:"supported_model_types" yaml:"supported_model_types"`
}

Jump to

Keyboard shortcuts

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