vector

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RoleSystem    = "system"
	RoleUser      = "user"
	RoleAssistant = "assistant"
	RoleTool      = "tool"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KnowledgeService added in v0.0.4

type KnowledgeService struct {
	V *Service
}

func NewKnowledge added in v0.0.4

func NewKnowledge(ctx context.Context, v *Service) (*KnowledgeService, error)

func (*KnowledgeService) Query added in v0.0.4

func (s *KnowledgeService) Query(ctx context.Context, query string) ([]string, error)

func (*KnowledgeService) Store added in v0.0.4

func (s *KnowledgeService) Store(ctx context.Context, content string) error

func (*KnowledgeService) StoreEmbedding added in v0.0.4

func (s *KnowledgeService) StoreEmbedding(ctx context.Context, content string, embedding []float32) error

func (*KnowledgeService) Truncate added in v0.0.4

func (s *KnowledgeService) Truncate(ctx context.Context) error

type Memory added in v0.0.7

type Memory struct {
	Role    string `db:"role"`
	Content string `db:"content"`
}

type MemoryService added in v0.0.5

type MemoryService struct {
	V         *Service
	SessionID string
}

func NewMemory added in v0.0.5

func NewMemory(ctx context.Context, v *Service, sid string) (*MemoryService, error)

func (*MemoryService) Query added in v0.0.7

func (s *MemoryService) Query(ctx context.Context, query string) (string, error)

func (*MemoryService) Store added in v0.0.5

func (s *MemoryService) Store(ctx context.Context, role, content string) error

func (*MemoryService) StoreEmbedding added in v0.0.5

func (s *MemoryService) StoreEmbedding(ctx context.Context, role, content string, embedding []float32) error

type Service

type Service struct {
	DB         *sqlx.DB
	OpenAICli  *openai.Client
	Model      string
	Dimensions int64
}

func New

func New(ctx context.Context, cfg *config.Config, cli *openai.Client) (*Service, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) GenerateEmbeddings

func (s *Service) GenerateEmbeddings(ctx context.Context, text string) ([]float32, error)

Jump to

Keyboard shortcuts

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