From 79019d071aa96dfe2de487fe66ef3a426eaeda3c Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 14:15:13 -0700 Subject: [PATCH 1/7] Set up GH actions + workflows to enable pushing godoc docs to sdk-docs repo --- .github/actions/build-docs/action.yml | 9 ++++++ .github/workflows/build-and-publish-docs.yml | 31 ++++++++++++++++++++ pinecone/client.go | 3 ++ 3 files changed, 43 insertions(+) create mode 100644 .github/actions/build-docs/action.yml create mode 100644 .github/workflows/build-and-publish-docs.yml diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml new file mode 100644 index 0000000..6d9bd10 --- /dev/null +++ b/.github/actions/build-docs/action.yml @@ -0,0 +1,9 @@ +name: 'Build client documentation' +description: 'Generates client documentation using godoc' +runs: + using: 'composite' + steps: + - name: Write html file to docs directory + run: | + @godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/godoc-documentation.html + shell: bash \ No newline at end of file diff --git a/.github/workflows/build-and-publish-docs.yml b/.github/workflows/build-and-publish-docs.yml new file mode 100644 index 0000000..994d345 --- /dev/null +++ b/.github/workflows/build-and-publish-docs.yml @@ -0,0 +1,31 @@ +name: 'Build and publish documentation to sdk-docs' + +on: + workflow_dispatch: {} + workflow_call: + secrets: + SSH_DEPLOY_KEY: + required: true + +jobs: + build-and-deploy-documentation: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Generate Go documentation + uses: ./.github/actions/build-docs + + - name: Push documentation artifacts to sdk-docs + uses: cpina/github-action-push-to-another-repository@main + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + with: + source-directory: docs + destination-github-username: pinecone-io + destination-repository-name: sdk-docs + user-email: clients@pinecone.io + target-branch: main + target-directory: go + commit-message: "Go: automated documentation build \n\n go-pinecone merge SHA: ${{ github.sha }}" diff --git a/pinecone/client.go b/pinecone/client.go index 906c309..850d70f 100644 --- a/pinecone/client.go +++ b/pinecone/client.go @@ -1,3 +1,6 @@ +// Package pinecone provides a client for the [Pinecone managed vector database]. +// +// [Pinecone managed vector database]: https://www.pinecone.io/ package pinecone import ( From d4d1f7ea7fc55b1d71c925a9b6cd801e357413ce Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 14:17:50 -0700 Subject: [PATCH 2/7] change name of generated html to index.html --- .github/actions/build-docs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index 6d9bd10..9e6b346 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -5,5 +5,5 @@ runs: steps: - name: Write html file to docs directory run: | - @godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/godoc-documentation.html + @godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/index.html shell: bash \ No newline at end of file From 7657eded1a1268d37e299611865a667bc1e35cbf Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 14:26:21 -0700 Subject: [PATCH 3/7] Fix syntax in action + add docs dir --- .github/actions/build-docs/action.yml | 2 +- docs/index.html | 3111 +++++++++++++++++++++++++ 2 files changed, 3112 insertions(+), 1 deletion(-) create mode 100644 docs/index.html diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index 9e6b346..adcf4cc 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -5,5 +5,5 @@ runs: steps: - name: Write html file to docs directory run: | - @godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/index.html + godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/index.html shell: bash \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..a19f36d --- /dev/null +++ b/docs/index.html @@ -0,0 +1,3111 @@ +using module mode; GOMOD=/Users/audrey.lorberfeld/Desktop/src/go-pinecone/go.mod + + + + + + + + pinecone - Go Documentation Server + + + + + + + + + + + + + +
+... +
+ +
+ + + +
+ +
+ +
+ + + +
+
+ + +

+ Package pinecone + +

+ + + + + + + + + + + + + + + + + +
+
+
import "github.com/pinecone-io/go-pinecone/pinecone"
+
+
+
Overview
+
Index
+ + +
+
+ +
+ +
+

Overview ▾

+

Package pinecone provides a client for the Pinecone managed vector database. + + +

+
+ +
+ +
+

Index ▾

+ + +
+
+ + + + + +
type Client
+ + +
    func NewClient(in NewClientParams) (*Client, error)
+ + +
    func NewClientBase(in NewClientBaseParams) (*Client, error)
+ + + +
    func (c *Client) ConfigureIndex(ctx context.Context, name string, podType *string, replicas *int32) (*Index, error)
+ + +
    func (c *Client) CreateCollection(ctx context.Context, in *CreateCollectionRequest) (*Collection, error)
+ + +
    func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest) (*Index, error)
+ + +
    func (c *Client) CreateServerlessIndex(ctx context.Context, in *CreateServerlessIndexRequest) (*Index, error)
+ + +
    func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error
+ + +
    func (c *Client) DeleteIndex(ctx context.Context, idxName string) error
+ + +
    func (c *Client) DescribeCollection(ctx context.Context, collectionName string) (*Collection, error)
+ + +
    func (c *Client) DescribeIndex(ctx context.Context, idxName string) (*Index, error)
+ + +
    func (c *Client) Index(in NewIndexConnParams, dialOpts ...grpc.DialOption) (*IndexConnection, error)
+ + +
    func (c *Client) ListCollections(ctx context.Context) ([]*Collection, error)
+ + +
    func (c *Client) ListIndexes(ctx context.Context) ([]*Index, error)
+ + + +
type Cloud
+ + + + +
type Collection
+ + + + +
type CollectionStatus
+ + + + +
type CreateCollectionRequest
+ + + + +
type CreatePodIndexRequest
+ + + +
    func (req CreatePodIndexRequest) ReplicaCount() *int32
+ + +
    func (req CreatePodIndexRequest) ShardCount() *int32
+ + +
    func (req CreatePodIndexRequest) TotalCount() *int
+ + + +
type CreateServerlessIndexRequest
+ + + + +
type DescribeIndexStatsResponse
+ + + + +
type FetchVectorsResponse
+ + + + +
type Index
+ + + + +
type IndexConnection
+ + + +
    func (idx *IndexConnection) Close() error
+ + +
    func (idx *IndexConnection) DeleteAllVectorsInNamespace(ctx context.Context) error
+ + +
    func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *MetadataFilter) error
+ + +
    func (idx *IndexConnection) DeleteVectorsById(ctx context.Context, ids []string) error
+ + +
    func (idx *IndexConnection) DescribeIndexStats(ctx context.Context) (*DescribeIndexStatsResponse, error)
+ + +
    func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *MetadataFilter) (*DescribeIndexStatsResponse, error)
+ + +
    func (idx *IndexConnection) FetchVectors(ctx context.Context, ids []string) (*FetchVectorsResponse, error)
+ + +
    func (idx *IndexConnection) ListVectors(ctx context.Context, in *ListVectorsRequest) (*ListVectorsResponse, error)
+ + +
    func (idx *IndexConnection) QueryByVectorId(ctx context.Context, in *QueryByVectorIdRequest) (*QueryVectorsResponse, error)
+ + +
    func (idx *IndexConnection) QueryByVectorValues(ctx context.Context, in *QueryByVectorValuesRequest) (*QueryVectorsResponse, error)
+ + +
    func (idx *IndexConnection) UpdateVector(ctx context.Context, in *UpdateVectorRequest) error
+ + +
    func (idx *IndexConnection) UpsertVectors(ctx context.Context, in []*Vector) (uint32, error)
+ + + +
type IndexMetric
+ + + + +
type IndexSpec
+ + + + +
type IndexStatus
+ + + + +
type IndexStatusState
+ + + + +
type ListVectorsRequest
+ + + + +
type ListVectorsResponse
+ + + + +
type Metadata
+ + + + +
type MetadataFilter
+ + + + +
type NamespaceSummary
+ + + + +
type NewClientBaseParams
+ + + + +
type NewClientParams
+ + + + +
type NewIndexConnParams
+ + + + +
type PineconeError
+ + + +
    func (pe *PineconeError) Error() string
+ + + +
type PodSpec
+ + + + +
type PodSpecMetadataConfig
+ + + + +
type QueryByVectorIdRequest
+ + + + +
type QueryByVectorValuesRequest
+ + + + +
type QueryVectorsResponse
+ + + + +
type ScoredVector
+ + + + +
type ServerlessSpec
+ + + + +
type SparseValues
+ + + + +
type UpdateVectorRequest
+ + + + +
type Usage
+ + + + +
type Vector
+ + + + +
+
+ + + + +

Package files

+

+ + + client.go + + errors.go + + index_connection.go + + models.go + + +

+ +
+
+ + + + + + + + + +

type Client + + + +

+

Client holds the parameters for connecting to the Pinecone service. It is returned by the NewClient and NewClientBase +functions. To use Client, first build the parameters of the request using NewClientParams (or NewClientBaseParams). +Then, pass those parameters into the NewClient (or NewClientBase) function to create a new Client object. +Once instantiated, you can use Client to execute control plane API requests (e.g. create an Index, list Indexes, +etc.). Read more about different control plane API routes at docs.pinecone.io/reference/api. +

Note: Client methods are safe for concurrent use. +

Fields: +

    +
  • headers: An optional map of additional HTTP headers to include in each API request to the control plane, +provided through NewClientParams.Headers or NewClientBaseParams.Headers. +
  • restClient: Optional underlying *http.Client object used to communicate with the Pinecone control plane API, +provided through NewClientParams.RestClient or NewClientBaseParams.RestClient. If not provided, +a default client is created for you. +
  • sourceTag: An optional string used to help Pinecone attribute API activity, provided through NewClientParams.SourceTag +or NewClientBaseParams.SourceTag. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams) // --> This creates a new Client object.
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    } else {
+	       fmt.Printf("Successfully found the \"%s\" index!\n", idx.Name)
+    }
+
+    idxConnection, err := pc.Index(idx.Host)
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    } else {
+	       log.Println("IndexConnection created successfully!")
+    }
+
+ +
type Client struct {
+    // contains filtered or unexported fields
+}
+
+ + + + + + + + + + + +

func NewClient + + + +

+
func NewClient(in NewClientParams) (*Client, error)
+

NewClient creates and initializes a new instance of Client. +This function sets up the control plane client with the necessary configuration for authentication and communication. +

Parameters: +

    +
  • in: A NewClientParams object. See NewClientParams for more information. +
+

Note: It is important to handle the error returned by this function to ensure that the +control plane client has been created successfully before attempting to make API calls. +

Returns a pointer to an initialized Client instance or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+ + + + + +

func NewClientBase + + + +

+
func NewClientBase(in NewClientBaseParams) (*Client, error)
+

NewClientBase creates and initializes a new instance of Client with custom authentication headers. +

Parameters: +

    +
  • in: A NewClientBaseParams object that includes the necessary configuration for the control plane client. See +NewClientBaseParams for more information. +
+

Notes: +

    +
  • It is important to handle the error returned by this function to ensure that the +control plane client has been created successfully before attempting to make API calls. +
  • A Pinecone API key is not requried when using NewClientBase. +
+

Returns a pointer to an initialized Client instance or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientBaseParams{
+        Headers: map[string]string{
+            "Authorization": "Bearer " + "<your JWT token>"
+            "X-Project-Id": "<Your Pinecone project ID>"
+        },
+        SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClientBase(clientParams)
+	       if err != nil {
+            log.Fatalf("Failed to create Client: %v", err)
+        } else {
+	           fmt.Println("Successfully created a new Client object!")
+    }
+
+ + + + + + + +

func (*Client) ConfigureIndex + + + +

+
func (c *Client) ConfigureIndex(ctx context.Context, name string, podType *string,
+    replicas *int32) (*Index, error)
+

ConfigureIndex is used to scale a pods-based index up or down by changing the size of the pods or the number of +replicas. +

Parameters: +

    +
  • name: The name of the index to configure. +
  • pods: (Optional) The pod size to scale the index to (e.g. for a "p1" pod type, +you could pass "p1.x2" to scale your index to the "x2" size, +or you could pass "p1.x4" to scale your index to the "x4" size, and +so forth. +
  • replicas: (Optional) The number of replicas to scale the index to. +This is capped by the maximum number of replicas allowed in your Pinecone project. To configure this number, +go to app.pinecone.io, select your project, and configure the maximum number of pods. +
+

Note: You can only scale an index up, not down. If you want to scale an index down, +you must create a new index with the desired configuration. +

Returns a pointer to a configured Index object or an error. +

Example for a pods-based index originally configured with 1 "p1" pod of size "x2" and 1 replica: +

// To scale the size of your pods from "x2" to "x4":
+ _, err := pc.ConfigureIndex(ctx, "my-index", "p1.x4", nil)
+ if err != nil {
+     fmt.Printf("Failed to configure index: %v\n", err)
+ }
+
+// To scale the number of replicas:
+ _, err := pc.ConfigureIndex(ctx, "my-index", nil, 4)
+ if err != nil {
+     fmt.Printf("Failed to configure index: %v\n", err)
+ }
+
+// To scale both the size of your pods and the number of replicas:
+ _, err := pc.ConfigureIndex(ctx, "my-index", "p1.x4", 4)
+ if err != nil {
+     fmt.Printf("Failed to configure index: %v\n", err)
+ }
+
+ + + + + + +

func (*Client) CreateCollection + + + +

+
func (c *Client) CreateCollection(ctx context.Context, in *CreateCollectionRequest) (*Collection, error)
+

CreateCollection creates and initializes a new Collection via the specified Client. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • in: A pointer to a CreateCollectionRequest object. +
+

Note: Collections are only available for pods-based Indexes. +

Returns a pointer to a Collection object or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
+        Name:   "my-collection",
+        Source: "my-source-index",
+    })
+    if err != nil {
+	       log.Fatalf("Failed to create collection: %v", err)
+    } else {
+	       fmt.Printf("Successfully created collection \"%s\".", collection.Name)
+    }
+
+ + + + + + +

