You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: options.go
    path of file: ./repos/langchaingo/vectorstores/pinecone
    
    the code of the file until where you have to start completion: package pinecone

import (
	"errors"
	"fmt"
	"os"

	"github.com/tmc/langchaingo/embeddings"
)

const (
	_pineconeEnvVrName = "PINECONE_API_KEY"
	_defaultTextKey    = "text"
)

// ErrInvalidOptions is returned when the options given are invalid.
var ErrInvalidOptions = errors.New("invalid options")

// Option is a function type that can be used to modify the client.
type Option func(p *Store)

// WithIndexName is an option for specifying the index name. Must be set.
func WithIndexName(name string) Option {
	return func(p *Store) {
		p.indexName = name
    
func applyClientOptions(opts ...Option) (Store, error) {
	o := &Store{
		textKey: _defaultTextKey,
	}

	for _, opt := range opts {
		opt(o)
	}

	if o.indexName == "" {
		return Store{}, fmt.Errorf("%w: missing index name", ErrInvalidOptions)
	}

	if o.environment == "" {
		return Store{}, fmt.Errorf("%w: missing environment", ErrInvalidOptions)
	}

	if o.projectName == "" {
		return Store{}, fmt.Errorf("%w: missing project name", ErrInvalidOptions)
	}

	if o.embedder == nil {
		return Store{}, fmt.Errorf("%w: missing embedder", ErrInvalidOptions)
	}

	if o.apiKey == "" {
		o.apiKey = os.Getenv(_pineconeEnvVrName)
		if o.apiKey == "" {
			return Store{}, fmt.Errorf(
				"%w: missing api key. Pass it as an option or set the %s environment variable",
				ErrInvalidOptions,
				_pineconeEnvVrName,
			)
		}
	}

	return *o, nil
}