nomic

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package nomic wraps Nomic Atlas' embedding API. Nomic publishes open-weight, matryoshka-trained, task-conditioned text embedders (nomic-embed-text-v1.5 / v1) behind a managed REST surface.

Nomic-specific knobs that don't fit the generic surface — task_type (search_query / search_document / classification / clustering for asymmetric retrieval and downstream tasks) and long_text_mode — are reached via the extension-threaded SDK params, see [EmbeddingRequest] and EmbeddingRequestExtensionKey.

Nomic's /embedding/text request shape uses `texts` (not OpenAI's `input`), `task_type` (not `input_type`), and `dimensionality` (not `dimensions` / `output_dimension`); this package implements embedding.Model directly against the native API.

See https://docs.nomic.ai/reference/endpoints/nomic-embed-text for the full reference.

Index

Constants

View Source
const (
	Provider = "Nomic"

	EmbeddingRequestExtensionKey = "nomic/embedding_request"

	DefaultBaseURL = "https://api-atlas.nomic.ai/v1"
)

Exported identifiers keep provider-owned names and defaults out of caller literals.

View Source
const (
	ModelEmbedTextV15 = "nomic-embed-text-v1.5"
	ModelEmbedTextV1  = "nomic-embed-text-v1"
)

See https://docs.nomic.ai/reference/endpoints/nomic-embed-text for the current catalog.

View Source
const (
	TaskTypeSearchQuery    = "search_query"
	TaskTypeSearchDocument = "search_document"
	TaskTypeClassification = "classification"
	TaskTypeClustering     = "clustering"
)

Task types condition the encoder for asymmetric retrieval — pick search_query for the query side, search_document for the corpus side.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddingModel

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

EmbeddingModel implements the Core embedding contract with Nomic.

func NewEmbeddingModel

func NewEmbeddingModel(_ context.Context, config EmbeddingModelConfig) (*EmbeddingModel, error)

NewEmbeddingModel rejects an invalid provider binding before the first embedding call.

func (*EmbeddingModel) Call

func (e *EmbeddingModel) Call(ctx context.Context, req *embedding.Request) (response *embedding.Response, err error)

type EmbeddingModelConfig

type EmbeddingModelConfig struct {
	APIKey         string
	DefaultOptions embedding.Options
	BaseURL        string
	HTTPClient     *http.Client
}

EmbeddingModelConfig binds provider access and defaults shared by every embedding call.

func (EmbeddingModelConfig) Validate

func (e EmbeddingModelConfig) Validate() error

Jump to

Keyboard shortcuts

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