Documentation
¶
Overview ¶
Package toolmodel runs local embedding models used for tool retrieval. The model layout and WordPiece implementation are adapted from Pulse (github.com/bryanbarton525/pulse, Apache-2.0 license).
Index ¶
- Constants
- func Cosine(a, b []float32) float64
- func MiniLMPath(stateDir string) string
- func PotionPaths(stateDir string) (string, string)
- func SetupMiniLM(ctx context.Context, stateDir string) error
- func SetupPotion(ctx context.Context, stateDir string) error
- type EncodeOptions
- type KevClient
- type KevTool
- type MiniLM
- type Potion
- type WordPiece
Constants ¶
const ( PotionRevision = "1e5a03f8eeb2c98b928fbbd846f22f816360919f" MiniLMRevision = "1110a243fdf4706b3f48f1d95db1a4f5529b4d41" )
Variables ¶
This section is empty.
Functions ¶
func MiniLMPath ¶
func PotionPaths ¶
Types ¶
type EncodeOptions ¶
type EncodeOptions struct {
// AddSpecialTokens wraps the sequence in [CLS] and [SEP].
//
// Transformers need them: [CLS] is a real position the attention layers
// read. Static embeddings do not — there is no attention, so a special
// token would just be one more vector dragging the mean toward a constant.
AddSpecialTokens bool
// MaxTokens truncates the sequence. Zero means no limit.
MaxTokens int
}
EncodeOptions controls how a sequence is prepared for a specific model.
type KevClient ¶
type KevClient struct {
// contains filtered or unexported fields
}
KevClient calls an explicitly started local Kev server. A timed-out server exchange disables the adapter until Prism restarts because server inference may still be queued after HTTP cancellation.
func NewKevClient ¶
type MiniLM ¶
type MiniLM struct {
// contains filtered or unexported fields
}
MiniLM runs an ONNX sentence embedding graph through Hugot's pure-Go backend.
func LoadMiniLM ¶
type WordPiece ¶
type WordPiece struct {
// contains filtered or unexported fields
}
WordPiece is a BERT WordPiece tokenizer.
Both embedding tiers use a BERT-family vocabulary, so one pure-Go tokenizer serves both. Implementing it here rather than pulling in a cgo/Rust tokenizer keeps Prism's runtime binary free of cgo entirely.
func LoadWordPiece ¶
LoadWordPiece reads a vocab.txt where line N holds the token with ID N.