Documentation ¶
Index ¶
- Variables
- type CallOptions
- type Client
- func (c *Client) ConfigureIndex(ctx context.Context, params ConfigureIndexParams) error
- func (c *Client) CreateIndex(ctx context.Context, params CreateIndexParams) error
- func (c *Client) Debug() *Client
- func (c *Client) DeleteIndex(ctx context.Context, indexName string) error
- func (c *Client) DescribeIndex(ctx context.Context, indexName string) (*DescribeIndexResponse, error)
- func (c *Client) ListIndexes() ([]string, error)
- type ConfigureIndexBodyParams
- type ConfigureIndexParams
- type CreateIndexBodyParams
- type CreateIndexMetric
- type CreateIndexParams
- type CreateIndexPodSize
- type CreateIndexPodType
- type Database
- type DeleteVectorsParams
- type DescribeIndexResponse
- type DescribeIndexStatsParams
- type DescribeIndexStatsResponse
- type FetchVectorsParams
- type FetchVectorsResponse
- type IndexClient
- func (ic *IndexClient) Debug() *IndexClient
- func (ic *IndexClient) DeleteVectors(ctx context.Context, params DeleteVectorsParams) error
- func (ic *IndexClient) DescribeIndexStats(ctx context.Context, params DescribeIndexStatsParams) (*DescribeIndexStatsResponse, error)
- func (ic *IndexClient) FetchVectors(ctx context.Context, params FetchVectorsParams) (*FetchVectorsResponse, error)
- func (ic *IndexClient) Query(ctx context.Context, params QueryParams) (*QueryResponse, error)
- func (ic *IndexClient) UpdateVector(ctx context.Context, params UpdateVectorParams) error
- func (ic *IndexClient) UpsertVectors(ctx context.Context, params UpsertVectorsParams) (*UpsertVectorsResponse, error)
- type QueryParams
- type QueryResponse
- type QueryVector
- type SparseVector
- type Status
- type UpdateVectorParams
- type UpsertVectorsParams
- type UpsertVectorsResponse
- type Vector
- type VectorCount
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRequestFailed is returned and wrapped when a request to the Pinecone API fails. ErrRequestFailed = errors.New("request failed") // ErrIndexNotFound is returned when an index is not found. ErrIndexNotFound = errors.New("index not found") // ErrInvalidParams is returned when an invalid parameter is passed to a function. ErrInvalidParams = errors.New("invalid params") )
Functions ¶
This section is empty.
Types ¶
type CallOptions ¶
type CallOptions struct {
// contains filtered or unexported fields
}
func WithAPIKey ¶
func WithAPIKey(apiKey string) CallOptions
WithAPIKey sets the API key to use for the call.
func WithEnvironment ¶
func WithEnvironment(environment string) CallOptions
WithEnvironment sets the environment to use for the call.
func WithIndexName ¶
func WithIndexName(indexName string) CallOptions
func WithProjectName ¶
func WithProjectName(projectName string) CallOptions
WithProjectName sets the project name to use for the call.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main entry point for the Pinecone API.
func (*Client) ConfigureIndex ¶
func (c *Client) ConfigureIndex(ctx context.Context, params ConfigureIndexParams) error
ConfigureIndex specifies the pod type and number of replicas for an index.
API Reference: https://docs.pinecone.io/reference/configure_index
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(ctx context.Context, params CreateIndexParams) error
CreateIndex creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of replicas to use, and more.
API Reference: https://docs.pinecone.io/reference/create_index
func (*Client) DeleteIndex ¶
DeleteIndex deletes an existing index.
API Reference: https://docs.pinecone.io/reference/delete_index
func (*Client) DescribeIndex ¶
func (c *Client) DescribeIndex(ctx context.Context, indexName string) (*DescribeIndexResponse, error)
DescribeIndex gets a description of an index.
API Reference: https://docs.pinecone.io/reference/describe_index
func (*Client) ListIndexes ¶
ListIndexes returns a list of your Pinecone indexes.
API Reference: https://docs.pinecone.io/reference/list_indexes
type ConfigureIndexParams ¶
type ConfigureIndexParams struct { // The name of the index IndexName string // The number of replicas. Replicas duplicate // your index. They provide higher availability // and throughput. Replicas mo.Option[int] // The type of pod to use. One of s1, p1, or p2 PodType mo.Option[CreateIndexPodType] PodSize mo.Option[CreateIndexPodSize] }
type CreateIndexBodyParams ¶
type CreateIndexBodyParams struct { Name string `json:"name"` Dimension int `json:"dimension"` Metric *CreateIndexMetric `json:"metric,omitempty"` Pods *int `json:"pods,omitempty"` Replicas *int `json:"replicas,omitempty"` PodType *string `json:"pod_type,omitempty"` MetadataConfig map[string]string `json:"metadata_config,omitempty"` SourceCollection *string `json:"source_collection,omitempty"` }
type CreateIndexMetric ¶
type CreateIndexMetric string
const ( CreateIndexMetricEuclidean CreateIndexMetric = "euclidean" CreateIndexMetricCosine CreateIndexMetric = "cosine" CreateIndexMetricDotProduct CreateIndexMetric = "dotproduct" )
type CreateIndexParams ¶
type CreateIndexParams struct { // Required. The name of the index to be created. // The maximum length is 45 characters. Name string // Required. The dimensions of the vectors to be // inserted in the index Dimension int // The distance metric to be used for similarity // search. You can use 'euclidean', 'cosine', or // 'dotproduct'. Metric mo.Option[CreateIndexMetric] // The number of pods for the index to use, // including replicas. Pods mo.Option[int] // The number of replicas. Replicas duplicate // your index. They provide higher availability // and throughput. Replicas mo.Option[int] // The type of pod to use. One of s1, p1, or p2 PodType mo.Option[CreateIndexPodType] PodSize mo.Option[CreateIndexPodSize] // Configuration for the behavior of Pinecone's // internal metadata index. By default, all // metadata is indexed; when metadata_config is // present, only specified metadata fields are // indexed. To specify metadata fields to index, // provide a JSON object of the following form: // {"indexed": ["example_metadata_field"]} MetadataConfig mo.Option[map[string]string] // The name of the collection to create an index // from SourceCollection mo.Option[string] }
type CreateIndexPodSize ¶
type CreateIndexPodSize string
const ( CreateIndexPodSize1 CreateIndexPodSize = "1" CreateIndexPodSize2 CreateIndexPodSize = "2" CreateIndexPodSize4 CreateIndexPodSize = "4" CreateIndexPodSize8 CreateIndexPodSize = "8" )
type CreateIndexPodType ¶
type CreateIndexPodType string
const ( CreateIndexPodTypeS1 CreateIndexPodType = "s1" CreateIndexPodTypeP1 CreateIndexPodType = "p1" CreateIndexPodTypeP2 CreateIndexPodType = "p2" )
type DeleteVectorsParams ¶
type DeleteVectorsParams struct { IDs []string `json:"ids"` Namespace string `json:"namespace"` DeleteAll bool `json:"deleteAll"` Filter map[string]any `json:"filter"` }
DeleteVectorsParams represents the parameters for a delete vectors request. See https://docs.pinecone.io/reference/delete_post for more information.
type DescribeIndexResponse ¶
type DescribeIndexStatsParams ¶
DescribeIndexStatsParams represents the parameters for a describe index stats request.
type DescribeIndexStatsResponse ¶
type DescribeIndexStatsResponse struct { Namespaces map[string]*VectorCount `json:"namespaces"` Dimensions int64 `json:"dimensions"` IndexFullness float32 `json:"indexFullness"` TotalVectorCount int64 `json:"totalVectorCount"` }
DescribeIndexStatsResponse represents the response from a describe index stats request.
type FetchVectorsParams ¶
FetchVectorsParams represents the parameters for a fetch vectors request.
type FetchVectorsResponse ¶
type FetchVectorsResponse struct { Vectors map[string]*Vector `json:"vectors"` Namespace string `json:"namespace"` }
FetchVectorsResponse represents the response from a fetch vectors request.
type IndexClient ¶
type IndexClient struct {
// contains filtered or unexported fields
}
IndexClient client for vector operations
func NewIndexClient ¶
func NewIndexClient(opts ...CallOptions) (*IndexClient, error)
func (*IndexClient) Debug ¶
func (ic *IndexClient) Debug() *IndexClient
func (*IndexClient) DeleteVectors ¶
func (ic *IndexClient) DeleteVectors(ctx context.Context, params DeleteVectorsParams) error
DeleteVectors performs a delete vectors request. returns an error if the request fails and nil otherwise.
func (*IndexClient) DescribeIndexStats ¶
func (ic *IndexClient) DescribeIndexStats(ctx context.Context, params DescribeIndexStatsParams) (*DescribeIndexStatsResponse, error)
DescribeIndexStats returns the index stats for the given index.
func (*IndexClient) FetchVectors ¶
func (ic *IndexClient) FetchVectors(ctx context.Context, params FetchVectorsParams) (*FetchVectorsResponse, error)
FetchVectors performs a fetch vectors request. See https://docs.pinecone.io/reference/fetch for more information.
func (*IndexClient) Query ¶
func (ic *IndexClient) Query(ctx context.Context, params QueryParams) (*QueryResponse, error)
Query performs a query request.
func (*IndexClient) UpdateVector ¶
func (ic *IndexClient) UpdateVector(ctx context.Context, params UpdateVectorParams) error
UpdateVector performs an update vector request. See https://docs.pinecone.io/reference/update for more information.
func (*IndexClient) UpsertVectors ¶
func (ic *IndexClient) UpsertVectors(ctx context.Context, params UpsertVectorsParams) (*UpsertVectorsResponse, error)
UpsertVectors performs an upsert vectors request. See https://docs.pinecone.io/reference/upsert for more information.
type QueryParams ¶
type QueryParams struct { Filter map[string]any `json:"filter"` IncludeValues bool `json:"includeValues"` IncludeMetadata bool `json:"includeMetadata"` Vector []float32 `json:"vector"` SparseVector *SparseVector `json:"sparseVector"` Namespace string `json:"namespace"` TopK int64 `json:"topK"` ID string `json:"id"` }
QueryParams represents the parameters for a query request. See https://docs.pinecone.io/reference/query for more information.
type QueryResponse ¶
type QueryResponse struct { Matches []*QueryVector `json:"matches"` Namespace string `json:"namespace"` }
QueryResponse represents the response from a query request.
type QueryVector ¶
QueryVector represents a scored vector.
type SparseVector ¶
SparseVector represents a sparse vector.
type UpdateVectorParams ¶
type UpdateVectorParams struct { Values []float32 `json:"values"` SparseValues *SparseVector `json:"sparseValues"` SetMetadata map[string]any `json:"setMetadata"` ID string `json:"id"` Namespace string `json:"namespace"` }
UpdateVectorParams represents the parameters for an update vector request.
type UpsertVectorsParams ¶
type UpsertVectorsParams struct { Vectors []*Vector `json:"vectors"` Namespace string `json:"namespace"` }
UpsertVectorsParams represents the parameters for an upsert vectors request. See https://docs.pinecone.io/reference/upsert for more information.
type UpsertVectorsResponse ¶
type UpsertVectorsResponse struct {
UpsertedCount int `json:"upsertedCount"`
}
UpsertVectorsResponse represents the response from an upsert vectors request.
type Vector ¶
type Vector struct { ID string `json:"id"` Values []float32 `json:"values"` SparseValues *SparseVector `json:"sparseValues"` Metadata map[string]any `json:"metadata"` }
Vector represents a struct with shared fields for vectors
type VectorCount ¶
type VectorCount struct {
VectorCount int64 `json:"vectorCount"`
}
VectorCount represents the number of vectors in a namespace.