public static class Pinecone.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder(java.lang.String apiKey)
Constructs a new
Pinecone.Builder with the mandatory API key. |
| Modifier and Type | Method and Description |
|---|---|
Pinecone |
build()
Builds and returns a
Pinecone instance configured with the provided API key, optional source tag,
and OkHttpClient. |
Pinecone.Builder |
withOkHttpClient(okhttp3.OkHttpClient okHttpClient)
Sets a custom OkHttpClient for the Pinecone client to use for making HTTP requests.
|
Pinecone.Builder |
withSourceTag(java.lang.String sourceTag)
Sets the source tag to include with all requests made by the Pinecone client.
|
public Builder(java.lang.String apiKey)
Pinecone.Builder with the mandatory API key.
import io.pinecone.clients.Pinecone;
Pinecone client = new Pinecone.Builder("PINECONE_API_KEY").build();
apiKey - The API key required for authenticating requests to Pinecone services.public Pinecone.Builder withSourceTag(java.lang.String sourceTag)
Source tag is an optional string identifier used to help Pinecone attribute API activity to our partners. For more info, see https://docs.pinecone.io/integrations/build-integration/attribute-api-activity
Pinecone client = new Pinecone.Builder("PINECONE_API_KEY")
.withSourceTag("YOUR_SOURCE_TAG")
.build();
// The tag will be included in all requests made by the client, e.g.
client.listIndexes();
sourceTag - The source tag to identify the origin of the requests.Pinecone.Builder instance for chaining method calls.public Pinecone.Builder withOkHttpClient(okhttp3.OkHttpClient okHttpClient)
import okhttp3.OkHttpClient;
OkHttpClient myClient = new OkHttpClient();
Pinecone client = new Pinecone.Builder("PINECONE_API_KEY")
.withOkHttpClient(myClient)
.build();
// Network requests will now be made using your custom OkHttpClient
client.listIndexes();
okHttpClient - The custom OkHttpClient to be used. Must not be null.Pinecone.Builder instance for chaining method calls.public Pinecone build()
Pinecone instance configured with the provided API key, optional source tag,
and OkHttpClient.
This method also performs configuration validation, sets up the internal API client, and manages indexes API with debugging options based on the environment variables.
Pinecone instance configured based on the builder parameters.