func (*Client) CreatePodIndex + + + +

+
func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest) (*Index, error)
+

CreatePodIndex creates and initializes a new pods-based Index via the specified Client. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • in: A pointer to a CreatePodIndexRequest object. See CreatePodIndexRequest for more information. +
+

Returns a pointer to an Index object or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    podIndexMetadata := &pinecone.PodSpecMetadataConfig{
+	       Indexed: &[]string{"title", "description"},
+    }
+
+    idx, err := pc.CreatePodIndex(ctx, &pinecone.CreatePodIndexRequest{
+        Name:        "my-pod-index",
+        Dimension:   3,
+        Metric:      pinecone.Cosine,
+        Environment: "us-west1-gcp",
+        PodType:     "s1",
+        MetadataConfig: podIndexMetadata,
+    })
+
+    if err != nil {
+	       log.Fatalf("Failed to create pod index:", err)
+    } else {
+	       fmt.Printf("Successfully created pod index: %s", idx.Name)
+    }
+
+ + + + + + +

func (*Client) CreateServerlessIndex + + + +

+
func (c *Client) CreateServerlessIndex(ctx context.Context, in *CreateServerlessIndexRequest) (*Index, error)
+

CreateServerlessIndex creates and initializes a new serverless Index via the specified Client. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • in: A pointer to a CreateServerlessIndexRequest object. See CreateServerlessIndexRequest for more information. +
+

Returns a pointer to an Index object or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    idx, err := pc.CreateServerlessIndex(ctx, &pinecone.CreateServerlessIndexRequest{
+        Name:    "my-serverless-index",
+        Dimension: 3,
+        Metric:  pinecone.Cosine,
+        Cloud:   pinecone.Aws,
+        Region:  "us-east-1",
+    })
+
+    if err != nil {
+        log.Fatalf("Failed to create serverless index: %s", idx.Name)
+    } else {
+        fmt.Printf("Successfully created serverless index: %s", idx.Name)
+    }
+
+ + + + + + +

func (*Client) DeleteCollection + + + +

+
func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error
+

DeleteCollection deletes a specific Collection +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • collectionName: The name of the Collection to delete. +
+

Note: Collections are only available for pods-based Indexes. +

Returns an error if the deletion fails. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    collectionName := "my-collection"
+
+    err = pc.DeleteCollection(ctx, collectionName)
+    if err != nil {
+	       log.Fatalf("Failed to create collection: %s\n", err)
+    } else {
+	       log.Printf("Successfully deleted collection \"%s\"\n", collectionName)
+    }
+
+ + + + + + +

func (*Client) DeleteIndex + + + +

+
func (c *Client) DeleteIndex(ctx context.Context, idxName string) error
+

DeleteIndex deletes a specific Index. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • idxName: The name of the Index to delete. +
+

Returns an error if the deletion fails. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    indexName := "the-name-of-my-index"
+
+    err = pc.DeleteIndex(ctx, indexName)
+    if err != nil {
+	       log.Fatalf("Error: %v", err)
+    } else {
+        fmt.Printf("Index \"%s\" deleted successfully", indexName)
+    }
+
+ + + + + + +

func (*Client) DescribeCollection + + + +

+
func (c *Client) DescribeCollection(ctx context.Context, collectionName string) (*Collection, error)
+

DescribeCollection retrieves information about a specific Collection. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • collectionName: The name of the Collection to describe. +
+

Returns a pointer to a Collection object or an error. +

Note: Collections are only available for pods-based Indexes. +

Since the returned value is a pointer to a Collection object, it will have the following fields: +

    +
  • Name: The name of the Collection. +
  • Size: The size of the Collection in bytes. +
  • Status: The status of the Collection. +
  • Dimension: The dimensionality of the vectors stored in each record held in the Collection. +
  • VectorCount: The number of records stored in the Collection. +
  • Environment: The cloud environment where the Collection is hosted. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    collection, err := pc.DescribeCollection(ctx, "my-collection")
+    if err != nil {
+	       log.Fatalf("Error describing collection: %v", err)
+    } else {
+	       fmt.Printf("Collection: %+v\n", *collection)
+    }
+
+ + + + + + +

func (*Client) DescribeIndex + + + +

+
func (c *Client) DescribeIndex(ctx context.Context, idxName string) (*Index, error)
+

DescribeIndex retrieves information about a specific Index. See Index for more information. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
  • idxName: The name of the Index to describe. +
+

Returns a pointer to an Index object or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "the-name-of-my-index")
+    if err != nil {
+        log.Fatalf("Failed to describe index: %s", err)
+    } else {
+        fmt.Printf("%+v", *idx)
+    }
+
+ + + + + + +

func (*Client) Index + + + +

+
func (c *Client) Index(in NewIndexConnParams, dialOpts ...grpc.DialOption) (*IndexConnection, error)
+

Index creates an IndexConnection to a specified host. +

Parameters: +

    +
  • in: A NewIndexConnParams object that includes the necessary configuration to create an IndexConnection. +See NewIndexConnParams for more information. +
+

Note: It is important to handle the error returned by this method to ensure that the IndexConnection is created +successfully before making data plane calls. +

Returns a pointer to an IndexConnection instance or an error. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    } else {
+	       fmt.Printf("Successfully found the \"%s\" index!\n", idx.Name)
+    }
+
+    indexConnParams := pinecone.NewIndexConnParams{
+	       Host: idx.Host,
+	       Namespace: "your-namespace",
+	       AdditionalMetadata: map[string]string{
+		       "your-metadata-key": "your-metadata-value",
+	       },
+    }
+
+    idxConnection, err := pc.Index(indexConnParams)
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    } else {
+	       log.Println("IndexConnection created successfully!")
+    }
+
+ + + + + + +

func (*Client) ListCollections + + + +

+
func (c *Client) ListCollections(ctx context.Context) ([]*Collection, error)
+

ListCollections retrieves a list of all Collections in a Pinecone project. See Collection for more information. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
+

Returns a slice of pointers to Collection objects or an error. +

Note: Collections are only available for pods-based Indexes. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    collections, err := pc.ListCollections(ctx)
+    if err != nil {
+	       log.Fatalf("Failed to list collections: %v", err)
+    } else {
+	       if len(collections) == 0 {
+	           fmt.Printf("No collections found in project")
+	       } else {
+	           fmt.Println("Collections in project:")
+	           for _, collection := range collections {
+		           fmt.Printf("- %s\n", collection.Name)
+	           }
+	       }
+    }
+
+ + + + + + +

func (*Client) ListIndexes + + + +

+
func (c *Client) ListIndexes(ctx context.Context) ([]*Index, error)
+

ListIndexes retrieves a list of all Indexes in a Pinecone project. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, allowing for the request +to be canceled or to timeout according to the context's deadline. +
+

Returns a slice of pointers to Index objects or an error. +

Example: +

    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    idxs, err := pc.ListIndexes(ctx)
+    if err != nil {
+	       log.Fatalf("Failed to list indexes: %v", err)
+    } else {
+	       fmt.Println("Your project has the following indexes:")
+	       for _, idx := range idxs {
+		       fmt.Printf("- \"%s\"\n", idx.Name)
+	       }
+    }
+
+ + + + + + + + +

type Cloud + + + +

+

Cloud is the cloud provider to be used for a Pinecone serverless Index. + +

type Cloud string
+ + + +
const (
+    Aws   Cloud = "aws"
+    Azure Cloud = "azure"
+    Gcp   Cloud = "gcp"
+)
+ + + + + + + + + + + + + + +

type Collection + + + +

+

Collection is a Pinecone Collection object. Only available for pod-based Indexes. + +

type Collection struct {
+    Name        string           `json:"name"`
+    Size        int64            `json:"size"`
+    Status      CollectionStatus `json:"status"`
+    Dimension   int32            `json:"dimension"`
+    VectorCount int32            `json:"vector_count"`
+    Environment string           `json:"environment"`
+}
+
+ + + + + + + + + + + + + + + +

type CollectionStatus + + + +

+

CollectionStatus is the status of a Pinecone Collection. + +

type CollectionStatus string
+ + + +
const (
+    CollectionStatusInitializing CollectionStatus = "Initializing"
+    CollectionStatusReady        CollectionStatus = "Ready"
+    CollectionStatusTerminating  CollectionStatus = "Terminating"
+)
+ + + + + + + + + + + + + + +

type CreateCollectionRequest + + + +

+

CreateCollectionRequest holds the parameters for creating a new Collection. +

Fields: +

    +
  • Name: The name of the Collection. +
  • Source: The name of the Index to be used as the source for the Collection. +
+

To create a new Collection, use the CreateCollection method on the Client object. +

Note: Collections are only available for pods-based Indexes. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
+        Name:   "my-collection",
+        Source: "my-source-index",
+     })
+    if err != nil {
+	       log.Fatalf("Failed to create collection: %v", err)
+    } else {
+	       fmt.Printf("Successfully created collection \"%s\".", collection.Name)
+    }
+
+ +
type CreateCollectionRequest struct {
+    Name   string
+    Source string
+}
+
+ + + + + + + + + + + + + + + +

type CreatePodIndexRequest + + + +

+

CreatePodIndexRequest holds the parameters for creating a new pods-based Index. +

Fields: +

    +
  • Name: The name of the Index. Resource name must be 1-45 characters long, +start and end with an alphanumeric character, +and consist only of lower case alphanumeric characters or '-'. +
  • Dimension: The dimensionality of the vectors to be inserted in the Index. +
  • Metric: The distance metric to be used for similarity search. You can use +'euclidean', 'cosine', or 'dotproduct'. +
  • Environment: The cloud environment where the Index will be hosted. +
  • PodType: The [type of pod] to use for the Index. One of `s1`, `p1`, or `p2` appended with `.` and +one of `x1`, `x2`, `x4`, or `x8`. +
  • Shards: The number of shards to use for the Index (defaults to 1). +Shards split your data across multiple pods, so you can fit more data into an Index. +
  • Replicas: The number of replicas to use for the Index (defaults to 1). Replicas duplicate your Index. +They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. +
  • SourceCollection: The name of the Collection to be used as the source for the Index. +
  • MetadataConfig: The metadata 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. These configurations are +only valid for use with pod-based Indexes. +
+

To create a new pods-based Index, use the CreatePodIndex method on the Client object. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    podIndexMetadata := &pinecone.PodSpecMetadataConfig{
+	       Indexed: &[]string{"title", "description"},
+    }
+
+    idx, err := pc.CreatePodIndex(ctx, &pinecone.CreatePodIndexRequest{
+        Name:        "my-pod-index",
+        Dimension:   3,
+        Metric:      pinecone.Cosine,
+        Environment: "us-west1-gcp",
+        PodType:     "s1",
+        MetadataConfig: podIndexMetadata,
+        })
+
+    if err != nil {
+	       log.Fatalf("Failed to create pod index: %v", err)
+    } else {
+	       fmt.Printf("Successfully created pod index: %s", idx.Name)
+    }
+
+ +
type CreatePodIndexRequest struct {
+    Name             string
+    Dimension        int32
+    Metric           IndexMetric
+    Environment      string
+    PodType          string
+    Shards           int32
+    Replicas         int32
+    SourceCollection *string
+    MetadataConfig   *PodSpecMetadataConfig
+}
+
+ + + + + + + + + + + + + +

func (CreatePodIndexRequest) ReplicaCount + + + +

+
func (req CreatePodIndexRequest) ReplicaCount() *int32
+

ReplicaCount ensures the replica count of a pods-based Index is >1. +It returns a pointer to the number of replicas on a CreatePodIndexRequest object. + + + + + + +

func (CreatePodIndexRequest) ShardCount + + + +

+
func (req CreatePodIndexRequest) ShardCount() *int32
+

ShardCount ensures the number of shards on a pods-based Index is >1. It returns a pointer to the number of shards on +a CreatePodIndexRequest object. + + + + + + +

func (CreatePodIndexRequest) TotalCount + + + +

+
func (req CreatePodIndexRequest) TotalCount() *int
+

TotalCount calculates and returns the total number of pods (replicas*shards) on a CreatePodIndexRequest object. + + + + + + + + +

type CreateServerlessIndexRequest + + + +

+

CreateServerlessIndexRequest holds the parameters for creating a new Serverless Index. +

Fields: +

    +
  • Name: The name of the Index. Resource name must be 1-45 characters long, +start and end with an alphanumeric character, +and consist only of lower case alphanumeric characters or '-'. +
  • Dimension: The dimensionality of the vectors to be inserted in the Index. +
  • Metric: The metric used to measure the similarity between vectors ('euclidean', 'cosine', or 'dotproduct'). +
  • Cloud: The public cloud provider where you would like your Index hosted. +For serverless Indexes, you define only the cloud and region where the Index should be hosted. +
  • Region: The region where you would like your Index to be created. +
