Help us shape the future of Go! Take the 2026 Go Developer Survey

baai

package
v2.14.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 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:"relevance_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