Agentic content team, web researched

This commit is contained in:
ajaysi
2024-04-29 23:48:36 +05:30
parent b68c6257c1
commit bb2904039e
7 changed files with 89 additions and 137 deletions

View File

@@ -181,7 +181,6 @@ def perform_serperdev_google_search(query):
# Check if the request was successful
if response.status_code == 200:
# Parse and return the JSON response
process_search_results(response)
return response.json()
else:
# Print an error message if the request fails
@@ -218,7 +217,6 @@ def perform_serper_news_search(news_keywords, news_country, news_language):
if response.status_code == 200:
# Parse and return the JSON response
#process_search_results(response, "news")
#google_news(news_keywords)
return response.json()
else:
# Print an error message if the request fails
@@ -255,7 +253,7 @@ def process_search_results(search_results, search_type="general"):
pd.DataFrame: Pandas DataFrame containing the search results.
"""
data = []
#logger.info(f"Google Search Parameters: {search_results.get('searchParameters', {})}")
logger.info(f"Google Search Parameters: {search_results.get('searchParameters', {})}")
if 'general' in search_type:
organic_results = search_results.get("organic", [])
if 'news' in search_type:

View File

@@ -16,19 +16,21 @@ from ..gpt_providers.text_generation.main_text_generation import llm_text_gen
def write_blog_google_serp(search_keyword, search_results):
"""Combine the given online research and gpt blog content"""
prompt = f"""
You are Alwrity, the Creative Content writer, writing up fresh ideas and crafts them with care and uniqueness.
She makes complex topics simple to understand and writes in a friendly, conversational tone that connects with everyone.
She excels at creating a introductions that attract users, to read more.
As a SEO expert and content writer, I will provide you with my 'web research keywords' and its 'google search result'.
Your goal is to create SEO-optimized content and also include 5 FAQs.
Your goal is to create detailed SEO-optimized content and also include 5 FAQs.
Follow below guidelines:
1). Your blog content should compete against all blogs from search results.
2). Your FAQ should be based on 'People also ask' and 'Related Queries' from given search result.
Always include answers for each FAQ, use your knowledge and confirm with snippets given in search result.
3). Your blog should be highly detailed, unique and written in human-like personality & tone.
4). Adopt an engaging, helpful voice, providing actionable and concrete insights, and avoiding buzzwords.
5). Act as subject matter expert for given research keywords and include statistics and facts.
6). Do not explain, describe your response.
7). Your blog should be highly formatted in markdown style and highly readable.
8). Important: Please read the entire prompt before writing anything. Follow the prompt exactly as I instructed.
Always include answers for each FAQ, use your knowledge and confirm with snippets given in search result.
3). Act as subject matter expert for given research keywords: {search_keyword}.
4). Your blog should be highly formatted in markdown style and highly readable.
5). Always write in the first person.
\n\nWeb Research Keyword: "{search_keyword}"
Google search Result: "{search_results}"

View File

@@ -20,6 +20,11 @@ def blog_with_keywords(blog, keywords):
Your task is to write an original blog, utilizing given keywords and blog content.
Your blog should be highly detailed and well formatted.
You are Sarah, the Creative Content writer, writing up fresh ideas and crafts them with care.
She makes complex topics easy to understand and writes in a friendly tone that connects with everyone.
She excels at simplifying complex topics and communicates with charisma, making technical jargon come alive for her audience.
Blog content: '{blog}'
list of keywords: '{keywords}'
"""

View File

@@ -14,23 +14,21 @@ from ..gpt_providers.text_generation.main_text_generation import llm_text_gen
def blog_with_research(report, blog):
"""Combine the given online research and gpt blog content"""
prompt = f"""
You are an expert content editor specializing in SEO content optimization for blogs.
You are Alwrity, the Creative Content writer, writing up fresh ideas and crafts them with care and uniqueness.
She makes complex topics simple to understand and writes in a friendly, conversational tone that connects with everyone.
She excels at simplifying complex topics and writes in the first person, for her audience.
I will provide you with a 'research report' and a 'blog content' on the same topic.
Your task is to follow below given guidelines to write a new, unique, and informative blog article
Your task is to follow below given guidelines to write a detailed blog article,
that will rank well in search engine results and engage readers effectively.
Follow below given guidelines:
1. Master the report and blog content: Understand main ideas, key points, and the core message.
2. Sentence Structure: Rephrase while preserving logical flow and conversational tone.
3. Identify Main Keywords: Determine the primary topic and combine the articles on that main topic.
4. Use Creative and Human-like Style: Incorporate contractions, idioms, transitional phrases,
interjections, and colloquialisms.
5. Blog Structuring: Include an Introduction, subtopics and use bullet points or
numbered lists if appropriate. Important to include FAQs, Conclusion and Referances.
6. Ensure Uniqueness: Guarantee the article is plagiarism-free. Write in human-like and informative style.
7. Act as subject matter expert and include statistics and facts in your combined article.
8. Do not provide explanations for your response.
Important: Please read the entire prompt before writing anything. Follow the prompt exactly as I instructed.\n\n
7. .\n\n
Research report: '{report}'
Blog content: '{blog}'

View File

@@ -81,13 +81,13 @@ def write_blog_from_keywords(search_keywords, url=None):
#blog_markdown_str = blog_with_research(blog_markdown_str, you_search_result)
#logger.info(f"Final blog content: {blog_markdown_str}")
logger.info("Pass Final blog for blog-proof reading and *improvements.")
#logger.info("Pass Final blog for blog-proof reading and *improvements.")
# Pass the final content for proofreading.
blog_markdown_str = blog_proof_editor(blog_markdown_str)
#blog_markdown_str = blog_proof_editor(blog_markdown_str)
# Pass the content to remove obivious words used by AI.
logger.info("Pass Final blog for Humanizing it further, Doesn't matter, Really?")
blog_markdown_str = blog_humanize(blog_markdown_str)
#logger.info("Pass Final blog for Humanizing it further, Doesn't matter, Really?")
#blog_markdown_str = blog_humanize(blog_markdown_str)
blog_title, blog_meta_desc, blog_tags, blog_categories = blog_metadata(blog_markdown_str,
search_keywords, example_blog_titles)