+

To create a new Serverless Index, use the CreateServerlessIndex method on the Client object. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+    if err != nil {
+        log.Fatalf("Failed to create Client: %v", err)
+    } else {
+	       fmt.Println("Successfully created a new Client object!")
+    }
+
+    idx, err := pc.CreateServerlessIndex(ctx, &pinecone.CreateServerlessIndexRequest{
+        Name:    "my-serverless-index",
+        Dimension: 3,
+        Metric:  pinecone.Cosine,
+        Cloud:   pinecone.Aws,
+        Region:  "us-east-1",
+    })
+
+    if err != nil {
+        log.Fatalf("Failed to create serverless index: %s", idx.Name)
+    } else {
+        fmt.Printf("Successfully created serverless index: %s", idx.Name)
+    }
+
+ +
type CreateServerlessIndexRequest struct {
+    Name      string
+    Dimension int32
+    Metric    IndexMetric
+    Cloud     Cloud
+    Region    string
+}
+
+ + + + + + + + + + + + + + + +

type DescribeIndexStatsResponse + + + +

+

DescribeIndexStatsResponse holds the parameters for the DescribeIndexStatsResponse object, +which is returned by the DescribeIndexStats method. +

Fields: +

    +
  • Dimension: The dimension of the index. +
  • IndexFullness: The fullness level of the index. Note: only available on pods-based indexes. +
  • TotalVectorCount: The total number of vectors in the index. +
  • Namespaces: The namespace(s) in the index. +
