Skip to content

Commit

Permalink
feat: Update Pinecone Vector Store node to support serverless environ…
Browse files Browse the repository at this point in the history
…ments (#8849)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
  • Loading branch information
OlegIvaniv authored Mar 8, 2024
1 parent bd465d3 commit a136a73
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ export class PineconeApi implements ICredentialType {
required: true,
default: '',
},
{
displayName: 'Environment',
name: 'environment',
type: 'string',
required: true,
default: 'us-central1-gcp',
},
];

authenticate: IAuthenticateGeneric = {
Expand All @@ -41,7 +34,7 @@ export class PineconeApi implements ICredentialType {

test: ICredentialTestRequest = {
request: {
baseURL: '=https://controller.{{$credentials.environment}}.pinecone.io/databases',
baseURL: 'https://api.pinecone.io/indexes',
headers: {
accept: 'application/json; charset=utf-8',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ export const VectorStorePinecone = createVectorStoreNode({
const pineconeIndex = client.Index(index);

if (options.pineconeNamespace && options.clearNamespace) {
await pineconeIndex.namespace(options.pineconeNamespace).deleteAll();
const namespace = pineconeIndex.namespace(options.pineconeNamespace);
try {
await namespace.deleteAll();
} catch (error) {
// Namespace doesn't exist yet
context.logger.info(`Namespace ${options.pineconeNamespace} does not exist yet`);
}
}

await PineconeStore.fromDocuments(documents, embeddings, {
Expand Down
2 changes: 1 addition & 1 deletion packages/@n8n/nodes-langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"@langchain/redis": "^0.0.2",
"@n8n/typeorm": "0.3.20-3",
"@n8n/vm2": "3.9.20",
"@pinecone-database/pinecone": "2.0.1",
"@pinecone-database/pinecone": "2.1.0",
"@qdrant/js-client-rest": "1.7.0",
"@supabase/supabase-js": "2.38.5",
"@xata.io/client": "0.28.0",
Expand Down
40 changes: 18 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a136a73

Please sign in to comment.