llm

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embeddings

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

func NewEmbeddings

func NewEmbeddings(workerURL string) *Embeddings

NewEmbeddings creates a new Embeddings instance with the Cloudflare Worker URL.

func (*Embeddings) GenerateEmbeddings

func (e *Embeddings) GenerateEmbeddings(content string) ([]float32, error)

GenerateEmbeddings sends text to the Cloudflare Worker and returns embeddings.

func (*Embeddings) GetSimilarity

func (e *Embeddings) GetSimilarity(queryEmbedding []float32, contentEmbedding []float32) (float64, error)

GetSimilarity computes similarity between a query and precomputed embeddings.

func (*Embeddings) Marshal

func (e *Embeddings) Marshal(embeddings []float32) (string, error)

Marshal serializes embeddings to JSON string.

func (*Embeddings) Unmarshal

func (e *Embeddings) Unmarshal(data string) ([]float32, error)

Unmarshal deserializes JSON string to embeddings.

Jump to

Keyboard shortcuts

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