pinecone

package
v0.0.102 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Upsert(ctx context.Context, req *UpsertRequest) (*UpsertResponse, error)
	Fetch(ctx context.Context, req *FetchRequest) (*FetchResponse, error)
	Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)
	Close() error
}

func New

func New(apiKey string, endpoint Endpoint, optFns ...func(o *Options)) (Client, error)

type Endpoint

type Endpoint struct {
	IndexName   string
	ProjectName string
	Environment string
}

func (*Endpoint) String

func (e *Endpoint) String() string

type ErrorResponse added in v0.0.64

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type FetchRequest

type FetchRequest struct {
	IDs       []string `json:"ids"`
	Namespace string   `json:"namespace"`
}

FetchRequest represents the parameters for a fetch vectors request. https://docs.pinecone.io/reference/fetch for more informations.

type FetchResponse

type FetchResponse struct {
	Vectors   map[string]*Vector `json:"vectors"`
	Namespace string             `json:"namespace"`
}

FetchResponse represents the response from a fetch vectors request.

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

func NewGRPCClient

func NewGRPCClient(apiKey string, endpoint Endpoint) (*GRPCClient, error)

func (*GRPCClient) Close

func (p *GRPCClient) Close() error

func (*GRPCClient) Fetch

func (p *GRPCClient) Fetch(ctx context.Context, req *FetchRequest) (*FetchResponse, error)

func (*GRPCClient) Query

func (p *GRPCClient) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)

func (*GRPCClient) Upsert

func (p *GRPCClient) Upsert(ctx context.Context, req *UpsertRequest) (*UpsertResponse, error)

type Match

type Match struct {
	ID       string         `json:"id"`
	Values   []float32      `json:"values"`
	Metadata map[string]any `json:"metadata"`
	Score    float64        `json:"score"`
}

type Options

type Options struct {
	UseGRPC bool
}

type QueryRequest

type QueryRequest struct {
	Filter          map[string]any `json:"filter"`
	IncludeValues   bool           `json:"includeValues"`
	IncludeMetadata bool           `json:"includeMetadata"`
	Vector          []float32      `json:"vector"`
	Namespace       string         `json:"namespace"`
	TopK            int64          `json:"topK"`
	ID              string         `json:"id"`
}

QueryRequest represents the parameters for a query request. See https://docs.pinecone.io/reference/query for more information.

type QueryResponse

type QueryResponse struct {
	Matches   []*Match `json:"matches"`
	Namespace string   `json:"namespace"`
}

QueryResponse represents the response from a query request.

type RestClient

type RestClient struct {
	// contains filtered or unexported fields
}

func NewRestClient

func NewRestClient(apiKey string, endpoint Endpoint) (*RestClient, error)

func (*RestClient) Close added in v0.0.13

func (p *RestClient) Close() error

func (*RestClient) Fetch

func (p *RestClient) Fetch(ctx context.Context, req *FetchRequest) (*FetchResponse, error)

func (*RestClient) Query

func (p *RestClient) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)

func (*RestClient) Upsert

func (p *RestClient) Upsert(ctx context.Context, req *UpsertRequest) (*UpsertResponse, error)

type UpsertRequest

type UpsertRequest struct {
	Vectors   []*Vector `json:"vectors"`
	Namespace string    `json:"namespace"`
}

UpsertRequest represents the parameters for an upsert vectors request. See https://docs.pinecone.io/reference/upsert for more informations.

type UpsertResponse

type UpsertResponse struct {
	UpsertedCount uint32 `json:"upsertedCount"`
}

UpsertResponse represents the response from an upsert vectors request.

type Vector

type Vector struct {
	ID       string         `json:"id"`
	Values   []float32      `json:"values"`
	Metadata map[string]any `json:"metadata"`
}

func ToPineconeVectors

func ToPineconeVectors(vectors [][]float32, metadata []map[string]any) ([]*Vector, error)

Jump to

Keyboard shortcuts

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