Try Essay, story, Audio to Blog

This commit is contained in:
ajaysi
2024-04-17 20:02:51 +05:30
parent 80c52facc5
commit d2bb42caff
7 changed files with 23 additions and 34 deletions

View File

@@ -45,10 +45,6 @@ logger.add(sys.stdout,
def gpt_web_researcher(search_keywords):
""" Keyword based web researcher, basic, neural and Semantic search."""
# TBD: Keeping the results directory as fixed, for now.
os.environ["SEARCH_SAVE_FILE"] = os.path.join(os.getcwd(), "workspace",
search_keywords.replace(" ", "_") + "_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
try:
google_search_result = do_google_serp_search(search_keywords)
tavily_search_result = do_tavily_ai_search(search_keywords)

View File

@@ -30,9 +30,6 @@ def write_blog_from_keywords(search_keywords, url=None):
This function will take a blog Topic to first generate sections for it
and then generate content for each section.
"""
# TBD: Keeping the results directory as fixed, for now.
os.environ["SEARCH_SAVE_FILE"] = os.path.join(os.getcwd(), "workspace", "web_research_reports",
search_keywords.replace(" ", "_") + "_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
# Use to store the blog in a string, to save in a *.md file.
blog_markdown_str = ""
example_blog_titles = []
@@ -48,7 +45,6 @@ def write_blog_from_keywords(search_keywords, url=None):
# logger.info/check the final blog content.
logger.info("\n######### Draft1: Finished Blog from Google web search: ###########\n\n")
# Do Tavily AI research to augument the above blog.
try:
tavily_search_result, t_titles = do_tavily_ai_search(search_keywords)

View File

@@ -36,7 +36,7 @@ def youtube_to_blog(video_url):
try:
# Summarizing the content of the YouTube video
audio_blog_content = summarize_youtube_video(audio_text, "gemini")
audio_blog_content = summarize_youtube_video(audio_text)
logger.info("Successfully converted given URL to blog article.")
return audio_blog_content, audio_title
except Exception as e:
@@ -44,7 +44,7 @@ def youtube_to_blog(video_url):
sys.exit(1) # Exit the program due to error in summarize_youtube_video
def summarize_youtube_video(user_content, gpt_providers):
def summarize_youtube_video(user_content):
"""Generates a summary of a YouTube video using OpenAI GPT-3 and displays a progress bar.
Args:
video_link: The URL of the YouTube video to summarize.

View File

@@ -32,7 +32,6 @@ def llm_text_gen(prompt):
# Check if API key is provided for the given gpt_provider
get_api_key(gpt_provider)
logger.info(f"Temp: {temperature}, MaxTokens: {max_tokens}, TopP: {top_p}, N: {n}, FrequencyPenalty: {fp}")
# Perform text generation using the specified LLM parameters and prompt
if 'google' in gpt_provider.lower():
try:
@@ -69,9 +68,8 @@ def check_gpt_provider(gpt_provider):
ValueError: If both the specified GPT provider and environment variable GPT_PROVIDER are missing.
"""
env_gpt_provider = os.getenv('GPT_PROVIDER')
if gpt_provider and gpt_provider != env_gpt_provider:
if gpt_provider and gpt_provider.lower() != env_gpt_provider.lower():
logger.warning(f"Config: '{gpt_provider}' different to environment variable 'GPT_PROVIDER' '{env_gpt_provider}'")
logger.info(f"Using Environment GPT provider: {env_gpt_provider}")
gpt_provider = env_gpt_provider
return gpt_provider