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
- Variables
- type DistanceMetric
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteIDs(ctx context.Context, ids []string) (err error)
- func (s *Store) DeleteWhere(ctx context.Context, expr filter.Predicate) (err error)
- func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) (err error)
- func (s *Store) Search(ctx context.Context, req *vectorstore.SearchRequest) (response *vectorstore.SearchResponse, err error)
- type StoreConfig
Constants ¶
const (
Provider = "Pinecone"
)
Variables ¶
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) DeleteIDs ¶
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 (*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