pinecone

package module
v0.15.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pinecone exposes Pinecone through the Core vector-store capability interfaces. Documents are stored as vectors in a Pinecone index (`{id, values, metadata}`); retrieval runs the index's similarity query.

Requirements: a Pinecone account and an existing index (created via the Pinecone console or control-plane API — Pinecone does not allow lazy index creation from the data plane). The store uses the official pinecone-io/go-pinecone v4 client.

Vector similarity. Pinecone configures cosine / dotproduct / euclidean at index-creation time; the store reads but does not override.

Filter visitor produces Pinecone's metadata-filter syntax — `{"author": {"$eq": "Alice"}}`, `{"$and": [...]}`, `{"$in": [...]}`. The result feeds the `Filter` field of the query request. Pinecone has no native LIKE / regex; the visitor rejects filter.OpLike expressions explicitly.

Document text. Pinecone itself stores only id + vector + flat metadata — there is no first-class text body. The store always stashes the original document text under a reserved metadata key; retrieval reverses the mapping back into document.Document.Text.

See https://docs.pinecone.io/ for the full API surface.

Index

Constants

View Source
const (
	Provider = "Pinecone"
)

Provider is the stable backend name for host-side attribution.

Variables

View Source
var (
	ErrMissingClient = errors.New("pinecone: Client is required")

	ErrMissingIndexHost = errors.New("pinecone: IndexHost is required")

	ErrMissingEmbeddingModel = errors.New("pinecone: EmbeddingModel is required")

	ErrMissingDocumentBatcher = errors.New("pinecone: DocumentBatcher is required")

	ErrMissingDistanceMetric = errors.New("pinecone: DistanceMetric is required")
)

Functions

This section is empty.

Types

type DistanceMetric

type DistanceMetric string

DistanceMetric records the similarity metric configured on the existing Pinecone index. The data-plane connection does not expose index metadata.

const (
	DistanceCosine    DistanceMetric = "cosine"
	DistanceDot       DistanceMetric = "dotproduct"
	DistanceEuclidean DistanceMetric = "euclidean"
)

The metric is a closed vocabulary because score direction and threshold semantics depend on it: the same raw number means "near" under one metric and "far" under another, so an unrecognized value must be rejected rather than guessed.

func (DistanceMetric) String

func (d DistanceMetric) String() string

func (DistanceMetric) Valid

func (d DistanceMetric) Valid() bool

type Store

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

Store implements vectorstore.Store against a Pinecone index. Pinecone owns index creation and dimensionality, so this type validates against the index it is pointed at rather than provisioning one.

func NewStore

func NewStore(config StoreConfig) (*Store, error)

NewStore needs no context because construction performs no I/O; the index is provisioned outside this package, so the store only validates configuration and assembles state.

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteIDs

func (s *Store) DeleteIDs(ctx context.Context, ids []string) (err error)

DeleteIDs removes vectors by their string ids. An empty slice is a no-op; unknown ids are silently ignored (idempotent). Implements vectorstore.IDDeleter.

func (*Store) DeleteWhere

func (s *Store) DeleteWhere(ctx context.Context, expr filter.Predicate) (err error)

func (*Store) Index

func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) (err error)

func (*Store) Search

func (s *Store) Search(ctx context.Context, req *vectorstore.SearchRequest) (response *vectorstore.SearchResponse, err error)

type StoreConfig

type StoreConfig struct {
	// Client is the Pinecone client instance.
	// Required: must be provided, otherwise initialization will fail.
	Client *pinecone.Client

	// IndexHost is the host URL of the Pinecone index.
	// Required: must be a non-empty string.
	// Obtain it from DescribeIndex or the Pinecone web console.
	IndexHost string

	// Namespace is the index namespace to use for all operations.
	// Optional: defaults to the default namespace if empty.
	Namespace string

	// EmbeddingModel is the model used to generate vector embeddings from text.
	// Required: must be provided.
	EmbeddingModel embedding.Model

	// DocumentBatcher is responsible for batching documents before insertion.
	// Required: must be provided.
	DocumentBatcher vectorstore.Batcher

	// DistanceMetric must match the metric used when the index was created.
	// Required because Pinecone returns metric-specific raw scores.
	DistanceMetric DistanceMetric
}

StoreConfig contains configuration options for Pinecone vector store.

func (StoreConfig) Validate

func (s StoreConfig) Validate() error

Jump to

Keyboard shortcuts

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