models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBackend

func RegisterBackend(name string, backend Backend)

Types

type Backend

type Backend func(modelName string) Model

type Chat

type Chat func(ctx context.Context, prompt string) (StreamingOutput, error)

type Model

type Model StartChat

func NewModel

func NewModel(backendName string, modelName string) Model

func NewOpenAIModel

func NewOpenAIModel(modelName string, cfg *OpenAIConfig) Model

type OpenAIConfig

type OpenAIConfig struct {
	ApiKey            string
	BaseURL           string
	MaxTokens         int
	Temperature, TopP float32
	Prefix            []openai.ChatCompletionMessage
	NoStreaming       bool
}

type StartChat

type StartChat func() Chat

type StreamingOutput

type StreamingOutput <-chan string

func (StreamingOutput) WriteTo

func (stream StreamingOutput) WriteTo(w io.Writer) (int64, error)

Jump to

Keyboard shortcuts

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