internal/infra/pg/embeddingtypes.go
internal/infra/pg · 101 lines · 12 declarations · source
Declarations
const MaxStoredEmbeddingDimensions
const MaxStoredEmbeddingDimensions = 4000
const MaxRetainedEmbeddingGenerations
const MaxRetainedEmbeddingGenerations = 2
const MaxEmbeddingPage
const MaxEmbeddingPage = 64
const MaxEmbeddingPageBytes
const MaxEmbeddingPageBytes = 1 << 20
var ErrInvalidEmbedding, ErrEmbeddingConflict, ErrEmbeddingNotFound and 3 more
var (
ErrInvalidEmbedding = errors.New("invalid embedding request or model contract")
ErrEmbeddingConflict = errors.New("embedding generation, source or model contract conflicts")
ErrEmbeddingNotFound = errors.New("embedding generation not found")
ErrEmbeddingBusy = errors.New("embedding generation is already being built")
ErrEmbeddingIncomplete = errors.New("embedding generation is incomplete or stale")
ErrEmbeddingCapacity = errors.New("prune a non-active embedding generation before starting another")
)
type EmbeddingModel
type EmbeddingModel struct {
Name string `json:"name"`
Revision string `json:"revision"`
EndpointHash string `json:"endpoint_hash"`
Dimensions int `json:"dimensions"`
}
EndpointHash identifies the configured embedding endpoint without publishing its URL or key. Revision is operator-declared: an OpenAI-compatible endpoint cannot attest unchanged model weights.
method EmbeddingModel.Validate
func (m EmbeddingModel) Validate() error
method EmbeddingModel.Identity
func (m EmbeddingModel) Identity() string
type EmbeddingGeneration
type EmbeddingGeneration struct {
ID string `json:"id"`
Project string `json:"project"`
Key string `json:"operation_key"`
Model EmbeddingModel `json:"model"`
ThroughOffset int64 `json:"through_offset"`
InitialThroughOffset int64 `json:"initial_through_offset"`
CoveredThroughOffset int64 `json:"covered_through_offset"`
After ChunkRecoveryCursor `json:"after"`
State string `json:"state"`
Active bool `json:"active"`
Examined int64 `json:"examined"`
Stored int64 `json:"stored"`
CreatedAt time.Time `json:"created_at"`
}
type MessageEmbeddingStore
type MessageEmbeddingStore struct {
pool *pgxpool.Pool
schema Schema
}
func NewMessageEmbeddingStore
func NewMessageEmbeddingStore(pool *pgxpool.Pool, schema Schema) *MessageEmbeddingStore
func validEmbeddingIDs
func validEmbeddingIDs(scope string, ids ...string) error