Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pinecone (new) CreateIndex, DeleteIndex #307

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/appmixer/pinecone/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

const { Pinecone } = require('@pinecone-database/pinecone');

module.exports = {

type: 'apiKey',

definition: () => {

return {
auth: {
apiKey: {
type: 'text',
name: 'API Key',
tooltip: 'Log into your Pinecone account and find <i>API Keys</i> page.'
}
},

validate: async (context) => {
const pinecone = new Pinecone({
apiKey: context.apiKey
});
await pinecone.listIndexes();
return true;
},

accountNameFromProfileInfo: (context) => {
const apiKey = context.apiKey;
return apiKey.substr(0, 6) + '...' + apiKey.substr(-6);
}
};
}
};
9 changes: 9 additions & 0 deletions src/appmixer/pinecone/bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "appmixer.pinecone",
"version": "1.0.0",
"changelog": {
"1.0.0": [
"Initial version"
]
}
}
36 changes: 36 additions & 0 deletions src/appmixer/pinecone/database/CreateIndex/CreateIndex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

const { Pinecone } = require('@pinecone-database/pinecone');

module.exports = {

async receive(context) {

const {
name,
dimension,
metric,
serverlessCloud,
serverlessRegion,
deletionProtection
} = context.messages.in.content;

const pinecone = new Pinecone({
apiKey: context.auth.apiKey
});
const index = await pinecone.createIndex({
name,
dimension,
metric,
spec: {
serverless: {
cloud: serverlessCloud,
region: serverlessRegion
}
},
deletionProtection
});

return context.sendJson({ index }, 'out');
}
};
114 changes: 114 additions & 0 deletions src/appmixer/pinecone/database/CreateIndex/component.json

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/appmixer/pinecone/database/DeleteIndex/DeleteIndex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const { Pinecone } = require('@pinecone-database/pinecone');

module.exports = {

async receive(context) {

const { name } = context.messages.in.content;
const pinecone = new Pinecone({
apiKey: context.auth.apiKey
});
await pinecone.deleteIndex(name);
return context.sendJson({}, 'out');
}
};
34 changes: 34 additions & 0 deletions src/appmixer/pinecone/database/DeleteIndex/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "appmixer.pinecone.database.DeleteIndex",
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQsAAAEsCAMAAADjImbuAAADAFBMVEVHcEwgHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4gHR4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YlUaWn6M4hqHjWSX0+RYkU8Sbd+R4qBlOfsKYokUI70g37DKj4g/psCkGJ5FhPN5KGQkUt6jPcgpJpDt3I7wQVX1OXc9+hhNqbRNf+LwgqBv3Yq1TdBsHJTokeSP7VghKqSS+6JH0PNbbQiJbzZ+c8/ez4sdserX56w4p5EzOzwsx2iS6EPRmFEus/dKnnGWhisSXmbV3Y7WiZHa8+tv/OOx5cfvCp/HIp0WarxELsK7tEouQKL01XnoQutqAaqaPC2y0aPXnpnM/f7TDkq44bV+YfOz1oPkq0dVaqazQOXuCwmaIits5sEogSrsk7VBX9Kv5Z2lWmCuuyIPzDNJ1IRfbqEfjHObKSCgLebYJ/oLlfmSmK+TYX/0gRf6y0s7CMB29z4J+q06EqN7Z6pOT8zk2j8E+WV296hxWlXt406/ZXw+NR8vw/R7jnAOaaF5oAAAAASUVORK5CYII=",
"description": "Delete an existing index.",
"auth": {
"service": "appmixer:pinecone"
},
"private": false,
"inPorts": [
{
"name": "in",
"schema": {
"type": "object",
"properties": {
"name": { "type": "string" }
},
"required": ["name"]
},
"inspector": {
"inputs": {
"name": {
"type": "text",
"index": 1,
"label": "Index Name",
"tooltip": "The name of the index to delete."
}
}
}
}
],
"outPorts": [{
"name": "out"
}]
}
32 changes: 32 additions & 0 deletions src/appmixer/pinecone/database/InsertVectors/InsertVectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

const { Pinecone } = require('@pinecone-database/pinecone');

const BATCH_SIZE = 200;

module.exports = {

async receive(context) {

const {
index,
namespace,
vectors
} = context.messages.in.content;

const pinecone = new Pinecone({
apiKey: context.auth.apiKey
});
const pineconeIndex = await pinecone.index(index);

const normalizedVectors = typeof vectors === 'string' ? JSON.parse(vectors) : vectors;

for (let i = 0; i < normalizedVectors.length; i += BATCH_SIZE) {
const batch = normalizedVectors.slice(i, i + BATCH_SIZE);
await context.log({ step: 'upsert-batch', batchLength: batch.length, batchIndex: i, vectorsLength: normalizedVectors.length });
await pineconeIndex.namespace(namespace).upsert(batch);
}

return context.sendJson({ upsertedCount: normalizedVectors.length }, 'out');
}
};
Loading
Loading