import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
import { UpsertOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
type Pinecone = {
apiKey: string;
environment: string;
};
export async function main(
auth: Pinecone,
index_name: string,
vectors: { id: string; values: number[]; metadata?: Record<string, any> }[],
namespace?: string,
raw?: boolean,
) {
const client = new PineconeClient();
await client.init(auth);
const index = client.Index(index_name);
const upsertRequest: UpsertOperationRequest = removeObjectEmptyFields({
vectors,
namespace,
});
return await index[raw ? "upsertRaw" : "upsert"]({ upsertRequest });
}
Submitted by admin 521 days ago
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
import { UpsertOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
type Pinecone = {
apiKey: string;
environment: string;
};
export async function main(
auth: Pinecone,
index_name: string,
vectors: {id: string, values: number[], metadata?: Record<string, any>}[],
namespace?: string,
raw?: boolean,
) {
const client = new PineconeClient();
await client.init(auth);
const index = client.Index(index_name);
const upsertRequest: UpsertOperationRequest = removeObjectEmptyFields({
vectors,
namespace
});
return await index[raw ? "upsertRaw" : "upsert"]({ upsertRequest });
}
Submitted by admin 524 days ago
import { Resource } from "https://deno.land/x/windmill@v1.88.1/mod.ts";
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
import { PineconeClient } from "npm:@pinecone-database/pinecone";
import { UpsertOperationRequest } from "npm:@pinecone-database/pinecone/0.0.12/dist/pinecone-generated-ts-fetch/index.js";
export async function main(
auth: Resource<"pinecone">,
index_name: string,
vectors: {id: string, values: number[], metadata?: Record<string, any>}[],
namespace?: string,
raw?: boolean,
) {
const client = new PineconeClient();
await client.init(auth);
const index = client.Index(index_name);
const upsertRequest: UpsertOperationRequest = removeObjectEmptyFields({
vectors,
namespace
});
return await index[raw ? "upsertRaw" : "upsert"]({ upsertRequest });
}
Submitted by adam186 639 days ago