+ +
type DescribeIndexStatsResponse struct {
+    Dimension        uint32                       `json:"dimension"`
+    IndexFullness    float32                      `json:"index_fullness"`
+    TotalVectorCount uint32                       `json:"total_vector_count"`
+    Namespaces       map[string]*NamespaceSummary `json:"namespaces,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type FetchVectorsResponse + + + +

+

FetchVectorsResponse holds the parameters for the FetchVectorsResponse object, +which is returned by the FetchVectors method. +

Fields: +

    +
  • Vectors: The vectors fetched. +
  • Usage: The usage information for the request. +
+ +
type FetchVectorsResponse struct {
+    Vectors map[string]*Vector `json:"vectors,omitempty"`
+    Usage   *Usage             `json:"usage,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type Index + + + +

+

Index is a Pinecone Index object. Can be either a pod-based or a serverless Index, depending on the IndexSpec. + +

type Index struct {
+    Name      string       `json:"name"`
+    Dimension int32        `json:"dimension"`
+    Host      string       `json:"host"`
+    Metric    IndexMetric  `json:"metric"`
+    Spec      *IndexSpec   `json:"spec,omitempty"`
+    Status    *IndexStatus `json:"status,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type IndexConnection + + + +

+

IndexConnection holds the parameters for a Pinecone IndexConnection object. +

Fields: +

    +
  • Namespace: The namespace where index operations will be performed. +
  • additionalMetadata: Additional metadata to be sent with each RPC request. +
  • dataClient: The gRPC client for the index. +
  • grpcConn: The gRPC connection. +
+ +
type IndexConnection struct {
+    Namespace string
+    // contains filtered or unexported fields
+}
+
+ + + + + + + + + + + + + +

func (*IndexConnection) Close + + + +

+
func (idx *IndexConnection) Close() error
+

Close closes the grpc.ClientConn to a Pinecone index. +

Returns an error if the connection cannot be closed, otherwise returns nil. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection: %v", err)
+    }
+
+    err = idxConnection.Close()
+
+    if err != nil {
+	       log.Fatalf("Failed to close index connection. Error: %v", err)
+    }
+
+ + + + + + +

func (*IndexConnection) DeleteAllVectorsInNamespace + + + +

+
func (idx *IndexConnection) DeleteAllVectorsInNamespace(ctx context.Context) error
+

DeleteAllVectorsInNamespace deletes all vectors in a specific namespace. +

Returns an error if the request fails, otherwise returns nil. +

Note: You must instantiate an IndexWithNamespace connection in order to delete vectors by ID in namespaces other +than the default. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    err = idxConnection.DeleteAllVectorsInNamespace(ctx)
+
+    if err != nil {
+	       log.Fatalf("Failed to delete vectors in namespace: \"%s\". Error: %s", idxConnection.Namespace, err)
+    }
+
+ + + + + + +

func (*IndexConnection) DeleteVectorsByFilter + + + +

+
func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *MetadataFilter) error
+

DeleteVectorsByFilter deletes vectors from a Pinecone index, given a filter. +

Returns an error if the request fails, otherwise returns nil. +

Note: DeleteVectorsByFilter is only available on pods-based indexes. +Additionally, you must instantiate an IndexWithNamespace connection in order to delete vectors in namespaces +other than the default. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • filter: The filter to apply to the deletion. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	        log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    metadataFilter := map[string]interface{}{
+	       "genre": "classical",
+    }
+
+    filter, err := structpb.NewStruct(metadataFilter)
+
+    if err != nil {
+	       log.Fatalf("Failed to create metadata filter. Error: %v", err)
+    }
+
+    err = idxConnection.DeleteVectorsByFilter(ctx, filter)
+
+    if err != nil {
+	       log.Fatalf("Failed to delete vector(s) with filter: %+v. Error: %s\n", filter, err)
+    }
+
+ + + + + + +

func (*IndexConnection) DeleteVectorsById + + + +

+
func (idx *IndexConnection) DeleteVectorsById(ctx context.Context, ids []string) error
+

DeleteVectorsById deletes vectors by ID from a Pinecone index. +

Returns an error if the request fails, +otherwise returns nil. This method will also return nil if the passed vector ID does not exist in the index or +namespace. +

Note: You must instantiate an IndexWithNamespace connection in order to delete vectors by ID in namespaces other +than the default. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • ids: IDs of the vectors you want to delete. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host, Namespace: "custom-namespace"})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    vectorId := "your-vector-id"
+    err = idxConnection.DeleteVectorsById(ctx, []string{vectorId})
+
+    if err != nil {
+	       log.Fatalf("Failed to delete vector with ID: %s. Error: %s\n", vectorId, err)
+    }
+
+ + + + + + +

func (*IndexConnection) DescribeIndexStats + + + +

+
func (idx *IndexConnection) DescribeIndexStats(ctx context.Context) (*DescribeIndexStatsResponse, error)
+

DescribeIndexStats returns statistics about a Pinecone index. +

Returns a pointer to a DescribeIndexStatsResponse object or an error if the request fails. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index:", err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    res, err := idxConnection.DescribeIndexStats(ctx)
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error: %s", idx.Name, err)
+    } else {
+	       log.Fatalf("%+v", *res)
+    }
+
+ + + + + + +

func (*IndexConnection) DescribeIndexStatsFiltered + + + +

+
func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *MetadataFilter) (*DescribeIndexStatsResponse, error)
+

DescribeIndexStatsFiltered returns statistics about a Pinecone index, filtered by a given filter. +

Returns a pointer to a DescribeIndexStatsResponse object or an error if the request fails. +

Note: DescribeIndexStatsFiltered is only available on pods-based indexes. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • filter: The filter to apply to the request. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    metadataFilter := map[string]interface{}{
+	       "genre": "classical",
+    }
+
+    filter, err := structpb.NewStruct(metadataFilter)
+
+    if err != nil {
+	       log.Fatalf("Failed to create filter %+v. Error: %s", metadataFilter, err)
+    }
+
+    res, err := idxConnection.DescribeIndexStatsFiltered(ctx, filter)
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error: %s", idx.Name, err)
+    } else {
+	       for name, summary := range res.Namespaces {
+		       fmt.Printf("Namespace: \"%s\", has %d vector(s) that match the given filter\n", name, summary.VectorCount)
+	       }
+    }
+
+ + + + + + +

func (*IndexConnection) FetchVectors + + + +

+
func (idx *IndexConnection) FetchVectors(ctx context.Context, ids []string) (*FetchVectorsResponse, error)
+

FetchVectors fetches vectors by ID from a Pinecone index. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • ids: The unique IDs of the vectors to fetch. +
+

Returns a pointer to any fetched vectors or an error if the request fails. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    res, err := idxConnection.FetchVectors(ctx, []string{"abc-1"})
+
+    if err != nil {
+	       log.Fatalf("Failed to fetch vectors, error: %+v", err)
+    }
+
+    if len(res.Vectors) != 0 {
+	       fmt.Println(res)
+    } else {
+	       fmt.Println("No vectors found")
+    }
+
+ + + + + + +

func (*IndexConnection) ListVectors + + + +

+
func (idx *IndexConnection) ListVectors(ctx context.Context, in *ListVectorsRequest) (*ListVectorsResponse, error)
+

ListVectors lists vectors in a Pinecone index. You can filter vectors by prefix, +limit the number of vectors returned, and paginate through results. +

Note: ListVectors is only available for Serverless indexes. +

Returns a pointer to a ListVectorsResponse object or an error if the request fails. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • in: A ListVectorsRequest object with the parameters for the request. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    prefix := "abc"
+    limit := uint32(10)
+
+    res, err := idxConnection.ListVectors(ctx, &pinecone.ListVectorsRequest{
+	       Prefix: &prefix,
+	       Limit:  &limit,
+    })
+
+    if err != nil {
+	       log.Fatalf("Failed to list vectors in index: %s. Error: %s\n", idx.Name, err)
+    }
+
+    if len(res.VectorIds) == 0 {
+	       fmt.Println("No vectors found")
+    } else {
+	       fmt.Printf("Found %d vector(s)\n", len(res.VectorIds))
+    }
+
+ + + + + + +

func (*IndexConnection) QueryByVectorId + + + +

+
func (idx *IndexConnection) QueryByVectorId(ctx context.Context, in *QueryByVectorIdRequest) (*QueryVectorsResponse, error)
+

QueryByVectorId uses a vector ID to query a Pinecone index and retrieve vectors that are most similar to the +provided ID's underlying vector. +

Returns a pointer to a QueryVectorsResponse object or an error if the request fails. +

Note: QueryByVectorId executes a nearest neighbors search, +meaning that unless TopK=1 in the QueryByVectorIdRequest object, +it will return 2+ vectors. The vector with a score of 1.0 is the vector with the same ID as the query vector. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • in: A QueryByVectorIdRequest object with the parameters for the request. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    vectorId := "abc-1"
+    topK := uint32(10)
+
+    res, err := idxConnection.QueryByVectorId(ctx, &pinecone.QueryByVectorIdRequest{
+	       VectorId:        vectorId,
+	       TopK:            topK, // number of vectors you want returned
+	       IncludeValues:   true,
+	       IncludeMetadata: true,
+    })
+
+    if err != nil {
+	       log.Fatalf("Error encountered when querying by vector ID `%s`. Error: %s", vectorId, err)
+    } else {
+	       for _, match := range res.Matches {
+		       fmt.Printf("Match vector with ID `%s`, with score %f\n", match.Vector.Id, match.Score)
+	       }
+    }
+
+ + + + + + +

func (*IndexConnection) QueryByVectorValues + + + +

+
func (idx *IndexConnection) QueryByVectorValues(ctx context.Context, in *QueryByVectorValuesRequest) (*QueryVectorsResponse, error)
+

QueryByVectorValues queries a Pinecone index for vectors that are most similar to a provided query vector. +

Returns a pointer to a QueryVectorsResponse object or an error if the request fails. +

Note: To issue a hybrid query with both dense and sparse values, +your index's similarity metric must be dot-product. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • in: A QueryByVectorValuesRequest object with the parameters for the request. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    queryVector := []float32{1.0, 2.0}
+    topK := uint32(10)
+
+    metadataMap := map[string]interface{}{
+	       "genre": "classical",
+    }
+
+    metadataFilter, err := structpb.NewStruct(metadataMap)
+
+    if err != nil {
+	       log.Fatalf("Failed to create metadata map. Error: %v", err)
+    }
+
+    sparseValues := pinecone.SparseValues{
+	       Indices: []uint32{0, 1},
+	       Values:  []float32{1.0, 2.0},
+    }
+
+    res, err := idxConnection.QueryByVectorValues(ctx, &pinecone.QueryByVectorValuesRequest{
+	       Vector:          queryVector,
+	       TopK:            topK, // number of vectors to be returned
+	       MetadataFilter:          metadataFilter,
+	       SparseValues:    &sparseValues,
+	       IncludeValues:   true,
+	       IncludeMetadata: true,
+    })
+
+    if err != nil {
+	       log.Fatalf("Error encountered when querying by vector: %v", err)
+    } else {
+	       for _, match := range res.Matches {
+		       fmt.Printf("Match vector `%s`, with score %f\n", match.Vector.Id, match.Score)
+	       }
+    }
+
+ + + + + + +

func (*IndexConnection) UpdateVector + + + +

+
func (idx *IndexConnection) UpdateVector(ctx context.Context, in *UpdateVectorRequest) error
+

UpdateVector updates a vector in a Pinecone index by ID. +

Returns an error if the request fails, returns nil otherwise. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • in: An UpdateVectorRequest object with the parameters for the request. +
+

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    id := "abc-1"
+
+    err = idxConnection.UpdateVector(ctx, &pinecone.UpdateVectorRequest{
+	       Id:     id,
+	       Values: []float32{7.0, 8.0},
+    })
+
+    if err != nil {
+	       log.Fatalf("Failed to update vector with ID %s. Error: %s", id, err)
+    }
+
+ + + + + + +

func (*IndexConnection) UpsertVectors + + + +

+
func (idx *IndexConnection) UpsertVectors(ctx context.Context, in []*Vector) (uint32, error)
+

UpsertVectors upserts vectors into a Pinecone index. +

Parameters: +

    +
  • ctx: A context.Context object controls the request's lifetime, +allowing for the request to be canceled or to timeout according to the context's deadline. +
  • in: The vectors to upsert. +
+

Returns the number of vectors upserted or an error if the request fails. +

Example: +

    ctx := context.Background()
+
+    clientParams := pinecone.NewClientParams{
+	       ApiKey:    "YOUR_API_KEY",
+	       SourceTag: "your_source_identifier", // optional
+    }
+
+    pc, err := pinecone.NewClient(clientParams)
+
+    if err != nil {
+	       log.Fatalf("Failed to create Client: %v", err)
+    }
+
+    idx, err := pc.DescribeIndex(ctx, "your-index-name")
+
+    if err != nil {
+	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
+    }
+
+    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
+
+    if err != nil {
+	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
+    }
+
+    metadataMap := map[string]interface{}{
+	       "genre": "classical",
+    }
+
+    metadata, err := structpb.NewStruct(metadataMap)
+
+    if err != nil {
+	       log.Fatalf("Failed to create metadata map. Error: %v", err)
+    }
+
+    sparseValues := pinecone.SparseValues{
+	       Indices: []uint32{0, 1},
+	       Values:  []float32{1.0, 2.0},
+    }
+
+    vectors := []*pinecone.Vector{
+	       {
+		       Id:           "abc-1",
+		       Values:       []float32{1.0, 2.0},
+		       Metadata:     metadata,
+		       SparseValues: &sparseValues,
+	       },
+    }
+
+    count, err := idxConnection.UpsertVectors(ctx, vectors)
+
+    if err != nil {
+	       log.Fatalf("Failed to upsert vectors. Error: %v", err)
+    } else {
+	       log.Fatalf("Successfully upserted %d vector(s)!\n", count)
+    }
+
+ + + + + + + + +

type IndexMetric + + + +

+

IndexMetric is the distance metric to be used by similarity search against a Pinecone Index. + +

type IndexMetric string
+ + + +
const (
+    Cosine     IndexMetric = "cosine"     // Default distance metric, ideal for textual data
+    Dotproduct IndexMetric = "dotproduct" // Ideal for hybrid search
+    Euclidean  IndexMetric = "euclidean"  // Ideal for distance-based data (e.g. lat/long points)
+)
+ + + + + + + + + + + + + + +

type IndexSpec + + + +

+

IndexSpec is the infrastructure specification (pods vs serverless) of a Pinecone Index. + +

type IndexSpec struct {
+    Pod        *PodSpec        `json:"pod,omitempty"`
+    Serverless *ServerlessSpec `json:"serverless,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type IndexStatus + + + +

+

IndexStatus is the status of a Pinecone Index. + +

type IndexStatus struct {
+    Ready bool             `json:"ready"`
+    State IndexStatusState `json:"state"`
+}
+
+ + + + + + + + + + + + + + + +

type IndexStatusState + + + +

+

IndexStatusState is the state of a Pinecone Index. + +

type IndexStatusState string
+ + + +
const (
+    InitializationFailed IndexStatusState = "InitializationFailed"
+    Initializing         IndexStatusState = "Initializing"
+    Ready                IndexStatusState = "Ready"
+    ScalingDown          IndexStatusState = "ScalingDown"
+    ScalingDownPodSize   IndexStatusState = "ScalingDownPodSize"
+    ScalingUp            IndexStatusState = "ScalingUp"
+    ScalingUpPodSize     IndexStatusState = "ScalingUpPodSize"
+    Terminating          IndexStatusState = "Terminating"
+)
+ + + + + + + + + + + + + + +

type ListVectorsRequest + + + +

+

ListVectorsRequest holds the parameters for the ListVectorsRequest object, +which is passed into the ListVectors method. +

Fields: +

    +
  • Prefix: The prefix by which to filter. If unspecified, +an empty string will be used which will list all vector ids in the namespace +
  • Limit: The maximum number of vectors to return. If unspecified, the server will use a default value. +
  • PaginationToken: The token for paginating through results. +
+ +
type ListVectorsRequest struct {
+    Prefix          *string
+    Limit           *uint32
+    PaginationToken *string
+}
+
+ + + + + + + + + + + + + + + +

type ListVectorsResponse + + + +

+

ListVectorsResponse holds the parameters for the ListVectorsResponse object, +which is returned by the ListVectors method. +

Fields: +

    +
  • VectorIds: The unique IDs of the returned vectors. +
  • Usage: The usage information for the request. +
  • NextPaginationToken: The token for paginating through results. +
+ +
type ListVectorsResponse struct {
+    VectorIds           []*string `json:"vector_ids,omitempty"`
+    Usage               *Usage    `json:"usage,omitempty"`
+    NextPaginationToken *string   `json:"next_pagination_token,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type Metadata + + + +

+

Metadata represents optional, +additional information that can be attached to, or updated for, a vector in a Pinecone Index. + +

type Metadata = structpb.Struct
+ + + + + + + + + + + + + + + +

type MetadataFilter + + + +

+

MetadataFilter represents the metadata filters attached to a Pinecone request. +These optional metadata filters are applied to query and deletion requests. + +

type MetadataFilter = structpb.Struct
+ + + + + + + + + + + + + + + +

type NamespaceSummary + + + +

+

NamespaceSummary is a summary of stats for a Pinecone namespace. + +

type NamespaceSummary struct {
+    VectorCount uint32 `json:"vector_count"`
+}
+
+ + + + + + + + + + + + + + + +

type NewClientBaseParams + + + +

+

NewClientBaseParams holds the parameters for creating a new Client instance while passing custom authentication +headers. +

Fields: +

    +
  • Headers: An optional map of additional HTTP headers to include in each API request to the control plane. +"Authorization" and "X-Project-Id" headers are required if authenticating using a JWT. +
  • Host: The host URL of the Pinecone control plane API. If not provided, +the default value is "https://api.pinecone.io". +
  • RestClient: An optional *http.Client object to use for communication with the control plane API. +
  • SourceTag: An optional string used to help Pinecone attribute API activity. +
+

See Client for code example. + +

type NewClientBaseParams struct {
+    Headers    map[string]string
+    Host       string
+    RestClient *http.Client
+    SourceTag  string
+}
+
+ + + + + + + + + + + + + + + +

type NewClientParams + + + +

+

NewClientParams holds the parameters for creating a new Client instance while authenticating via an API key. +

Fields: +

    +
  • ApiKey: (Required) The API key used to authenticate with the Pinecone control plane API. +This value must be passed by the user unless it is set as an environment variable ("PINECONE_API_KEY"). +
  • Headers: An optional map of additional HTTP headers to include in each API request to the control plane. +
  • Host: The host URL of the Pinecone control plane API. If not provided, +the default value is "https://api.pinecone.io". +
  • RestClient: An optional HTTP client to use for communication with the control plane API. +
  • SourceTag: An optional string used to help Pinecone attribute API activity. +
+

See Client for code example. + +

type NewClientParams struct {
+    ApiKey     string            // required - provide through NewClientParams or environment variable PINECONE_API_KEY
+    Headers    map[string]string // optional
+    Host       string            // optional
+    RestClient *http.Client      // optional
+    SourceTag  string            // optional
+}
+
+ + + + + + + + + + + + + + + +

type NewIndexConnParams + + + +

+

NewIndexConnParams holds the parameters for creating an IndexConnection to a Pinecone index. +

Fields: +

    +
  • Host: The host URL of the Pinecone index. This is required. To find your host url use the DescribeIndex or ListIndexes methods. +Alternatively, the host is displayed in the Pinecone web console. +
  • Namespace: Optional index namespace to use for operations. If not provided, the default namespace of "" will be used. +
  • AdditionalMetdata: Optional additional metdata to be sent with each RPC request. +
+

See Client.Index for code example. + +

type NewIndexConnParams struct {
+    Host               string            // required - obtained through DescribeIndex or ListIndexes
+    Namespace          string            // optional - if not provided the default namespace of "" will be used
+    AdditionalMetadata map[string]string // optional
+}
+
+ + + + + + + + + + + + + + + +

type PineconeError + + + +

+ +
type PineconeError struct {
+    Code int
+    Msg  error
+}
+
+ + + + + + + + + + + + + +

func (*PineconeError) Error + + + +

+
func (pe *PineconeError) Error() string
+ + + + + + + + +

type PodSpec + + + +

+

PodSpec is the infrastructure specification of a pod-based Pinecone Index. Only available for pod-based Indexes. + +

type PodSpec struct {
+    Environment      string                 `json:"environment"`
+    PodType          string                 `json:"pod_type"`
+    PodCount         int32                  `json:"pod_count"`
+    Replicas         int32                  `json:"replicas"`
+    ShardCount       int32                  `json:"shard_count"`
+    SourceCollection *string                `json:"source_collection,omitempty"`
+    MetadataConfig   *PodSpecMetadataConfig `json:"metadata_config,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type PodSpecMetadataConfig + + + +

+

PodSpecMetadataConfig represents the metadata fields to be indexed when a Pinecone Index is created. + +

type PodSpecMetadataConfig struct {
+    Indexed *[]string `json:"indexed,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type QueryByVectorIdRequest + + + +

+

QueryByVectorIdRequest holds the parameters for the QueryByVectorIdRequest object, +which is passed into the QueryByVectorId method. +

Fields: +

    +
  • VectorId: The unique ID of the vector used to find similar vectors. +
  • TopK: The number of vectors to return. +
  • MetadataFilter: The filter to apply to your query. +
  • IncludeValues: Whether to include the values of the vectors in the response. +
  • IncludeMetadata: Whether to include the metadata associated with the vectors in the response. +
  • SparseValues: The sparse values of the query vector, if applicable. +
+ +
type QueryByVectorIdRequest struct {
+    VectorId        string
+    TopK            uint32
+    Filter          *MetadataFilter
+    IncludeValues   bool
+    IncludeMetadata bool
+    SparseValues    *SparseValues
+}
+
+ + + + + + + + + + + + + + + +

type QueryByVectorValuesRequest + + + +

+

QueryByVectorValuesRequest holds the parameters for the QueryByVectorValuesRequest object, +which is passed into the QueryByVectorValues method. +

Fields: +

    +
  • Vector: The query vector used to find similar vectors. +
  • TopK: The number of vectors to return. +
  • MetadataFilter: The filter to apply to your query. +
  • IncludeValues: Whether to include the values of the vectors in the response. +
  • IncludeMetadata: Whether to include the metadata associated with the vectors in the response. +
  • SparseValues: The sparse values of the query vector, if applicable. +
+ +
type QueryByVectorValuesRequest struct {
+    Vector          []float32
+    TopK            uint32
+    Filter          *MetadataFilter
+    IncludeValues   bool
+    IncludeMetadata bool
+    SparseValues    *SparseValues
+}
+
+ + + + + + + + + + + + + + + +

type QueryVectorsResponse + + + +

+

QueryVectorsResponse holds the parameters for the QueryVectorsResponse object, +which is returned by the QueryByVectorValues method. +

Fields: +

    +
  • Matches: The vectors that are most similar to the query vector. +
  • Usage: The usage information for the request. +
+ +
type QueryVectorsResponse struct {
+    Matches []*ScoredVector `json:"matches,omitempty"`
+    Usage   *Usage          `json:"usage,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type ScoredVector + + + +

+

ScoredVector is a vector with an associated similarity score calculated according to the distance metric of the +Index. + +

type ScoredVector struct {
+    Vector *Vector `json:"vector,omitempty"`
+    Score  float32 `json:"score"`
+}
+
+ + + + + + + + + + + + + + + +

type ServerlessSpec + + + +

+

ServerlessSpec is the infrastructure specification of a serverless Pinecone Index. Only available for serverless Indexes. + +

type ServerlessSpec struct {
+    Cloud  Cloud  `json:"cloud"`
+    Region string `json:"region"`
+}
+
+ + + + + + + + + + + + + + + +

type SparseValues + + + +

+

SparseValues is a sparse vector objects, most commonly used for hybrid search. + +

type SparseValues struct {
+    Indices []uint32  `json:"indices,omitempty"`
+    Values  []float32 `json:"values,omitempty"`
+}
+
+ + + + + + + + + + + + + + + +

type UpdateVectorRequest + + + +

+

UpdateVectorRequest holds the parameters for the UpdateVectorRequest object, +which is passed into the UpdateVector method. +

Fields: +

    +
  • Id: The unique ID of the vector to update. +
  • Values: The values with which you want to update the vector. +
  • SparseValues: The sparse values with which you want to update the vector. +
  • Metadata: The metadata with which you want to update the vector. +
+ +
type UpdateVectorRequest struct {
+    Id           string
+    Values       []float32
+    SparseValues *SparseValues
+    Metadata     *Metadata
+}
+
+ + + + + + + + + + + + + + + +

type Usage + + + +

+

Usage is the usage stats (Read Units) for a Pinecone Index. + +

type Usage struct {
+    ReadUnits uint32 `json:"read_units"`
+}
+
+ + + + + + + + + + + + + + + +

type Vector + + + +

+

Vector is a dense or sparse vector object with optional metadata. + +

type Vector struct {
+    Id           string        `json:"id"`
+    Values       []float32     `json:"values,omitempty"`
+    SparseValues *SparseValues `json:"sparse_values,omitempty"`
+    Metadata     *Metadata     `json:"metadata,omitempty"`
+}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + From 1b7d12d9405febdcfa1c94b4b2c0975176cede29 Mon Sep 17 00:00:00 2001 From: Audrey Sage Lorberfeld Date: Tue, 16 Jul 2024 14:27:55 -0700 Subject: [PATCH 4/7] Delete --- docs/index.html | 3111 ----------------------------------------------- 1 file changed, 3111 deletions(-) delete mode 100644 docs/index.html diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index a19f36d..0000000 --- a/docs/index.html +++ /dev/null @@ -1,3111 +0,0 @@ -using module mode; GOMOD=/Users/audrey.lorberfeld/Desktop/src/go-pinecone/go.mod - - - - - - - - pinecone - Go Documentation Server - - - - - - - - - - - - - -
-... -
- -
- - - -
- -
- -
- - - -
-
- - -

- Package pinecone - -

- - - - - - - - - - - - - - - - - -
-
-
import "github.com/pinecone-io/go-pinecone/pinecone"
-
-
-
Overview
-
Index
- - -
-
- -
- -
-

Overview ▾

-

Package pinecone provides a client for the Pinecone managed vector database. - - -

-
- -
- -
-

Index ▾

- - -
-
- - - - - -
type Client
- - -
    func NewClient(in NewClientParams) (*Client, error)
- - -
    func NewClientBase(in NewClientBaseParams) (*Client, error)
- - - -
    func (c *Client) ConfigureIndex(ctx context.Context, name string, podType *string, replicas *int32) (*Index, error)
- - -
    func (c *Client) CreateCollection(ctx context.Context, in *CreateCollectionRequest) (*Collection, error)
- - -
    func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest) (*Index, error)
- - -
    func (c *Client) CreateServerlessIndex(ctx context.Context, in *CreateServerlessIndexRequest) (*Index, error)
- - -
    func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error
- - -
    func (c *Client) DeleteIndex(ctx context.Context, idxName string) error
- - -
    func (c *Client) DescribeCollection(ctx context.Context, collectionName string) (*Collection, error)
- - -
    func (c *Client) DescribeIndex(ctx context.Context, idxName string) (*Index, error)
- - -
    func (c *Client) Index(in NewIndexConnParams, dialOpts ...grpc.DialOption) (*IndexConnection, error)
- - -
    func (c *Client) ListCollections(ctx context.Context) ([]*Collection, error)
- - -
    func (c *Client) ListIndexes(ctx context.Context) ([]*Index, error)
- - - -
type Cloud
- - - - -
type Collection
- - - - -
type CollectionStatus
- - - - -
type CreateCollectionRequest
- - - - -
type CreatePodIndexRequest
- - - -
    func (req CreatePodIndexRequest) ReplicaCount() *int32
- - -
    func (req CreatePodIndexRequest) ShardCount() *int32
- - -
    func (req CreatePodIndexRequest) TotalCount() *int
- - - -
type CreateServerlessIndexRequest
- - - - -
type DescribeIndexStatsResponse
- - - - -
type FetchVectorsResponse
- - - - -
type Index
- - - - -
type IndexConnection
- - - -
    func (idx *IndexConnection) Close() error
- - -
    func (idx *IndexConnection) DeleteAllVectorsInNamespace(ctx context.Context) error
- - -
    func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *MetadataFilter) error
- - -
    func (idx *IndexConnection) DeleteVectorsById(ctx context.Context, ids []string) error
- - -
    func (idx *IndexConnection) DescribeIndexStats(ctx context.Context) (*DescribeIndexStatsResponse, error)
- - -
    func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *MetadataFilter) (*DescribeIndexStatsResponse, error)
- - -
    func (idx *IndexConnection) FetchVectors(ctx context.Context, ids []string) (*FetchVectorsResponse, error)
- - -
    func (idx *IndexConnection) ListVectors(ctx context.Context, in *ListVectorsRequest) (*ListVectorsResponse, error)
- - -
    func (idx *IndexConnection) QueryByVectorId(ctx context.Context, in *QueryByVectorIdRequest) (*QueryVectorsResponse, error)
- - -
    func (idx *IndexConnection) QueryByVectorValues(ctx context.Context, in *QueryByVectorValuesRequest) (*QueryVectorsResponse, error)
- - -
    func (idx *IndexConnection) UpdateVector(ctx context.Context, in *UpdateVectorRequest) error
- - -
    func (idx *IndexConnection) UpsertVectors(ctx context.Context, in []*Vector) (uint32, error)
- - - -
type IndexMetric
- - - - -
type IndexSpec
- - - - -
type IndexStatus
- - - - -
type IndexStatusState
- - - - -
type ListVectorsRequest
- - - - -
type ListVectorsResponse
- - - - -
type Metadata
- - - - -
type MetadataFilter
- - - - -
type NamespaceSummary
- - - - -
type NewClientBaseParams
- - - - -
type NewClientParams
- - - - -
type NewIndexConnParams
- - - - -
type PineconeError
- - - -
    func (pe *PineconeError) Error() string
- - - -
type PodSpec
- - - - -
type PodSpecMetadataConfig
- - - - -
type QueryByVectorIdRequest
- - - - -
type QueryByVectorValuesRequest
- - - - -
type QueryVectorsResponse
- - - - -
type ScoredVector
- - - - -
type ServerlessSpec
- - - - -
type SparseValues
- - - - -
type UpdateVectorRequest
- - - - -
type Usage
- - - - -
type Vector
- - - - -
-
- - - - -

Package files

-

- - - client.go - - errors.go - - index_connection.go - - models.go - - -

- -
-
- - - - - - - - - -

type Client - - - -

-

Client holds the parameters for connecting to the Pinecone service. It is returned by the NewClient and NewClientBase -functions. To use Client, first build the parameters of the request using NewClientParams (or NewClientBaseParams). -Then, pass those parameters into the NewClient (or NewClientBase) function to create a new Client object. -Once instantiated, you can use Client to execute control plane API requests (e.g. create an Index, list Indexes, -etc.). Read more about different control plane API routes at docs.pinecone.io/reference/api. -

Note: Client methods are safe for concurrent use. -

Fields: -

    -
  • headers: An optional map of additional HTTP headers to include in each API request to the control plane, -provided through NewClientParams.Headers or NewClientBaseParams.Headers. -
  • restClient: Optional underlying *http.Client object used to communicate with the Pinecone control plane API, -provided through NewClientParams.RestClient or NewClientBaseParams.RestClient. If not provided, -a default client is created for you. -
  • sourceTag: An optional string used to help Pinecone attribute API activity, provided through NewClientParams.SourceTag -or NewClientBaseParams.SourceTag. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams) // --> This creates a new Client object.
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    } else {
-	       fmt.Printf("Successfully found the \"%s\" index!\n", idx.Name)
-    }
-
-    idxConnection, err := pc.Index(idx.Host)
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    } else {
-	       log.Println("IndexConnection created successfully!")
-    }
-
- -
type Client struct {
-    // contains filtered or unexported fields
-}
-
- - - - - - - - - - - -

