embedcontracts

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 1 Imported by: 0

README

go-embed-contracts

Text-embedding interface for the hollis-labs portfolio. Contracts-only.

Surface

  • Embedder interface
  • EmbeddingResult struct

Consumers

  • vanta-conduit — primary consumer (memory store, recall, mcpadapter)
  • stack-explorer — code-embed indexing
  • nanite — chat-side embedder selection (and a future SDK wrapper at internal/llm/openai/embed.go per SP-20260508-0001 CW-0012)

Lineage

Originally in github.com/hollis-labs/go-providers (provider.Embedder). v0.10.0 of go-providers narrowed scope to CLI/PTY/subprocess-only and removed the HTTP-API surface; the embedding contract moved here.

Companion module

Chat contracts and rate-budget primitives live in github.com/hollis-labs/go-llm-contracts.

Documentation

Overview

Package embedcontracts defines shared text-embedding contracts used across the hollis-labs portfolio. This module contains interfaces and data shapes only; it provides no provider implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	Embed(ctx context.Context, text string, model string) (*EmbeddingResult, error)
	EmbedBatch(ctx context.Context, texts []string, model string) ([]EmbeddingResult, error)
	EmbeddingDimensions(model string) int
}

Embedder is implemented by providers that produce text embeddings.

Implementers commit to:

  • Single-input Embed: one round-trip per call, returning a single vector.
  • EmbedBatch: a single API call when the underlying provider supports native batching; otherwise an internal loop over Embed (callers should not assume the batch path is faster than single by default).
  • EmbeddingDimensions: synchronous lookup with no I/O. Returns 0 when the model is unknown to the implementer.

Consumers type-assert when needed; not every Provider in the portfolio supports embedding.

type EmbeddingResult

type EmbeddingResult struct {
	// Embedding is the vector representation of the input text.
	Embedding []float32
	// TokenCount is the number of tokens consumed (for billing/rate tracking).
	TokenCount int
}

EmbeddingResult holds the output of an embedding request.

Jump to

Keyboard shortcuts

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