ai

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveCategory

func ResolveCategory(repo *store.Repository, aiTags []string, cats []*store.Category) string

Types

type AnalysisResult

type AnalysisResult struct {
	Summary    string   `json:"summary"`
	Tags       []string `json:"tags"`
	Platforms  []string `json:"platforms"`
	SearchText string   `json:"search_text"`
}

type BatchAnalyzer

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

func NewBatchAnalyzer

func NewBatchAnalyzer(svc *Service, s store.Store, gh *github.Client, concurrency int) *BatchAnalyzer

func (*BatchAnalyzer) Run

func (b *BatchAnalyzer) Run(ctx context.Context, repos []*store.Repository, opts BatchOpts) (*BatchResult, error)

type BatchOpts

type BatchOpts struct {
	Force      bool
	Limit      int
	OnProgress func(done, total int, curName string)
}

type BatchResult

type BatchResult struct {
	Total   int
	Success int
	Failed  int
}

type Client

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

func NewClient

func NewClient(baseURL, apiKey, model string) *Client

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, messages []Message) (string, error)

type EmbeddingClient added in v0.0.6

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

func NewEmbeddingClient added in v0.0.6

func NewEmbeddingClient(baseURL, apiKey, model string) *EmbeddingClient

func (*EmbeddingClient) Embed added in v0.0.6

func (ec *EmbeddingClient) Embed(ctx context.Context, texts []string) ([][]float64, error)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type QueryIntent added in v0.0.5

type QueryIntent struct {
	FTSQuery string   `json:"fts_query"`
	Keywords []string `json:"keywords"`
	Language string   `json:"language"`
	Category string   `json:"category"`
	Platform string   `json:"platform"`
	MinStars int      `json:"min_stars"`
	MaxStars int      `json:"max_stars"`
}

type SearchHit

type SearchHit struct {
	Repo  *store.Repository
	Score float64
}

type SearchMode added in v0.0.6

type SearchMode string
const (
	SearchModeVector    SearchMode = "vector"
	SearchModeAI        SearchMode = "ai"
	SearchModeBasicText SearchMode = "basic_text"
)

type SearchOpts added in v0.0.5

type SearchOpts struct {
	Language       string
	Category       string
	Platform       string
	Tags           []string
	MinStars       int
	MaxStars       int
	Sort           string
	Limit          int
	Analyzed       *bool
	AnalysisFailed *bool
	EnableHyDE     bool
	EnableRerank   bool
	RerankTopK     int
}

type SearchResult added in v0.0.6

type SearchResult struct {
	Hits []*SearchHit
	Mode SearchMode
}

type Service

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

func NewService

func NewService(client *Client, gh *github.Client) *Service

func NewServiceWithEmbedding added in v0.0.6

func NewServiceWithEmbedding(client *Client, gh *github.Client, embeddingClient *EmbeddingClient) *Service

func (*Service) AnalyzeRepository

func (s *Service) AnalyzeRepository(ctx context.Context, repo *store.Repository, readme string, cats []*store.Category) (*AnalysisResult, error)

func (*Service) Search

func (s *Service) Search(ctx context.Context, query string, st store.Store, opts SearchOpts) (*SearchResult, error)

Jump to

Keyboard shortcuts

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