Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSimilarity ¶
compute cosine similarity between two vectors
Types ¶
type Classifier ¶
type Classifier struct {
// contains filtered or unexported fields
}
func NewClassifier ¶
func NewClassifier(model string, opts ...Option) (*Classifier, error)
func (*Classifier) Classify ¶
func (c *Classifier) Classify(text string) (*ClassifyResult, error)
run classifier
func (*Classifier) NumLabels ¶
func (c *Classifier) NumLabels() int
return the number of labels the model supports
type ClassifyResult ¶
type ClassifyResult struct {
Label string
Score float32
AllScores []LabelScore
}
output of a classification
func (*ClassifyResult) String ¶
func (r *ClassifyResult) String() string
func (*ClassifyResult) ToJSON ¶
func (r *ClassifyResult) ToJSON() string
type Embedder ¶
type Embedder struct {
// contains filtered or unexported fields
}
encode text into vector embeddings
func (*Embedder) EncodeBatch ¶
encodes multiple texts
type ErrorCode ¶
type ErrorCode int32
const ( ErrOk ErrorCode = 0 ErrNullPointer ErrorCode = 1 ErrInvalidUtf8 ErrorCode = 2 ErrModelNotFound ErrorCode = 3 ErrLoadFailed ErrorCode = 4 ErrInferenceFailed ErrorCode = 5 ErrInvalidConfig ErrorCode = 7 ErrCancelled ErrorCode = 8 ErrTimeout ErrorCode = 9 ErrStreamEnded ErrorCode = 10 ErrUnknown ErrorCode = 255 )
type IndexStats ¶
type IndexStats struct {
DocumentsIndexed int
ChunksCreated int
Dimension int
SizeBytes uint64
FilesProcessed int
FilesSkipped int
ElapsedMs uint64
}
statistics from an indexing operation.
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
create search indexes from files
type KjarniError ¶
func (*KjarniError) Error ¶
func (e *KjarniError) Error() string
type RerankResult ¶
single reranked document
type Reranker ¶
type Reranker struct {
// contains filtered or unexported fields
}
score query-document relevance using a cross-encoder
func (*Reranker) Rerank ¶
func (r *Reranker) Rerank(query string, documents []string) ([]RerankResult, error)
rerank scores and sort documents by relevance to the query
func (*Reranker) RerankTopK ¶
scores documents and returns the top k
type SearchMode ¶
type SearchMode int
search strategy hybrid, semantic, keyword(bm25)
const ( Keyword SearchMode = 0 Semantic SearchMode = 1 Hybrid SearchMode = 2 )
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
Searcher queries indexes created by Indexer
func NewSearcher ¶
new searcher
func (*Searcher) Search ¶
func (s *Searcher) Search(indexPath string, query string, mode SearchMode) ([]SearchResult, error)
queries the index with the given mode
Source Files
¶
Click to show internal directories.
Click to hide internal directories.