rank

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package rank contains a prompt command to rank arbitrary large lists through iteration. It is based on the raink algorithm described and implemented here: https://bishopfox.com/blog/raink-llms-document-ranking https://github.com/noperator/raink

Index

Constants

View Source
const (
	Name               = "rank"
	MultilineSeparator = "\n----\n"
)

Variables

This section is empty.

Functions

func New

func New() (commands.Command, error)

Types

type Item

type Item struct {
	ID          string `json:"id"`
	Contents    string `json:"contents"`
	RankHistory []int  `json:"-"`
}

func (*Item) Clone

func (i *Item) Clone() *Item

func (*Item) RankingScore

func (i *Item) RankingScore() float64

type Items

type Items []*Item

func MergeBatches

func MergeBatches(batches ...Items) Items

func (Items) AddRankings

func (i Items) AddRankings(ids []string) error

func (Items) Batch

func (i Items) Batch(requestedSize int) ([]Items, error)

func (Items) Clone

func (i Items) Clone() Items

func (Items) JSON

func (i Items) JSON() string

func (Items) RankSorted

func (i Items) RankSorted() Items

func (Items) Shuffle

func (i Items) Shuffle()

type Rank

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

func (*Rank) Help

func (r *Rank) Help() string

func (*Rank) Name

func (r *Rank) Name() string

func (*Rank) Run

func (r *Rank) Run(ctx context.Context, msg commands.PromptMessage, _ *llms.Session) (tea.Cmd, error)

func (*Rank) SetTeaEmitter

func (r *Rank) SetTeaEmitter(emitter uimsg.TeaEmitter)

func (*Rank) Usage

func (r *Rank) Usage() string

type RequestMessage

type RequestMessage struct {
	commands.MessageType

	PromptMessage commands.PromptMessage
	Iteration     int
	BatchIdx      int
	Batch         Items
	Description   string
	ResponseChan  chan<- ResponseMessage `json:"-"`
	Retries       int
}

type ResponseMessage

type ResponseMessage struct {
	RequestMessage

	Message string
	Err     error
}

Jump to

Keyboard shortcuts

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