Skip to content

Custom Id for document creation #5503

Closed Answered by dosubot bot
KeenanFernandes2000 asked this question in Q&A
Discussion options

You must be logged in to vote

You can set custom IDs for the documents you add to Pinecone, which will allow you to delete specific scraped data later. When adding documents using the addDocuments method, you can provide an array of custom IDs. Here's how you can modify your example code to include custom IDs:

Modified Example Code

if (response.status === 200) {
  const $ = cheerio.load(response.data);
  const scrapedData: string[] = [];

  // Example: scraping all paragraph texts
  $("p").each((index, element) => {
    const paragraph = $(element).text().trim();
    if (paragraph) {
      scrapedData.push(paragraph);
    }
  });
  // Send scraped data as response
  const scrape = scrapedData.join("\n");

  //@ts-ignore

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KeenanFernandes2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant