Documentation ¶
Overview ¶
Package pinecone implements a genkit plugin for the Pinecone vector database. This defines an indexer and 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 IndexerOptions or RetrieverOptions. If the namespace is not specified the code uses the default namespace.
Index ¶
- func DefineIndexer(ctx context.Context, cfg Config) (ai.Indexer, error)
- func DefineRetriever(ctx context.Context, cfg Config) (ai.Retriever, error)
- func Indexer(name string) ai.Indexer
- func Init(ctx context.Context, apiKey string) (err error)
- func IsDefinedIndexer(name string) bool
- func IsDefinedRetriever(name string) bool
- func Retriever(name string) ai.Retriever
- type Config
- type IndexerOptions
- type RetrieverOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineIndexer ¶
DefineIndexer defines an Indexer with the given configuration.
func DefineRetriever ¶
DefineRetriever defines a Retriever with the given configuration.
func Init ¶
Init initializes the Pinecone plugin. If apiKey is the empty string, it is read from the PINECONE_API_KEY environment variable.
func IsDefinedIndexer ¶ added in v0.1.0
IsDefinedIndexer reports whether the named Indexer is defined by this plugin.
func IsDefinedRetriever ¶ added in v0.1.0
IsDefinedRetriever reports whether the named Retriever is defined by this plugin.
Types ¶
type Config ¶
type Config struct { // The index ID to use. IndexID string // Embedder to use. Required. Embedder ai.Embedder EmbedderOptions any // The metadata key to use to store document text // in Pinecone; the default is "_content". TextKey string }
Config provides configuration options for DefineIndexer and DefineRetriever.
type IndexerOptions ¶
type IndexerOptions struct {
Namespace string `json:"namespace,omitempty"` // Pinecone namespace to use
}
IndexerOptions may be passed in the Options field of ai.IndexerRequest to pass options to Pinecone. The Options field should be either nil or a value of type *IndexerOptions.
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.