Forge documentation
Library referenceGo

github.com/l1fe-labs/forge-go/embed

Go embed package.

Go embed package.

Package contract

FieldValue
Languagego
Source versionmodule source snapshot
Manifestforge-go/go.mod
Source files7
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

import "github.com/l1fe-labs/forge-go/embed"

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

chunking.go

Read declaration text · 7 declaration entries

type TextSplitter interface

type RecursiveCharacterSplitter struct

func NewRecursiveCharacterSplitter(chunkSize, chunkOverlap int) *RecursiveCharacterSplitter

func (s *RecursiveCharacterSplitter) Split(text string) []string

type TokenSplitter struct

func NewTokenSplitter(maxTokens, tokenOverlap int) *TokenSplitter

func (s *TokenSplitter) Split(text string) []string

document.go

Read declaration text · 9 declaration entries

type Document struct

func NewDocument(content string, metadata json.RawMessage) Document

type DocumentLoader interface

type TextLoader struct

func NewTextLoader(text string, metadata json.RawMessage) *TextLoader

func (l *TextLoader) Load(_ context.Context) ([]Document, error)

type JsonLoader struct

func NewJsonLoader(data, contentField string) *JsonLoader

func (l *JsonLoader) Load(_ context.Context) ([]Document, error)

embed.go

Read declaration text · 4 declaration entries

type EmbeddingProvider interface

type EmbeddingResult struct

func Embed(ctx context.Context, provider EmbeddingProvider, text string) (*EmbeddingResult, error)

func EmbedMany(ctx context.Context, provider EmbeddingProvider, texts []string) (*EmbeddingResult, error)

error.go

Read declaration text · 10 declaration entries

type ErrKind string

const (
// ErrKindModel indicates a model/provider error during embedding or reranking.
ErrKindModel ErrKind;

type EmbedError struct

func (e *EmbedError) Error() string

func (e *EmbedError) Unwrap() error

func (e *EmbedError) Is(target error) bool

func NewModelError(model, message string, cause error) *EmbedError

func NewDimensionMismatchError(expected, got int) *EmbedError

func NewEmptyInputError(operation string) *EmbedError

func NewStoreError(operation, message string, cause error) *EmbedError

func NewChunkingError(message string) *EmbedError

rerank.go

Read declaration text · 5 declaration entries

type Reranker interface

type RerankResult struct

type EmbeddingReranker struct

func NewEmbeddingReranker(provider EmbeddingProvider) *EmbeddingReranker

func (r *EmbeddingReranker) Rerank(ctx context.Context, query string, documents []string, topK int) ([]RerankResult, error)

similarity.go

Read declaration text · 3 declaration entries

func CosineSimilarity(a, b []float64) (float64, error)

func EuclideanDistance(a, b []float64) (float64, error)

func DotProduct(a, b []float64) (float64, error)

vector_store.go

Read declaration text · 9 declaration entries

type VectorStore interface

type VectorEntry struct

type SearchResult struct

type InMemoryVectorStore struct

func NewInMemoryVectorStore() *InMemoryVectorStore

func (s *InMemoryVectorStore) Insert(_ context.Context, entry VectorEntry) error

func (s *InMemoryVectorStore) Search(_ context.Context, query []float64, topK int) ([]SearchResult, error)

func (s *InMemoryVectorStore) Delete(_ context.Context, id string) error

func (s *InMemoryVectorStore) Len() int

Continue

On this page