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, g *genkit.Genkit, cfg Config) (ai.Indexer, error)
- func DefineRetriever(ctx context.Context, g *genkit.Genkit, cfg Config) (ai.Retriever, error)
- func Indexer(g *genkit.Genkit, name string) ai.Indexer
- func IsDefinedIndexer(g *genkit.Genkit, name string) bool
- func IsDefinedRetriever(g *genkit.Genkit, name string) bool
- func Retriever(g *genkit.Genkit, name string) ai.Retriever
- type Config
- type IndexerOptions
- type Pinecone
- 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 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 { 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 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 Pinecone ¶ added in v0.3.0
type Pinecone struct { APIKey string // API key to use for Pinecone requests. // contains filtered or unexported fields }
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.