node-red-contrib-pinecone
Pinecone makes it easy to provide long-term memory for high-performance AI applications
UBOS • Community • Youtube • Discord • GitHub
Quick Start
Install with the built in Node-RED Palette manager or using npm:
npm install node-red-contrib-pinecone
Properties Index Operations
msg.PINECONE_API_KEY = "Your API key";
msg.PINECONE_ENVIRONMENT = "Your environment";
msg.PINECONE_BASE_URL = "https://controller.[Your environment].pinecone.io";
-
When
msg.actionType
is set tolist_collections
: This operation returns a list of your Pinecone collections -
When
msg.actionType
is set tocreate_collection
:-
[Required]
name
: [Type: string] The name of the collection to be created -
[Required]
source
: [Type: string] The name of the source index to be used as the source for the collection
-
-
When
msg.actionType
is set todescribe_collection
:-
[Required]
name
: [Type: string] The name of the collection
-
[Required]
-
When
msg.actionType
is set todelete_collection
:-
[Required]
name
: [Type: string] The name of the collection
-
[Required]
-
When
msg.actionType
is set tolist_collections
: This operation returns a list of your Pinecone indexes -
When
msg.actionType
is set tocreate_index
:-
[Required]
name
: [Type: string] The name of the collection to be created -
[Required]
dimension
: [Type: integer] The dimensions of the vectors to be inserted in the index -
metric
: [Type: string] The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct' -
pods
: [Type: integer] The number of pods for the index to use,including replicas -
replicas
: [Type: integer] The number of replicas. Replicas duplicate your index. They provide higher availability and throughput -
pod_type
: [Type: string] The type of pod to use. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8. -
metadata_config
: [Type: object | null] Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form:
{"indexed": ["example_metadata_field"]}
-
source_collection
: [Type: string] The name of the collection to create an index from
-
Example:
msg.payload = {
name: "pinecone-index",
metric: "cosine",
pods: 1,
replicas: 1,
pod_type: "p1.x1"
}
-
When
msg.actionType
is set todescribe_index
:-
[Required]
name
: [Type: string] The name of the collection
-
[Required]
-
When
msg.actionType
is set todelete_index
:-
[Required]
name
: [Type: string] The name of the collection
-
[Required]
-
When
msg.actionType
is set toconfigure_index
:-
[Required]
name
: [Type: string] The name of the collection -
replicas
: [Type: string] The desired number of replicas for the index -
pod_type
: [Type: string] The new pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.
-
Properties Vector operations
msg.PINECONE_API_KEY = "Your API key";
msg.PINECONE_ENVIRONMENT = "Your environment";
msg.PINECONE_BASE_URL = "https://index_name-project_id.svc.environment.pinecone.io";
-
When
msg.actionType
is set tofetch
:-
[Required]
msg.name
: The name of the index -
[Required]
msg.vectors
: The vector IDs to fetch. Does not accept values containing spaces. For example:
msg.payload = { name: "pinecone-index", vectors: ["vec1", "vec2"] };
-
-
When
msg.actionType
is set toquery
:-
[Required]
name
: [Type: string] The name of the index -
[Required]
topK
: [Type: int64] The number of results to return for each query -
filter
: [Type: object] The filter to apply. You can use vector metadata to limit your search. See docs -
includeValues
: [Type: boolean] Indicates whether vector values are included in the response -
includeMetadata
: [Type: boolean] Indicates whether metadata is included in the response as well as the ids -
vector
: [Type: array of floats] The query vector. This should be the same length as the dimension of the index being queried. Each query() request can contain only one of the parameters id or vector. -
sparseVector
: [Type: object] Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length -
id
: [Type: string] The unique ID of the vector to be used as a query vector. Each query() request can contain only one of the parameters queries, vector, or id
Example:
msg.payload = { name: "pinecone-index", topK: 10, vector: [0.1,0.2,0.3], namespace: 'example-namespace' };
-
-
When
msg.actionType
is set toupdate
:-
[Required]
name
: [Type: string] The name of the index -
[Required]
id
: [Type: string] Vector's unique id -
values
: [Type: array of floats] Vector data -
sparseValues
: [Type: object] Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length -
setMetadata
: [Type: object] Metadata to set for the vector -
namespace
: [Type: string] The namespace containing the vector to update
Example:
msg.payload = { name: "pinecone-index", id:'vec1', values: [0.1,0.2,0.3,0.4], setMetadata: {'genre': 'drama'}, namespace: 'example-namespace' };
-
-
When
msg.actionType
is set toupsert
:-
[Required]
name
: [Type: string] The name of the index -
[Required]
vectors
: [Type: array of objects] An array containing the vectors to upsert. Recommended batch limit is 100 vectors -
namespace
: [Type: string] This is the namespace name where you upsert vectors
Example:
msg.payload = { name: "pinecone-index", vectors: [ { id: 'vec2', values: [0.2,0.3,0.4,0.5], metadata: {'genre': 'action'} } ] };
-
-
When
msg.delete
is set toupsert
:-
[Required]
name
: [Type: string] The name of the index -
[Required]
ids
: [Type: array of strings] Vectors to delete -
deleteAll
: [Type: boolean] This indicates that all vectors in the index namespace should be deleted -
namespace
: [Type: string] The namespace to delete vectors from, if applicable -
filter
: [Type: boolean] If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying IDs to delete in the ids param or using delete_all=True. See doc
Example:
msg.payload = { name: "pinecone-index", ids: ["vec1", "vec2"] };
-
-
When
msg.delete
is set todescribeIndexStats
:-
[Required]
name
: [Type: string] The name of the index -
filter
: [Type: boolean] If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See doc
-
Bugs reports and feature requests
Please report any issues or feature requests at GitHub.