pinecone

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package pinecone implements a genkit plugin for the Pinecone vector database. This defines a retriever.

Accessing Pinecone requires an API key, passed via Config. If the API key is the empty string, the plugin will use the PINECONE_API_KEY environment variable.

All Pinecone data is stored in what Pinecone calls an index. The Pinecone plugin supports a single index, passed via Config.

Indexes can be partitioned into namespaces. Operations that use indexes pass a namespace argument, via RetrieverOptions. If the namespace is not specified the code uses the default namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index added in v0.6.0

func Index(ctx context.Context, docs []*ai.Document, ds *Docstore, namespace string) error

Helper function to get started with indexing

func IsDefinedRetriever added in v0.1.0

func IsDefinedRetriever(g *genkit.Genkit, name string) bool

IsDefinedRetriever reports whether the named Retriever is defined by this plugin.

func Retriever

func Retriever(g *genkit.Genkit, name string) ai.Retriever

Retriever returns the retriever with the given index name.

Types

type Config

type Config struct {
	IndexID         string      // The index ID to use.
	Embedder        ai.Embedder // Embedder to use. Required.
	EmbedderOptions any         // Options to pass to the embedder.
	TextKey         string      // Metadata key to use to store document text in Pinecone; the default is "_content".
}

Config provides configuration options for DefineRetriever.

type Docstore added in v0.6.0

type Docstore struct {
	Index           *index
	Embedder        ai.Embedder
	EmbedderOptions any
	TextKey         string
}

Docstore implements the genkit ai.DocumentStore interface.

func DefineRetriever

func DefineRetriever(ctx context.Context, g *genkit.Genkit, cfg Config) (*Docstore, ai.Retriever, error)

DefineRetriever defines a Retriever with the given configuration.

func (*Docstore) Retrieve added in v0.6.0

func (ds *Docstore) Retrieve(ctx context.Context, req *ai.RetrieverRequest) (*ai.RetrieverResponse, error)

Retrieve implements the genkit Retriever.Retrieve method.

type Pinecone added in v0.3.0

type Pinecone struct {
	APIKey string // API key to use for Pinecone requests.
	// contains filtered or unexported fields
}

func (*Pinecone) Init added in v0.3.0

func (p *Pinecone) Init(ctx context.Context, g *genkit.Genkit) (err error)

Init initializes the Pinecone plugin. If apiKey is the empty string, it is read from the PINECONE_API_KEY environment variable.

func (*Pinecone) Name added in v0.6.0

func (p *Pinecone) Name() string

Name returns the name of the plugin.

type RetrieverOptions

type RetrieverOptions struct {
	Namespace string `json:"namespace,omitempty"` // Pinecone namespace to use
	Count     int    `json:"count,omitempty"`     // maximum number of values to retrieve
}

RetrieverOptions may be passed in the Options field of ai.RetrieverRequest to pass options to Pinecone. The Options field should be either nil or a value of type *RetrieverOptions.

Jump to

Keyboard shortcuts

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