Skip to content

Commit

Permalink
WIP - Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AJaySi committed Mar 31, 2024
1 parent bedd0ac commit 1833a85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 2 additions & 5 deletions lib/ai_web_researcher/google_serp_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,8 @@
)


#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.
Expand Down
9 changes: 6 additions & 3 deletions lib/ai_writers/keywords_to_blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion lib/gpt_providers/openai_text_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@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.
Expand Down

0 comments on commit 1833a85

Please sign in to comment.