func NewClient - - - -

-
func NewClient(in NewClientParams) (*Client, error)
-

NewClient creates and initializes a new instance of Client. -This function sets up the control plane client with the necessary configuration for authentication and communication. -

Parameters: -

    -
  • in: A NewClientParams object. See NewClientParams for more information. -
-

Note: It is important to handle the error returned by this function to ensure that the -control plane client has been created successfully before attempting to make API calls. -

Returns a pointer to an initialized Client instance or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
- - - - - -

func NewClientBase - - - -

-
func NewClientBase(in NewClientBaseParams) (*Client, error)
-

NewClientBase creates and initializes a new instance of Client with custom authentication headers. -

Parameters: -

    -
  • in: A NewClientBaseParams object that includes the necessary configuration for the control plane client. See -NewClientBaseParams for more information. -
-

Notes: -

    -
  • It is important to handle the error returned by this function to ensure that the -control plane client has been created successfully before attempting to make API calls. -
  • A Pinecone API key is not requried when using NewClientBase. -
-

Returns a pointer to an initialized Client instance or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientBaseParams{
-        Headers: map[string]string{
-            "Authorization": "Bearer " + "<your JWT token>"
-            "X-Project-Id": "<Your Pinecone project ID>"
-        },
-        SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClientBase(clientParams)
-	       if err != nil {
-            log.Fatalf("Failed to create Client: %v", err)
-        } else {
-	           fmt.Println("Successfully created a new Client object!")
-    }
-
- - - - - - - -

func (*Client) ConfigureIndex - - - -

-
func (c *Client) ConfigureIndex(ctx context.Context, name string, podType *string,
-    replicas *int32) (*Index, error)
-

ConfigureIndex is used to scale a pods-based index up or down by changing the size of the pods or the number of -replicas. -

Parameters: -

    -
  • name: The name of the index to configure. -
  • pods: (Optional) The pod size to scale the index to (e.g. for a "p1" pod type, -you could pass "p1.x2" to scale your index to the "x2" size, -or you could pass "p1.x4" to scale your index to the "x4" size, and -so forth. -
  • replicas: (Optional) The number of replicas to scale the index to. -This is capped by the maximum number of replicas allowed in your Pinecone project. To configure this number, -go to app.pinecone.io, select your project, and configure the maximum number of pods. -
-

Note: You can only scale an index up, not down. If you want to scale an index down, -you must create a new index with the desired configuration. -

Returns a pointer to a configured Index object or an error. -

Example for a pods-based index originally configured with 1 "p1" pod of size "x2" and 1 replica: -

// To scale the size of your pods from "x2" to "x4":
- _, err := pc.ConfigureIndex(ctx, "my-index", "p1.x4", nil)
- if err != nil {
-     fmt.Printf("Failed to configure index: %v\n", err)
- }
-
-// To scale the number of replicas:
- _, err := pc.ConfigureIndex(ctx, "my-index", nil, 4)
- if err != nil {
-     fmt.Printf("Failed to configure index: %v\n", err)
- }
-
-// To scale both the size of your pods and the number of replicas:
- _, err := pc.ConfigureIndex(ctx, "my-index", "p1.x4", 4)
- if err != nil {
-     fmt.Printf("Failed to configure index: %v\n", err)
- }
-
- - - - - - -

func (*Client) CreateCollection - - - -

-
func (c *Client) CreateCollection(ctx context.Context, in *CreateCollectionRequest) (*Collection, error)
-

CreateCollection creates and initializes a new Collection via the specified Client. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • in: A pointer to a CreateCollectionRequest object. -
-

Note: Collections are only available for pods-based Indexes. -

Returns a pointer to a Collection object or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
-        Name:   "my-collection",
-        Source: "my-source-index",
-    })
-    if err != nil {
-	       log.Fatalf("Failed to create collection: %v", err)
-    } else {
-	       fmt.Printf("Successfully created collection \"%s\".", collection.Name)
-    }
-
- - - - - - -

func (*Client) CreatePodIndex - - - -

-
func (c *Client) CreatePodIndex(ctx context.Context, in *CreatePodIndexRequest) (*Index, error)
-

CreatePodIndex creates and initializes a new pods-based Index via the specified Client. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • in: A pointer to a CreatePodIndexRequest object. See CreatePodIndexRequest for more information. -
-

Returns a pointer to an Index object or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    podIndexMetadata := &pinecone.PodSpecMetadataConfig{
-	       Indexed: &[]string{"title", "description"},
-    }
-
-    idx, err := pc.CreatePodIndex(ctx, &pinecone.CreatePodIndexRequest{
-        Name:        "my-pod-index",
-        Dimension:   3,
-        Metric:      pinecone.Cosine,
-        Environment: "us-west1-gcp",
-        PodType:     "s1",
-        MetadataConfig: podIndexMetadata,
-    })
-
-    if err != nil {
-	       log.Fatalf("Failed to create pod index:", err)
-    } else {
-	       fmt.Printf("Successfully created pod index: %s", idx.Name)
-    }
-
- - - - - - -

func (*Client) CreateServerlessIndex - - - -

-
func (c *Client) CreateServerlessIndex(ctx context.Context, in *CreateServerlessIndexRequest) (*Index, error)
-

CreateServerlessIndex creates and initializes a new serverless Index via the specified Client. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • in: A pointer to a CreateServerlessIndexRequest object. See CreateServerlessIndexRequest for more information. -
-

Returns a pointer to an Index object or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    idx, err := pc.CreateServerlessIndex(ctx, &pinecone.CreateServerlessIndexRequest{
-        Name:    "my-serverless-index",
-        Dimension: 3,
-        Metric:  pinecone.Cosine,
-        Cloud:   pinecone.Aws,
-        Region:  "us-east-1",
-    })
-
-    if err != nil {
-        log.Fatalf("Failed to create serverless index: %s", idx.Name)
-    } else {
-        fmt.Printf("Successfully created serverless index: %s", idx.Name)
-    }
-
- - - - - - -

func (*Client) DeleteCollection - - - -

