"
import { PineconeClient } from ‘@pinecone-database/pinecone’
export const getPineconeClient = async () => {
const client = new PineconeClient()
await client.init({
apiKey: process.env.PINECONE_API_KEY,
environment: ‘us-east1-gcp’,
})
return client
}
"
"export const processFile = async (data: Files): Promise => {
try {
const response = await fetch(data.url)
const blob = await response.blob()
const loader = new PDFLoader(blob)
const pageLevelDocs = await loader.load()
const pagesAmt = pageLevelDocs.length
const pinecone = await getPineconeClient()
const pineconeIndex = pinecone.Index('doctgify')
const embeddings = new OpenAIEmbeddings({
openAIApiKey: process.env.OPENAI_API_KEY,
})
await PineconeStore.fromDocuments(
pageLevelDocs,
embeddings,
{
pineconeIndex,
namespace: data.name,
}
)
} catch (error) {
throw error
}
return ‘success’;
};
"
the code above is showing no but also it’s not working ?