import { init as langtraceInit } from 'langtrase/typescript-sdk';
import { PineconeClient, ServerlessSpec } from '@pinecone-database/pinecone-client';
langtraceInit({
apiKey: langtraceApiKey,
});
// Step 3: Initialize Pinecone client
const pinecone = new PineconeClient({
apiKey: pineconeApiKey,
});
// Step 4: Create an Index and upsert some data in Pinecone
(async () => {
await pinecone.createIndex({
name: "index",
dimension: 8, // Replace with your model dimensions
metric: "euclidean", // Replace with your model metric
spec: new ServerlessSpec({
cloud: "aws",
region: "us-east-1",
}),
});
const index = pinecone.Index("index");
await index.upsert({
vectors: [
{ id: "A", values: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] },
{ id: "B", values: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2] },
{ id: "C", values: [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] },
{ id: "D", values: [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4] },
],
});
})();