vector

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 11 Imported by: 0

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