See the Go SDK documentation for full installation instructions and usage examples.

Install

Make sure you have a Go version with modules support.

To install the latest version of the Go SDK, add a dependency to the current module:

go get github.com/pinecone-io/go-pinecone/pinecone

To install a specific version of the Go SDK, run the following command:

go get github.com/pinecone-io/go-pinecone/pinecone@<version>

To check your SDK version, run the following command:

go list -u -m all | grep go-pinecone

Upgrade

If you already have the Go SDK, upgrade to the latest version as follows:

go get github.com/pinecone-io/go-pinecone/pinecone@latest

Initialize

Once installed, you can import the SDK and then use an API key to initialize a client instance:

package main

import (
    "context"
    "log"

    "github.com/pinecone-io/go-pinecone/pinecone"
)

func main() {
    ctx := context.Background()

    pc, err := pinecone.NewClient(pinecone.NewClientParams{
        ApiKey: "YOUR_API_KEY",
    })
    if err != nil {
        log.Fatalf("Failed to create Client: %v", err)
    }
} 

Was this page helpful?