From bbee9e472f2651be64ca9d672e53470894db35cc Mon Sep 17 00:00:00 2001 From: "ajaysi (aider)" Date: Tue, 17 Sep 2024 12:05:53 +0530 Subject: [PATCH] feat: integrate LLM functions to generate insights for scraped website content --- lib/ai_marketing_tools/ai_backlinking.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/ai_marketing_tools/ai_backlinking.py b/lib/ai_marketing_tools/ai_backlinking.py index 72aa35e2..c8a1ec46 100644 --- a/lib/ai_marketing_tools/ai_backlinking.py +++ b/lib/ai_marketing_tools/ai_backlinking.py @@ -129,6 +129,7 @@ #This solution will significantly streamline the backlinking process by automating the most tedious tasks, from finding sites to personalizing outreach, enabling marketers to focus on content creation and high-level strategies. from lib.ai_web_researcher.firecrawl_web_crawler import scrape_website +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen from lib.ai_web_researcher.firecrawl_web_crawler import scrape_url @@ -182,6 +183,20 @@ def find_backlink_opportunities(keyword): website_data = scrape_website(url) if website_data: contact_info = extract_contact_info(url) + # Construct a prompt for the LLM + prompt = f""" + Analyze the following website content and provide insights: + Content: {website_data.get("content_summary", "")} + + Please provide: + 1. A brief summary of what the website is about. + 2. Guidelines to follow for guest posting. + 3. Suggested topics to write on. + 4. Any other insights to help make a highly personalized reach out and decision making. + """ + + insights = llm_text_gen(prompt) + detailed_result = { "url": url, "metadata": { @@ -192,6 +207,7 @@ def find_backlink_opportunities(keyword): }, "content_summary": website_data.get("content_summary", ""), "contact_info": contact_info, + "insights": insights, "backlink_opportunity": { "query": query, "context": "Guest post opportunity"