Agents team bug fixes

This commit is contained in:
ajaysi
2024-05-07 10:51:47 +05:30
parent 07247fe08e
commit f3f6d5e29c
6 changed files with 7 additions and 17 deletions

View File

@@ -1,24 +1,19 @@
print("Welcome, Alwrity at your service..")
import os import os
from pathlib import Path from pathlib import Path
import configparser import configparser
from datetime import datetime from datetime import datetime
import typer import typer
from prompt_toolkit.shortcuts import checkboxlist_dialog, message_dialog, input_dialog
from prompt_toolkit.shortcuts import radiolist_dialog
from prompt_toolkit import prompt from prompt_toolkit import prompt
from prompt_toolkit.styles import Style
from prompt_toolkit.shortcuts import radiolist_dialog from prompt_toolkit.shortcuts import radiolist_dialog
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.layout.containers import HSplit, Window
from prompt_toolkit.layout.controls import BufferControl
from dotenv import load_dotenv from dotenv import load_dotenv
import requests import requests
from rich import print from rich import print
from rich.text import Text from rich.text import Text
load_dotenv(Path('.env')) load_dotenv(Path('.env'))
print("Loading, required libraries..")
app = typer.Typer() app = typer.Typer()
from lib.utils.alwrity_utils import blog_from_audio, blog_from_keyword, do_web_research, do_web_research, ai_news_writer from lib.utils.alwrity_utils import blog_from_audio, blog_from_keyword, do_web_research, do_web_research, ai_news_writer
@@ -254,12 +249,11 @@ def create_env_file():
if __name__ == "__main__": if __name__ == "__main__":
print("Checking Internet..") print("Checking Internet..")
check_internet() check_internet()
print("Creating .env file") print("Creating .env file")
create_env_file() create_env_file()
print("Clear, all this..")
os.system("clear" if os.name == "posix" else "cls")
print("Checking Search APIs..") print("Checking Search APIs..")
check_search_apis() check_search_apis()
print("Checking LLM APIs..") print("Checking LLM APIs..")

View File

@@ -35,7 +35,7 @@ from clint.textui import progress
#from serpapi import GoogleSearch #from serpapi import GoogleSearch
from loguru import logger from loguru import logger
from tabulate import tabulate from tabulate import tabulate
from GoogleNews import GoogleNews #from GoogleNews import GoogleNews
# Configure logger # Configure logger
logger.remove() logger.remove()
from dotenv import load_dotenv from dotenv import load_dotenv

View File

@@ -24,14 +24,12 @@ import os
import json import json
from pathlib import Path from pathlib import Path
import sys import sys
from typing import List, NamedTuple
from datetime import datetime from datetime import datetime
from .tavily_ai_search import get_tavilyai_results from .tavily_ai_search import get_tavilyai_results
from .metaphor_basic_neural_web_search import metaphor_find_similar, metaphor_search_articles from .metaphor_basic_neural_web_search import metaphor_find_similar, metaphor_search_articles
from .google_serp_search import google_search from .google_serp_search import google_search
from .google_trends_researcher import do_google_trends_analysis from .google_trends_researcher import do_google_trends_analysis
#from .web_research_report import write_web_research_report
from loguru import logger from loguru import logger
# Configure logger # Configure logger
@@ -42,6 +40,7 @@ logger.add(sys.stdout,
) )
def gpt_web_researcher(search_keywords): def gpt_web_researcher(search_keywords):
""" Keyword based web researcher, basic, neural and Semantic search.""" """ Keyword based web researcher, basic, neural and Semantic search."""

View File

@@ -45,7 +45,6 @@ logger.add(sys.stdout,
) )
from .common_utils import save_in_file, cfg_search_param from .common_utils import save_in_file, cfg_search_param
from tenacity import retry, stop_after_attempt, wait_random_exponential from tenacity import retry, stop_after_attempt, wait_random_exponential

View File

@@ -78,7 +78,7 @@ def create_tasks(agents, search_keywords):
task_description, expected_output = read_config("research_task") task_description, expected_output = read_config("research_task")
print(task_description, expected_output) print(task_description, expected_output)
research_task = Task( research_task = Task(
description=f"""The main focus keywords are: "{search_keywords}".\n{task_description}""", description=f"""The main focus keywords are: "{search_keywords}".\n{task_description}""",
expected_output = expected_output, expected_output = expected_output,
agent=agents[0] # Assign to the researcher agent agent=agents[0] # Assign to the researcher agent
) )

View File

@@ -8,9 +8,7 @@ from prompt_toolkit import prompt
from prompt_toolkit.completion import WordCompleter from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.validation import Validator, ValidationError from prompt_toolkit.validation import Validator, ValidationError
from prompt_toolkit.shortcuts import radiolist_dialog from prompt_toolkit.shortcuts import radiolist_dialog
import typer
from rich import print from rich import print
from lib.ai_web_researcher.gpt_online_researcher import gpt_web_researcher from lib.ai_web_researcher.gpt_online_researcher import gpt_web_researcher
from lib.ai_web_researcher.metaphor_basic_neural_web_search import metaphor_find_similar from lib.ai_web_researcher.metaphor_basic_neural_web_search import metaphor_find_similar
from lib.ai_writers.keywords_to_blog import write_blog_from_keywords from lib.ai_writers.keywords_to_blog import write_blog_from_keywords
@@ -352,7 +350,7 @@ def image_generator():
if os.getenv(api_key) is None: if os.getenv(api_key) is None:
print(f"\n\n[bold green] 🙋 Get {api_key} Here:https://platform.stability.ai/docs/getting-started 🙋 -- \n") print(f"\n\n[bold green] 🙋 Get {api_key} Here:https://platform.stability.ai/docs/getting-started 🙋 -- \n")
user_input = typer.prompt(f"💩 -**Please Enter(copy/paste) {api_key} Key** - Here🙋:") user_input = prompt(f"💩 -**Please Enter(copy/paste) {api_key} Key** - Here🙋:")
os.environ[api_key] = user_input os.environ[api_key] = user_input
try: try:
with open(".env", "a") as env_file: with open(".env", "a") as env_file: