baai

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RerankDocument

type RerankDocument struct {
	Text string `json:"text"`
}

type RerankRequest

type RerankRequest struct {
	Model           string   `json:"model"`
	Query           string   `json:"query"`
	Documents       []string `json:"documents"`
	ReturnDocuments bool     `json:"return_documents"`
}

type RerankResponse

type RerankResponse struct {
	Model   string         `json:"model"`
	Results []RerankResult `json:"results"`
	Usage   *RerankUsage   `json:"usage,omitempty"`
}

type RerankResult

type RerankResult struct {
	Index          int             `json:"index"`
	RelevanceScore float64         `json:"relavance_score"`
	Document       *RerankDocument `json:"document,omitempty"`
}

type RerankUsage

type RerankUsage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

type Reranker

type Reranker struct {
	Ctx    context.Context
	Config RerankerConfig
}

func NewReranker

func NewReranker(ctx context.Context, config RerankerConfig) *Reranker

func (*Reranker) Rerank

type RerankerConfig

type RerankerConfig struct {
	APIKey  string
	Model   string
	BaseUrl string
}

Jump to

Keyboard shortcuts

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