vector

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 9 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 Config

type Config struct {
	Host     string
	Port     string
	Database string
	User     string
	Password string
	SSLMode  string
}

func EnvConfig

func EnvConfig() *Config

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 []float64) error

func (*KnowledgeService) Truncate added in v0.0.4

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

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) 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 []float64) error

type Service

type Service struct {
	DB        *sqlx.DB
	OpenAICli *openai.Client
}

func New

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

func (*Service) Close

func (s *Service) Close()

func (*Service) GenerateEmbeddings

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

Jump to

Keyboard shortcuts

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