WIP000.1- AI content writer

This commit is contained in:
AjaySi
2024-01-03 16:59:17 +05:30
parent 8f89de7b69
commit b51e9a8c2f
32 changed files with 854 additions and 506 deletions

View File

@@ -1,8 +1,12 @@
def blog_proof_editor(blog_content, blog_keywords):
from .gpt_providers.gemini_pro_text import gemini_text_response
from .gpt_providers.openai_chat_completion import openai_chatgpt
def blog_proof_editor(blog_content, blog_keywords, gpt_provider="openai"):
"""
Helper for blog proof reading.
"""
prompt = """I am looking for detailed editing and enhancement of the given blog post,
prompt = f"""I am looking for detailed editing and enhancement of the given blog post,
with a particular focus on maintaining originality.
The topic of the content is [{blog_keywords}]. Please go through the blog and make direct edits to improve it,
ensuring the final output is both high-quality and original.
@@ -22,12 +26,18 @@ def blog_proof_editor(blog_content, blog_keywords):
8). Refine Overall Structure: Make structural changes to improve the overall impact of the content.
9). Remember, rewrite all content that repeated, while maintaining the formatting of the given blog text.
Please apply these changes directly to the following blog text and provide the edited version:
[blog_content]. """
Please apply these changes directly to the following blog post and provide the edited version:\n
'{blog_content}'. """
try:
# TBD: Add logic for which_provider and which_model
response = openai_chatgpt(prompt)
return response
except Exception as err:
SystemError(f"Error Blog Proof Reading: {err}")
if 'openai' in gpt_provider:
try:
response = openai_chatgpt(prompt)
return response
except Exception as err:
SystemError(f"Openai Error Blog Proof Reading: {err}")
elif 'gemini' in gpt_provider:
try:
response = gemini_text_response(prompt)
return response
except Exception as err:
SystemError(f"Gemini Error Blog Proof Reading: {err}")