WIP - Code refactoring

This commit is contained in:
AjaySi committed 2024-03-31 19:36:33 +05:30
1 parent bedd0ac422
commit 1833a85637
3 files changed
+9 -9

No files matched your search

+2 -5
View File
@@ -50,11 +50,8 @@ logger.add(
)
#from tenacity import retry, stop_after_attempt, wait_random_exponential
#@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
#FIXME: Accept language, country and time frame to search for.
from tenacity import retry, stop_after_attempt, wait_random_exponential
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
def google_search(query):
"""
Perform a Google search for the given query.
+6 -3
View File
@@ -39,9 +39,12 @@ def write_blog_from_keywords(search_keywords, url=None):
logger.info(f"Researching and Writing Blog on keywords: {search_keywords}")
# Call on the got-researcher, tavily apis for this. Do google search for organic competition.
google_search_result, g_titles = do_google_serp_search(search_keywords)
example_blog_titles.append(g_titles)
blog_markdown_str = write_blog_google_serp(search_keywords, google_search_result)
try:
google_search_result, g_titles = do_google_serp_search(search_keywords)
example_blog_titles.append(g_titles)
blog_markdown_str = write_blog_google_serp(search_keywords, google_search_result)
except Exception as err:
logger.error(f"Failed in Google web research: {err}")
# logger.info/check the final blog content.
logger.info(f"######### Blog content Google SERP research: ###########\n\n{blog_markdown_str}\n\n")
+1 -1
View File
@@ -15,7 +15,7 @@ from tenacity import (
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
def openai_chatgpt(prompt, model="gpt-3.5-turbo-0125", temperature=0.2, max_tokens=4096, top_p=0.9, n=1):
def openai_chatgpt(prompt, model="gpt-3.5-turbo-0125", temperature=0.7, max_tokens=4096, top_p=0.5, n=1):
"""
Wrapper function for OpenAI's ChatGPT completion.