Documentation ¶
Overview ¶
Package pinecone contains an implementation of the vectorStore interface using pinecone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingTextKey is returned in SimilaritySearch if a vector // from the query is missing the text key. ErrMissingTextKey = errors.New("missing text key in vector metadata") // ErrEmbedderWrongNumberVectors is returned when if the embedder returns a number // of vectors that is not equal to the number of documents given. ErrEmbedderWrongNumberVectors = errors.New( "number of vectors from embedder does not match number of documents", ) // ErrEmptyResponse is returned if the API gives an empty response. ErrEmptyResponse = errors.New("empty response") ErrInvalidScoreThreshold = errors.New( "score threshold must be between 0 and 1") )
var ErrInvalidOptions = errors.New("invalid options")
ErrInvalidOptions is returned when the options given are invalid.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(p *Store)
Option is a function type that can be used to modify the client.
func WithAPIKey ¶
WithAPIKey is an option for setting the api key. If the option is not set the api key is read from the PINECONE_API_KEY environment variable. If the variable is not present, an error will be returned.
func WithEmbedder ¶
func WithEmbedder(e embeddings.Embedder) Option
WithEmbedder is an option for setting the embedder to use. Must be set.
func WithEnvironment ¶
WithEnvironment is an option for specifying the environment. Must be set.
func WithIndexName ¶
WithIndexName is an option for specifying the index name. Must be set.
func WithNameSpace ¶
NameSpace is an option for setting the nameSpace to upsert and query the vectors from. Must be set.
func WithProjectName ¶
WithProjectName is an option for specifying the project name. Must be set. The project name associated with the api key can be obtained using the whoami operation.
func WithTextKey ¶
WithTextKey is an option for setting the text key in the metadata to the vectors in the index. The text key stores the text of the document the vector represents.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a wrapper around the pinecone rest API and grpc client.
func New ¶
New creates a new Store with options. Options for index name, environment, project name and embedder must be set.
func (Store) AddDocuments ¶
func (s Store) AddDocuments(ctx context.Context, docs []schema.Document, options ...vectorstores.Option) error
AddDocuments creates vector embeddings from the documents using the embedder and upsert the vectors to the pinecone index.
func (Store) SimilaritySearch ¶
func (s Store) SimilaritySearch(ctx context.Context, query string, numDocuments int, options ...vectorstores.Option) ([]schema.Document, error)
SimilaritySearch creates a vector embedding from the query using the embedder and queries to find the most similar documents.