-
func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error
-

DeleteCollection deletes a specific Collection -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • collectionName: The name of the Collection to delete. -
-

Note: Collections are only available for pods-based Indexes. -

Returns an error if the deletion fails. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    collectionName := "my-collection"
-
-    err = pc.DeleteCollection(ctx, collectionName)
-    if err != nil {
-	       log.Fatalf("Failed to create collection: %s\n", err)
-    } else {
-	       log.Printf("Successfully deleted collection \"%s\"\n", collectionName)
-    }
-
- - - - - - -

func (*Client) DeleteIndex - - - -

-
func (c *Client) DeleteIndex(ctx context.Context, idxName string) error
-

DeleteIndex deletes a specific Index. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • idxName: The name of the Index to delete. -
-

Returns an error if the deletion fails. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    indexName := "the-name-of-my-index"
-
-    err = pc.DeleteIndex(ctx, indexName)
-    if err != nil {
-	       log.Fatalf("Error: %v", err)
-    } else {
-        fmt.Printf("Index \"%s\" deleted successfully", indexName)
-    }
-
- - - - - - -

func (*Client) DescribeCollection - - - -

-
func (c *Client) DescribeCollection(ctx context.Context, collectionName string) (*Collection, error)
-

DescribeCollection retrieves information about a specific Collection. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • collectionName: The name of the Collection to describe. -
-

Returns a pointer to a Collection object or an error. -

Note: Collections are only available for pods-based Indexes. -

Since the returned value is a pointer to a Collection object, it will have the following fields: -

    -
  • Name: The name of the Collection. -
  • Size: The size of the Collection in bytes. -
  • Status: The status of the Collection. -
  • Dimension: The dimensionality of the vectors stored in each record held in the Collection. -
  • VectorCount: The number of records stored in the Collection. -
  • Environment: The cloud environment where the Collection is hosted. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    collection, err := pc.DescribeCollection(ctx, "my-collection")
-    if err != nil {
-	       log.Fatalf("Error describing collection: %v", err)
-    } else {
-	       fmt.Printf("Collection: %+v\n", *collection)
-    }
-
- - - - - - -

func (*Client) DescribeIndex - - - -

-
func (c *Client) DescribeIndex(ctx context.Context, idxName string) (*Index, error)
-

DescribeIndex retrieves information about a specific Index. See Index for more information. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
  • idxName: The name of the Index to describe. -
-

Returns a pointer to an Index object or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "the-name-of-my-index")
-    if err != nil {
-        log.Fatalf("Failed to describe index: %s", err)
-    } else {
-        fmt.Printf("%+v", *idx)
-    }
-
- - - - - - -

func (*Client) Index - - - -

-
func (c *Client) Index(in NewIndexConnParams, dialOpts ...grpc.DialOption) (*IndexConnection, error)
-

Index creates an IndexConnection to a specified host. -

Parameters: -

    -
  • in: A NewIndexConnParams object that includes the necessary configuration to create an IndexConnection. -See NewIndexConnParams for more information. -
-

Note: It is important to handle the error returned by this method to ensure that the IndexConnection is created -successfully before making data plane calls. -

Returns a pointer to an IndexConnection instance or an error. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    } else {
-	       fmt.Printf("Successfully found the \"%s\" index!\n", idx.Name)
-    }
-
-    indexConnParams := pinecone.NewIndexConnParams{
-	       Host: idx.Host,
-	       Namespace: "your-namespace",
-	       AdditionalMetadata: map[string]string{
-		       "your-metadata-key": "your-metadata-value",
-	       },
-    }
-
-    idxConnection, err := pc.Index(indexConnParams)
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    } else {
-	       log.Println("IndexConnection created successfully!")
-    }
-
- - - - - - -

func (*Client) ListCollections - - - -

-
func (c *Client) ListCollections(ctx context.Context) ([]*Collection, error)
-

ListCollections retrieves a list of all Collections in a Pinecone project. See Collection for more information. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
-

Returns a slice of pointers to Collection objects or an error. -

Note: Collections are only available for pods-based Indexes. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    collections, err := pc.ListCollections(ctx)
-    if err != nil {
-	       log.Fatalf("Failed to list collections: %v", err)
-    } else {
-	       if len(collections) == 0 {
-	           fmt.Printf("No collections found in project")
-	       } else {
-	           fmt.Println("Collections in project:")
-	           for _, collection := range collections {
-		           fmt.Printf("- %s\n", collection.Name)
-	           }
-	       }
-    }
-
- - - - - - -

func (*Client) ListIndexes - - - -

-
func (c *Client) ListIndexes(ctx context.Context) ([]*Index, error)
-

ListIndexes retrieves a list of all Indexes in a Pinecone project. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, allowing for the request -to be canceled or to timeout according to the context's deadline. -
-

Returns a slice of pointers to Index objects or an error. -

Example: -

    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    idxs, err := pc.ListIndexes(ctx)
-    if err != nil {
-	       log.Fatalf("Failed to list indexes: %v", err)
-    } else {
-	       fmt.Println("Your project has the following indexes:")
-	       for _, idx := range idxs {
-		       fmt.Printf("- \"%s\"\n", idx.Name)
-	       }
-    }
-
- - - - - - - - -

type Cloud - - - -

-

Cloud is the cloud provider to be used for a Pinecone serverless Index. - -

type Cloud string
- - - -
const (
-    Aws   Cloud = "aws"
-    Azure Cloud = "azure"
-    Gcp   Cloud = "gcp"
-)
- - - - - - - - - - - - - - -

type Collection - - - -

-

Collection is a Pinecone Collection object. Only available for pod-based Indexes. - -

type Collection struct {
-    Name        string           `json:"name"`
-    Size        int64            `json:"size"`
-    Status      CollectionStatus `json:"status"`
-    Dimension   int32            `json:"dimension"`
-    VectorCount int32            `json:"vector_count"`
-    Environment string           `json:"environment"`
-}
-
- - - - - - - - - - - - - - - -

type CollectionStatus - - - -

-

CollectionStatus is the status of a Pinecone Collection. - -

type CollectionStatus string
- - - -
const (
-    CollectionStatusInitializing CollectionStatus = "Initializing"
-    CollectionStatusReady        CollectionStatus = "Ready"
-    CollectionStatusTerminating  CollectionStatus = "Terminating"
-)
- - - - - - - - - - - - - - -

type CreateCollectionRequest - - - -

-

CreateCollectionRequest holds the parameters for creating a new Collection. -

Fields: -

    -
  • Name: The name of the Collection. -
  • Source: The name of the Index to be used as the source for the Collection. -
-

To create a new Collection, use the CreateCollection method on the Client object. -

Note: Collections are only available for pods-based Indexes. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    collection, err := pc.CreateCollection(ctx, &pinecone.CreateCollectionRequest{
-        Name:   "my-collection",
-        Source: "my-source-index",
-     })
-    if err != nil {
-	       log.Fatalf("Failed to create collection: %v", err)
-    } else {
-	       fmt.Printf("Successfully created collection \"%s\".", collection.Name)
-    }
-
- -
type CreateCollectionRequest struct {
-    Name   string
-    Source string
-}
-
- - - - - - - - - - - - - - - -

type CreatePodIndexRequest - - - -

-

CreatePodIndexRequest holds the parameters for creating a new pods-based Index. -

Fields: -

    -
  • Name: The name of the Index. Resource name must be 1-45 characters long, -start and end with an alphanumeric character, -and consist only of lower case alphanumeric characters or '-'. -
  • Dimension: The dimensionality of the vectors to be inserted in the Index. -
  • Metric: The distance metric to be used for similarity search. You can use -'euclidean', 'cosine', or 'dotproduct'. -
  • Environment: The cloud environment where the Index will be hosted. -
  • PodType: The [type of pod] to use for the Index. One of `s1`, `p1`, or `p2` appended with `.` and -one of `x1`, `x2`, `x4`, or `x8`. -
  • Shards: The number of shards to use for the Index (defaults to 1). -Shards split your data across multiple pods, so you can fit more data into an Index. -
  • Replicas: The number of replicas to use for the Index (defaults to 1). Replicas duplicate your Index. -They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. -
  • SourceCollection: The name of the Collection to be used as the source for the Index. -
  • MetadataConfig: The metadata 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. These configurations are -only valid for use with pod-based Indexes. -
-

To create a new pods-based Index, use the CreatePodIndex method on the Client object. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    podIndexMetadata := &pinecone.PodSpecMetadataConfig{
-	       Indexed: &[]string{"title", "description"},
-    }
-
-    idx, err := pc.CreatePodIndex(ctx, &pinecone.CreatePodIndexRequest{
-        Name:        "my-pod-index",
-        Dimension:   3,
-        Metric:      pinecone.Cosine,
-        Environment: "us-west1-gcp",
-        PodType:     "s1",
-        MetadataConfig: podIndexMetadata,
-        })
-
-    if err != nil {
-	       log.Fatalf("Failed to create pod index: %v", err)
-    } else {
-	       fmt.Printf("Successfully created pod index: %s", idx.Name)
-    }
-
- -
type CreatePodIndexRequest struct {
-    Name             string
-    Dimension        int32
-    Metric           IndexMetric
-    Environment      string
-    PodType          string
-    Shards           int32
-    Replicas         int32
-    SourceCollection *string
-    MetadataConfig   *PodSpecMetadataConfig
-}
-
- - - - - - - - - - - - - -

func (CreatePodIndexRequest) ReplicaCount - - - -

-
func (req CreatePodIndexRequest) ReplicaCount() *int32
-

ReplicaCount ensures the replica count of a pods-based Index is >1. -It returns a pointer to the number of replicas on a CreatePodIndexRequest object. - - - - - - -

func (CreatePodIndexRequest) ShardCount - - - -

-
func (req CreatePodIndexRequest) ShardCount() *int32
-

ShardCount ensures the number of shards on a pods-based Index is >1. It returns a pointer to the number of shards on -a CreatePodIndexRequest object. - - - - - - -

func (CreatePodIndexRequest) TotalCount - - - -

-
func (req CreatePodIndexRequest) TotalCount() *int
-

TotalCount calculates and returns the total number of pods (replicas*shards) on a CreatePodIndexRequest object. - - - - - - - - -

type CreateServerlessIndexRequest - - - -

-

CreateServerlessIndexRequest holds the parameters for creating a new Serverless Index. -

Fields: -

    -
  • Name: The name of the Index. Resource name must be 1-45 characters long, -start and end with an alphanumeric character, -and consist only of lower case alphanumeric characters or '-'. -
  • Dimension: The dimensionality of the vectors to be inserted in the Index. -
  • Metric: The metric used to measure the similarity between vectors ('euclidean', 'cosine', or 'dotproduct'). -
  • Cloud: The public cloud provider where you would like your Index hosted. -For serverless Indexes, you define only the cloud and region where the Index should be hosted. -
  • Region: The region where you would like your Index to be created. -
-

To create a new Serverless Index, use the CreateServerlessIndex method on the Client object. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-    if err != nil {
-        log.Fatalf("Failed to create Client: %v", err)
-    } else {
-	       fmt.Println("Successfully created a new Client object!")
-    }
-
-    idx, err := pc.CreateServerlessIndex(ctx, &pinecone.CreateServerlessIndexRequest{
-        Name:    "my-serverless-index",
-        Dimension: 3,
-        Metric:  pinecone.Cosine,
-        Cloud:   pinecone.Aws,
-        Region:  "us-east-1",
-    })
-
-    if err != nil {
-        log.Fatalf("Failed to create serverless index: %s", idx.Name)
-    } else {
-        fmt.Printf("Successfully created serverless index: %s", idx.Name)
-    }
-
- -
type CreateServerlessIndexRequest struct {
-    Name      string
-    Dimension int32
-    Metric    IndexMetric
-    Cloud     Cloud
-    Region    string
-}
-
- - - - - - - - - - - - - - - -

type DescribeIndexStatsResponse - - - -

-

DescribeIndexStatsResponse holds the parameters for the DescribeIndexStatsResponse object, -which is returned by the DescribeIndexStats method. -

Fields: -

    -
  • Dimension: The dimension of the index. -
  • IndexFullness: The fullness level of the index. Note: only available on pods-based indexes. -
  • TotalVectorCount: The total number of vectors in the index. -
  • Namespaces: The namespace(s) in the index. -
