embed

package
v1.0.43 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Retrieval tasks
	TaskRetrievalQuery   = "retrieval.query"   // For search queries
	TaskRetrievalPassage = "retrieval.passage" // For documents to be retrieved

	// Code-related tasks
	TaskCodeQuery   = "code.query"   // For code search queries
	TaskCodePassage = "code.passage" // For code snippets to be retrieved

	// Text matching and similarity
	TaskTextMatching = "text-matching" // For semantic similarity tasks

	// Additional tasks (mapped to closest Jina equivalent)
	TaskClassification    = "classification"     // For classification tasks
	TaskClustering        = "clustering"         // For clustering tasks
	TaskQuestionAnswering = "question-answering" // For Q&A tasks
	TaskFactVerification  = "fact-verification"  // For fact checking
)

Task name constants (using Jina AI naming convention as standard)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbedOption

type EmbedOption func(*settings)

func WithClassificationTask added in v1.0.41

func WithClassificationTask() EmbedOption

func WithClusteringTask added in v1.0.41

func WithClusteringTask() EmbedOption

func WithCodePassageTask added in v1.0.41

func WithCodePassageTask() EmbedOption

func WithCodeQueryTask added in v1.0.41

func WithCodeQueryTask() EmbedOption

func WithFactVerificationTask added in v1.0.41

func WithFactVerificationTask() EmbedOption

func WithKeepAlive

func WithKeepAlive(d time.Duration) EmbedOption

---- ollama-specific helpers ----

func WithLateChunking added in v1.0.41

func WithLateChunking(enabled bool) EmbedOption

func WithModel

func WithModel(name string) EmbedOption

---- provider-agnostic helpers ----

func WithQuestionAnsweringTask added in v1.0.41

func WithQuestionAnsweringTask() EmbedOption

func WithRetrievalPassageTask added in v1.0.41

func WithRetrievalPassageTask() EmbedOption

func WithRetrievalQueryTask added in v1.0.41

func WithRetrievalQueryTask() EmbedOption

Task-specific helper functions for common use cases

func WithReturnMultivector added in v1.0.41

func WithReturnMultivector(enabled bool) EmbedOption

func WithTask

func WithTask(name string) EmbedOption

---- Jina & Gemini task helpers ----

func WithTextMatchingTask added in v1.0.41

func WithTextMatchingTask() EmbedOption

type Embedder

type Embedder interface {
	// GetEmbedding returns a channel that will receive the vector(s)
	// or an error.  Any provider-specific knobs are supplied as options.
	GetEmbedding(
		ctx context.Context,
		text string,
		opts ...EmbedOption,
	) <-chan async.Result[[]float32]
}

func ProvideGeminiEmbeddingClient added in v1.0.40

func ProvideGeminiEmbeddingClient() Embedder

func ProvideJinaAIEmbeddingClient

func ProvideJinaAIEmbeddingClient() Embedder

func ProvideOllamaEmbeddingClient

func ProvideOllamaEmbeddingClient() Embedder

type GeminiEmbeddingClient added in v1.0.40

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

func (*GeminiEmbeddingClient) GetEmbedding added in v1.0.40

func (c *GeminiEmbeddingClient) GetEmbedding(ctx context.Context, text string, opts ...EmbedOption) <-chan async.Result[[]float32]

type JinaAIEmbeddingClient

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

func (*JinaAIEmbeddingClient) GetEmbedding

func (c *JinaAIEmbeddingClient) GetEmbedding(ctx context.Context, text string, opts ...EmbedOption) <-chan async.Result[[]float32]

type OllamaEmbeddingClient

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

func (*OllamaEmbeddingClient) GetEmbedding

func (c *OllamaEmbeddingClient) GetEmbedding(ctx context.Context, text string, opts ...EmbedOption) <-chan async.Result[[]float32]

Jump to

Keyboard shortcuts

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