pinecone

package module
v0.11.0 Latest Latest
Warning

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

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

README

pinecone

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.

Install

go get github.com/Tangerg/scope/vectorstores/pinecone

Constructors

Every constructor validates its config and returns a value implementing the capability interfaces in core/vectorstore:

  • NewStore

Testing

This module integrates a third-party service, so its tests cover what runs without live credentials: config validation, request and response mapping, and error classification. The shared conformance contract is core/vectorstore/storetest — this module runs it rather than copying it.

An integration probe skips unless its credential environment variable is set, so go test ./... is always runnable offline.

Boundaries

This is an independent leaf module: it carries only its own SDK dependency and never imports a sibling provider. The shared contract every module in this family obeys is in ../ARCHITECTURE.md.

See ARCHITECTURE.md for what this module owns.

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"
)

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"
)

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
}

func NewStore

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

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