ai

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotFound = errors.New("client not found")
View Source
var ErrNoModelProvided = errors.New("no model was provided")

Functions

func Fill

func Fill(cfg *Conf) error
func Search(cfg *Conf, question string) ([]db.Fragment, error)

Types

type APICredentials

type APICredentials struct {
	BellmanURL     string `cli:"bellman-url"`
	BellmanKeyName string `cli:"bellman-key-name"`
	BellmanKey     string `cli:"bellman-key"`

	VertexAICredential string `cli:"vertexai-credential"`
	VertexAIProject    string `cli:"vertexai-project"`
	VertexAIRegion     string `cli:"vertexai-region"`

	OpenAIKey    string `cli:"openai-key"`
	AnthropicKey string `cli:"anthropic-key"`
	VoyageAIKey  string `cli:"voyageai-key"`
}

type Answer

type Answer struct {
	Answer          string          `json:"answer,omitempty" json-description:"The answer to the question"`
	ConfidenceScore float32         `` /* 306-byte string literal not displayed */
	Metadata        models.Metadata `json:"-"`
}

func Query

func Query(cfg *Conf, question string) (Answer, error)

type Conf

type Conf struct {
	Dao   *db.Queries
	Proxy *Proxy

	EmbedModel embed.Model
	LLMModel   gen.Model

	SystemPrompt string
	// contains filtered or unexported fields
}

func LoadConf

func LoadConf(ctx context.Context, cmd *cli.Command) (*Conf, error)

type Proxy

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

func New

func New(credentials APICredentials, logger *slog.Logger) (*Proxy, error)

func (*Proxy) Embed

func (p *Proxy) Embed(mod embed.Request) (*embed.Response, error)

func (*Proxy) Gen

func (p *Proxy) Gen(mod gen.Model) (*gen.Generator, error)

func (*Proxy) RegisterEmbeder

func (p *Proxy) RegisterEmbeder(embeder embed.Embeder)

func (*Proxy) RegisterGen

func (p *Proxy) RegisterGen(llm gen.Gen)

Jump to

Keyboard shortcuts

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