- -
type DescribeIndexStatsResponse struct {
-    Dimension        uint32                       `json:"dimension"`
-    IndexFullness    float32                      `json:"index_fullness"`
-    TotalVectorCount uint32                       `json:"total_vector_count"`
-    Namespaces       map[string]*NamespaceSummary `json:"namespaces,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type FetchVectorsResponse - - - -

-

FetchVectorsResponse holds the parameters for the FetchVectorsResponse object, -which is returned by the FetchVectors method. -

Fields: -

    -
  • Vectors: The vectors fetched. -
  • Usage: The usage information for the request. -
- -
type FetchVectorsResponse struct {
-    Vectors map[string]*Vector `json:"vectors,omitempty"`
-    Usage   *Usage             `json:"usage,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type Index - - - -

-

Index is a Pinecone Index object. Can be either a pod-based or a serverless Index, depending on the IndexSpec. - -

type Index struct {
-    Name      string       `json:"name"`
-    Dimension int32        `json:"dimension"`
-    Host      string       `json:"host"`
-    Metric    IndexMetric  `json:"metric"`
-    Spec      *IndexSpec   `json:"spec,omitempty"`
-    Status    *IndexStatus `json:"status,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type IndexConnection - - - -

-

IndexConnection holds the parameters for a Pinecone IndexConnection object. -

Fields: -

    -
  • Namespace: The namespace where index operations will be performed. -
  • additionalMetadata: Additional metadata to be sent with each RPC request. -
  • dataClient: The gRPC client for the index. -
  • grpcConn: The gRPC connection. -
- -
type IndexConnection struct {
-    Namespace string
-    // contains filtered or unexported fields
-}
-
- - - - - - - - - - - - - -

func (*IndexConnection) Close - - - -

-
func (idx *IndexConnection) Close() error
-

Close closes the grpc.ClientConn to a Pinecone index. -

Returns an error if the connection cannot be closed, otherwise returns nil. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection: %v", err)
-    }
-
-    err = idxConnection.Close()
-
-    if err != nil {
-	       log.Fatalf("Failed to close index connection. Error: %v", err)
-    }
-
- - - - - - -

func (*IndexConnection) DeleteAllVectorsInNamespace - - - -

-
func (idx *IndexConnection) DeleteAllVectorsInNamespace(ctx context.Context) error
-

DeleteAllVectorsInNamespace deletes all vectors in a specific namespace. -

Returns an error if the request fails, otherwise returns nil. -

Note: You must instantiate an IndexWithNamespace connection in order to delete vectors by ID in namespaces other -than the default. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    err = idxConnection.DeleteAllVectorsInNamespace(ctx)
-
-    if err != nil {
-	       log.Fatalf("Failed to delete vectors in namespace: \"%s\". Error: %s", idxConnection.Namespace, err)
-    }
-
- - - - - - -

func (*IndexConnection) DeleteVectorsByFilter - - - -

-
func (idx *IndexConnection) DeleteVectorsByFilter(ctx context.Context, filter *MetadataFilter) error
-

DeleteVectorsByFilter deletes vectors from a Pinecone index, given a filter. -

Returns an error if the request fails, otherwise returns nil. -

Note: DeleteVectorsByFilter is only available on pods-based indexes. -Additionally, you must instantiate an IndexWithNamespace connection in order to delete vectors in namespaces -other than the default. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • filter: The filter to apply to the deletion. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	        log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    metadataFilter := map[string]interface{}{
-	       "genre": "classical",
-    }
-
-    filter, err := structpb.NewStruct(metadataFilter)
-
-    if err != nil {
-	       log.Fatalf("Failed to create metadata filter. Error: %v", err)
-    }
-
-    err = idxConnection.DeleteVectorsByFilter(ctx, filter)
-
-    if err != nil {
-	       log.Fatalf("Failed to delete vector(s) with filter: %+v. Error: %s\n", filter, err)
-    }
-
- - - - - - -

func (*IndexConnection) DeleteVectorsById - - - -

-
func (idx *IndexConnection) DeleteVectorsById(ctx context.Context, ids []string) error
-

DeleteVectorsById deletes vectors by ID from a Pinecone index. -

Returns an error if the request fails, -otherwise returns nil. This method will also return nil if the passed vector ID does not exist in the index or -namespace. -

Note: You must instantiate an IndexWithNamespace connection in order to delete vectors by ID in namespaces other -than the default. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • ids: IDs of the vectors you want to delete. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host, Namespace: "custom-namespace"})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    vectorId := "your-vector-id"
-    err = idxConnection.DeleteVectorsById(ctx, []string{vectorId})
-
-    if err != nil {
-	       log.Fatalf("Failed to delete vector with ID: %s. Error: %s\n", vectorId, err)
-    }
-
- - - - - - -

func (*IndexConnection) DescribeIndexStats - - - -

-
func (idx *IndexConnection) DescribeIndexStats(ctx context.Context) (*DescribeIndexStatsResponse, error)
-

DescribeIndexStats returns statistics about a Pinecone index. -

Returns a pointer to a DescribeIndexStatsResponse object or an error if the request fails. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index:", err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    res, err := idxConnection.DescribeIndexStats(ctx)
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error: %s", idx.Name, err)
-    } else {
-	       log.Fatalf("%+v", *res)
-    }
-
- - - - - - -

func (*IndexConnection) DescribeIndexStatsFiltered - - - -

-
func (idx *IndexConnection) DescribeIndexStatsFiltered(ctx context.Context, filter *MetadataFilter) (*DescribeIndexStatsResponse, error)
-

DescribeIndexStatsFiltered returns statistics about a Pinecone index, filtered by a given filter. -

Returns a pointer to a DescribeIndexStatsResponse object or an error if the request fails. -

Note: DescribeIndexStatsFiltered is only available on pods-based indexes. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • filter: The filter to apply to the request. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    metadataFilter := map[string]interface{}{
-	       "genre": "classical",
-    }
-
-    filter, err := structpb.NewStruct(metadataFilter)
-
-    if err != nil {
-	       log.Fatalf("Failed to create filter %+v. Error: %s", metadataFilter, err)
-    }
-
-    res, err := idxConnection.DescribeIndexStatsFiltered(ctx, filter)
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error: %s", idx.Name, err)
-    } else {
-	       for name, summary := range res.Namespaces {
-		       fmt.Printf("Namespace: \"%s\", has %d vector(s) that match the given filter\n", name, summary.VectorCount)
-	       }
-    }
-
- - - - - - -

func (*IndexConnection) FetchVectors - - - -

-
func (idx *IndexConnection) FetchVectors(ctx context.Context, ids []string) (*FetchVectorsResponse, error)
-

FetchVectors fetches vectors by ID from a Pinecone index. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • ids: The unique IDs of the vectors to fetch. -
-

Returns a pointer to any fetched vectors or an error if the request fails. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    res, err := idxConnection.FetchVectors(ctx, []string{"abc-1"})
-
-    if err != nil {
-	       log.Fatalf("Failed to fetch vectors, error: %+v", err)
-    }
-
-    if len(res.Vectors) != 0 {
-	       fmt.Println(res)
-    } else {
-	       fmt.Println("No vectors found")
-    }
-
- - - - - - -

func (*IndexConnection) ListVectors - - - -

-
func (idx *IndexConnection) ListVectors(ctx context.Context, in *ListVectorsRequest) (*ListVectorsResponse, error)
-

ListVectors lists vectors in a Pinecone index. You can filter vectors by prefix, -limit the number of vectors returned, and paginate through results. -

Note: ListVectors is only available for Serverless indexes. -

Returns a pointer to a ListVectorsResponse object or an error if the request fails. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • in: A ListVectorsRequest object with the parameters for the request. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    prefix := "abc"
-    limit := uint32(10)
-
-    res, err := idxConnection.ListVectors(ctx, &pinecone.ListVectorsRequest{
-	       Prefix: &prefix,
-	       Limit:  &limit,
-    })
-
-    if err != nil {
-	       log.Fatalf("Failed to list vectors in index: %s. Error: %s\n", idx.Name, err)
-    }
-
-    if len(res.VectorIds) == 0 {
-	       fmt.Println("No vectors found")
-    } else {
-	       fmt.Printf("Found %d vector(s)\n", len(res.VectorIds))
-    }
-
- - - - - - -

func (*IndexConnection) QueryByVectorId - - - -

-
func (idx *IndexConnection) QueryByVectorId(ctx context.Context, in *QueryByVectorIdRequest) (*QueryVectorsResponse, error)
-

QueryByVectorId uses a vector ID to query a Pinecone index and retrieve vectors that are most similar to the -provided ID's underlying vector. -

Returns a pointer to a QueryVectorsResponse object or an error if the request fails. -

Note: QueryByVectorId executes a nearest neighbors search, -meaning that unless TopK=1 in the QueryByVectorIdRequest object, -it will return 2+ vectors. The vector with a score of 1.0 is the vector with the same ID as the query vector. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • in: A QueryByVectorIdRequest object with the parameters for the request. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    vectorId := "abc-1"
-    topK := uint32(10)
-
-    res, err := idxConnection.QueryByVectorId(ctx, &pinecone.QueryByVectorIdRequest{
-	       VectorId:        vectorId,
-	       TopK:            topK, // number of vectors you want returned
-	       IncludeValues:   true,
-	       IncludeMetadata: true,
-    })
-
-    if err != nil {
-	       log.Fatalf("Error encountered when querying by vector ID `%s`. Error: %s", vectorId, err)
-    } else {
-	       for _, match := range res.Matches {
-		       fmt.Printf("Match vector with ID `%s`, with score %f\n", match.Vector.Id, match.Score)
-	       }
-    }
-
- - - - - - -

func (*IndexConnection) QueryByVectorValues - - - -

-
func (idx *IndexConnection) QueryByVectorValues(ctx context.Context, in *QueryByVectorValuesRequest) (*QueryVectorsResponse, error)
-

QueryByVectorValues queries a Pinecone index for vectors that are most similar to a provided query vector. -

Returns a pointer to a QueryVectorsResponse object or an error if the request fails. -

Note: To issue a hybrid query with both dense and sparse values, -your index's similarity metric must be dot-product. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • in: A QueryByVectorValuesRequest object with the parameters for the request. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    queryVector := []float32{1.0, 2.0}
-    topK := uint32(10)
-
-    metadataMap := map[string]interface{}{
-	       "genre": "classical",
-    }
-
-    metadataFilter, err := structpb.NewStruct(metadataMap)
-
-    if err != nil {
-	       log.Fatalf("Failed to create metadata map. Error: %v", err)
-    }
-
-    sparseValues := pinecone.SparseValues{
-	       Indices: []uint32{0, 1},
-	       Values:  []float32{1.0, 2.0},
-    }
-
-    res, err := idxConnection.QueryByVectorValues(ctx, &pinecone.QueryByVectorValuesRequest{
-	       Vector:          queryVector,
-	       TopK:            topK, // number of vectors to be returned
-	       MetadataFilter:          metadataFilter,
-	       SparseValues:    &sparseValues,
-	       IncludeValues:   true,
-	       IncludeMetadata: true,
-    })
-
-    if err != nil {
-	       log.Fatalf("Error encountered when querying by vector: %v", err)
-    } else {
-	       for _, match := range res.Matches {
-		       fmt.Printf("Match vector `%s`, with score %f\n", match.Vector.Id, match.Score)
-	       }
-    }
-
- - - - - - -

func (*IndexConnection) UpdateVector - - - -

-
func (idx *IndexConnection) UpdateVector(ctx context.Context, in *UpdateVectorRequest) error
-

UpdateVector updates a vector in a Pinecone index by ID. -

Returns an error if the request fails, returns nil otherwise. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • in: An UpdateVectorRequest object with the parameters for the request. -
-

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    id := "abc-1"
-
-    err = idxConnection.UpdateVector(ctx, &pinecone.UpdateVectorRequest{
-	       Id:     id,
-	       Values: []float32{7.0, 8.0},
-    })
-
-    if err != nil {
-	       log.Fatalf("Failed to update vector with ID %s. Error: %s", id, err)
-    }
-
- - - - - - -

func (*IndexConnection) UpsertVectors - - - -

-
func (idx *IndexConnection) UpsertVectors(ctx context.Context, in []*Vector) (uint32, error)
-

UpsertVectors upserts vectors into a Pinecone index. -

Parameters: -

    -
  • ctx: A context.Context object controls the request's lifetime, -allowing for the request to be canceled or to timeout according to the context's deadline. -
  • in: The vectors to upsert. -
-

Returns the number of vectors upserted or an error if the request fails. -

Example: -

    ctx := context.Background()
-
-    clientParams := pinecone.NewClientParams{
-	       ApiKey:    "YOUR_API_KEY",
-	       SourceTag: "your_source_identifier", // optional
-    }
-
-    pc, err := pinecone.NewClient(clientParams)
-
-    if err != nil {
-	       log.Fatalf("Failed to create Client: %v", err)
-    }
-
-    idx, err := pc.DescribeIndex(ctx, "your-index-name")
-
-    if err != nil {
-	       log.Fatalf("Failed to describe index \"%s\". Error:%s", idx.Name, err)
-    }
-
-    idxConnection, err := pc.Index(pinecone.NewIndexConnParams{Host: idx.Host})
-
-    if err != nil {
-	       log.Fatalf("Failed to create IndexConnection for Host: %v. Error: %v", idx.Host, err)
-    }
-
-    metadataMap := map[string]interface{}{
-	       "genre": "classical",
-    }
-
-    metadata, err := structpb.NewStruct(metadataMap)
-
-    if err != nil {
-	       log.Fatalf("Failed to create metadata map. Error: %v", err)
-    }
-
-    sparseValues := pinecone.SparseValues{
-	       Indices: []uint32{0, 1},
-	       Values:  []float32{1.0, 2.0},
-    }
-
-    vectors := []*pinecone.Vector{
-	       {
-		       Id:           "abc-1",
-		       Values:       []float32{1.0, 2.0},
-		       Metadata:     metadata,
-		       SparseValues: &sparseValues,
-	       },
-    }
-
-    count, err := idxConnection.UpsertVectors(ctx, vectors)
-
-    if err != nil {
-	       log.Fatalf("Failed to upsert vectors. Error: %v", err)
-    } else {
-	       log.Fatalf("Successfully upserted %d vector(s)!\n", count)
-    }
-
- - - - - - - - -

type IndexMetric - - - -

-

IndexMetric is the distance metric to be used by similarity search against a Pinecone Index. - -

type IndexMetric string
- - - -
const (
-    Cosine     IndexMetric = "cosine"     // Default distance metric, ideal for textual data
-    Dotproduct IndexMetric = "dotproduct" // Ideal for hybrid search
-    Euclidean  IndexMetric = "euclidean"  // Ideal for distance-based data (e.g. lat/long points)
-)
- - - - - - - - - - - - - - -

type IndexSpec - - - -

-

IndexSpec is the infrastructure specification (pods vs serverless) of a Pinecone Index. - -

type IndexSpec struct {
-    Pod        *PodSpec        `json:"pod,omitempty"`
-    Serverless *ServerlessSpec `json:"serverless,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type IndexStatus - - - -

-

IndexStatus is the status of a Pinecone Index. - -

type IndexStatus struct {
-    Ready bool             `json:"ready"`
-    State IndexStatusState `json:"state"`
-}
-
- - - - - - - - - - - - - - - -

type IndexStatusState - - - -

-

IndexStatusState is the state of a Pinecone Index. - -

type IndexStatusState string
- - - -
const (
-    InitializationFailed IndexStatusState = "InitializationFailed"
-    Initializing         IndexStatusState = "Initializing"
-    Ready                IndexStatusState = "Ready"
-    ScalingDown          IndexStatusState = "ScalingDown"
-    ScalingDownPodSize   IndexStatusState = "ScalingDownPodSize"
-    ScalingUp            IndexStatusState = "ScalingUp"
-    ScalingUpPodSize     IndexStatusState = "ScalingUpPodSize"
-    Terminating          IndexStatusState = "Terminating"
-)
- - - - - - - - - - - - - - -

type ListVectorsRequest - - - -

-

ListVectorsRequest holds the parameters for the ListVectorsRequest object, -which is passed into the ListVectors method. -

Fields: -

    -
  • Prefix: The prefix by which to filter. If unspecified, -an empty string will be used which will list all vector ids in the namespace -
  • Limit: The maximum number of vectors to return. If unspecified, the server will use a default value. -
  • PaginationToken: The token for paginating through results. -
- -
type ListVectorsRequest struct {
-    Prefix          *string
-    Limit           *uint32
-    PaginationToken *string
-}
-
- - - - - - - - - - - - - - - -

type ListVectorsResponse - - - -

-

ListVectorsResponse holds the parameters for the ListVectorsResponse object, -which is returned by the ListVectors method. -

Fields: -

    -
  • VectorIds: The unique IDs of the returned vectors. -
  • Usage: The usage information for the request. -
  • NextPaginationToken: The token for paginating through results. -
- -
type ListVectorsResponse struct {
-    VectorIds           []*string `json:"vector_ids,omitempty"`
-    Usage               *Usage    `json:"usage,omitempty"`
-    NextPaginationToken *string   `json:"next_pagination_token,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type Metadata - - - -

-

Metadata represents optional, -additional information that can be attached to, or updated for, a vector in a Pinecone Index. - -

type Metadata = structpb.Struct
- - - - - - - - - - - - - - - -

type MetadataFilter - - - -

-

MetadataFilter represents the metadata filters attached to a Pinecone request. -These optional metadata filters are applied to query and deletion requests. - -

type MetadataFilter = structpb.Struct
- - - - - - - - - - - - - - - -

type NamespaceSummary - - - -

-

NamespaceSummary is a summary of stats for a Pinecone namespace. - -

type NamespaceSummary struct {
-    VectorCount uint32 `json:"vector_count"`
-}
-
- - - - - - - - - - - - - - - -

type NewClientBaseParams - - - -

-

NewClientBaseParams holds the parameters for creating a new Client instance while passing custom authentication -headers. -

Fields: -

    -
  • Headers: An optional map of additional HTTP headers to include in each API request to the control plane. -"Authorization" and "X-Project-Id" headers are required if authenticating using a JWT. -
  • Host: The host URL of the Pinecone control plane API. If not provided, -the default value is "https://api.pinecone.io". -
  • RestClient: An optional *http.Client object to use for communication with the control plane API. -
  • SourceTag: An optional string used to help Pinecone attribute API activity. -
-

See Client for code example. - -

type NewClientBaseParams struct {
-    Headers    map[string]string
-    Host       string
-    RestClient *http.Client
-    SourceTag  string
-}
-
- - - - - - - - - - - - - - - -

type NewClientParams - - - -

-

NewClientParams holds the parameters for creating a new Client instance while authenticating via an API key. -

Fields: -

    -
  • ApiKey: (Required) The API key used to authenticate with the Pinecone control plane API. -This value must be passed by the user unless it is set as an environment variable ("PINECONE_API_KEY"). -
  • Headers: An optional map of additional HTTP headers to include in each API request to the control plane. -
  • Host: The host URL of the Pinecone control plane API. If not provided, -the default value is "https://api.pinecone.io". -
  • RestClient: An optional HTTP client to use for communication with the control plane API. -
  • SourceTag: An optional string used to help Pinecone attribute API activity. -
-

See Client for code example. - -

type NewClientParams struct {
-    ApiKey     string            // required - provide through NewClientParams or environment variable PINECONE_API_KEY
-    Headers    map[string]string // optional
-    Host       string            // optional
-    RestClient *http.Client      // optional
-    SourceTag  string            // optional
-}
-
- - - - - - - - - - - - - - - -

type NewIndexConnParams - - - -

-

NewIndexConnParams holds the parameters for creating an IndexConnection to a Pinecone index. -

Fields: -

    -
  • Host: The host URL of the Pinecone index. This is required. To find your host url use the DescribeIndex or ListIndexes methods. -Alternatively, the host is displayed in the Pinecone web console. -
  • Namespace: Optional index namespace to use for operations. If not provided, the default namespace of "" will be used. -
  • AdditionalMetdata: Optional additional metdata to be sent with each RPC request. -
-

See Client.Index for code example. - -

type NewIndexConnParams struct {
-    Host               string            // required - obtained through DescribeIndex or ListIndexes
-    Namespace          string            // optional - if not provided the default namespace of "" will be used
-    AdditionalMetadata map[string]string // optional
-}
-
- - - - - - - - - - - - - - - -

type PineconeError - - - -

- -
type PineconeError struct {
-    Code int
-    Msg  error
-}
-
- - - - - - - - - - - - - -

func (*PineconeError) Error - - - -

-
func (pe *PineconeError) Error() string
- - - - - - - - -

type PodSpec - - - -

-

PodSpec is the infrastructure specification of a pod-based Pinecone Index. Only available for pod-based Indexes. - -

type PodSpec struct {
-    Environment      string                 `json:"environment"`
-    PodType          string                 `json:"pod_type"`
-    PodCount         int32                  `json:"pod_count"`
-    Replicas         int32                  `json:"replicas"`
-    ShardCount       int32                  `json:"shard_count"`
-    SourceCollection *string                `json:"source_collection,omitempty"`
-    MetadataConfig   *PodSpecMetadataConfig `json:"metadata_config,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type PodSpecMetadataConfig - - - -

-

PodSpecMetadataConfig represents the metadata fields to be indexed when a Pinecone Index is created. - -

type PodSpecMetadataConfig struct {
-    Indexed *[]string `json:"indexed,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type QueryByVectorIdRequest - - - -

-

QueryByVectorIdRequest holds the parameters for the QueryByVectorIdRequest object, -which is passed into the QueryByVectorId method. -

Fields: -

    -
  • VectorId: The unique ID of the vector used to find similar vectors. -
  • TopK: The number of vectors to return. -
  • MetadataFilter: The filter to apply to your query. -
  • IncludeValues: Whether to include the values of the vectors in the response. -
  • IncludeMetadata: Whether to include the metadata associated with the vectors in the response. -
  • SparseValues: The sparse values of the query vector, if applicable. -
- -
type QueryByVectorIdRequest struct {
-    VectorId        string
-    TopK            uint32
-    Filter          *MetadataFilter
-    IncludeValues   bool
-    IncludeMetadata bool
-    SparseValues    *SparseValues
-}
-
- - - - - - - - - - - - - - - -

type QueryByVectorValuesRequest - - - -

-

QueryByVectorValuesRequest holds the parameters for the QueryByVectorValuesRequest object, -which is passed into the QueryByVectorValues method. -

Fields: -

    -
  • Vector: The query vector used to find similar vectors. -
  • TopK: The number of vectors to return. -
  • MetadataFilter: The filter to apply to your query. -
  • IncludeValues: Whether to include the values of the vectors in the response. -
  • IncludeMetadata: Whether to include the metadata associated with the vectors in the response. -
  • SparseValues: The sparse values of the query vector, if applicable. -
- -
type QueryByVectorValuesRequest struct {
-    Vector          []float32
-    TopK            uint32
-    Filter          *MetadataFilter
-    IncludeValues   bool
-    IncludeMetadata bool
-    SparseValues    *SparseValues
-}
-
- - - - - - - - - - - - - - - -

type QueryVectorsResponse - - - -

-

QueryVectorsResponse holds the parameters for the QueryVectorsResponse object, -which is returned by the QueryByVectorValues method. -

Fields: -

    -
  • Matches: The vectors that are most similar to the query vector. -
  • Usage: The usage information for the request. -
- -
type QueryVectorsResponse struct {
-    Matches []*ScoredVector `json:"matches,omitempty"`
-    Usage   *Usage          `json:"usage,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type ScoredVector - - - -

-

ScoredVector is a vector with an associated similarity score calculated according to the distance metric of the -Index. - -

type ScoredVector struct {
-    Vector *Vector `json:"vector,omitempty"`
-    Score  float32 `json:"score"`
-}
-
- - - - - - - - - - - - - - - -

type ServerlessSpec - - - -

-

ServerlessSpec is the infrastructure specification of a serverless Pinecone Index. Only available for serverless Indexes. - -

type ServerlessSpec struct {
-    Cloud  Cloud  `json:"cloud"`
-    Region string `json:"region"`
-}
-
- - - - - - - - - - - - - - - -

type SparseValues - - - -

-

SparseValues is a sparse vector objects, most commonly used for hybrid search. - -

type SparseValues struct {
-    Indices []uint32  `json:"indices,omitempty"`
-    Values  []float32 `json:"values,omitempty"`
-}
-
- - - - - - - - - - - - - - - -

type UpdateVectorRequest - - - -

-

UpdateVectorRequest holds the parameters for the UpdateVectorRequest object, -which is passed into the UpdateVector method. -

Fields: -

    -
  • Id: The unique ID of the vector to update. -
  • Values: The values with which you want to update the vector. -
  • SparseValues: The sparse values with which you want to update the vector. -
  • Metadata: The metadata with which you want to update the vector. -
- -
type UpdateVectorRequest struct {
-    Id           string
-    Values       []float32
-    SparseValues *SparseValues
-    Metadata     *Metadata
-}
-
- - - - - - - - - - - - - - - -

type Usage - - - -

-

Usage is the usage stats (Read Units) for a Pinecone Index. - -

type Usage struct {
-    ReadUnits uint32 `json:"read_units"`
-}
-
- - - - - - - - - - - - - - - -

type Vector - - - -

-

Vector is a dense or sparse vector object with optional metadata. - -

type Vector struct {
-    Id           string        `json:"id"`
-    Values       []float32     `json:"values,omitempty"`
-    SparseValues *SparseValues `json:"sparse_values,omitempty"`
-    Metadata     *Metadata     `json:"metadata,omitempty"`
-}
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - From a1b9dc757bb7d89eba848dc3a149929e68ae534d Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 14:29:11 -0700 Subject: [PATCH 5/7] Add local artifacts for godoc generation to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 358242b..0ef74fa 100644 --- a/.gitignore +++ b/.gitignore @@ -121,3 +121,6 @@ modules.xml go.work* .env +# Godoc artifacts +docs/* + From eab6b78fea32c4a40533f2220dff7ba24dd3a0f9 Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 16:39:18 -0700 Subject: [PATCH 6/7] change relative dir --- .github/actions/build-docs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index adcf4cc..b305c7d 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -5,5 +5,5 @@ runs: steps: - name: Write html file to docs directory run: | - godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ../../../docs/index.html + godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ./docs/index.html shell: bash \ No newline at end of file From 8bb4bf32fc9fd8caba8af4b54f23f31943c0ce79 Mon Sep 17 00:00:00 2001 From: aulorbe Date: Tue, 16 Jul 2024 16:47:10 -0700 Subject: [PATCH 7/7] Add fi loop to make /docs dir if does not exist --- .github/actions/build-docs/action.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index b305c7d..9d31485 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -4,6 +4,16 @@ runs: using: 'composite' steps: - name: Write html file to docs directory + shell: bash run: | + # Check if the ./docs directory exists + if [ -d "./docs" ]; then + echo "Directory ./docs exists." + else + echo "Directory ./docs does not exist. Creating it now..." + mkdir ./docs + fi + + # Run the godoc command godoc -url pkg/github.com/pinecone-io/go-pinecone/pinecone/ > ./docs/index.html - shell: bash \ No newline at end of file + echo "godoc command has been executed and the output has been saved to ./docs/index.html"