afb10aa52e
Add logging info for tools calling
58 lines
2.4 KiB
Python
58 lines
2.4 KiB
Python
|
|
from datetime import datetime
|
|
import logging
|
|
from pathlib import Path
|
|
from dataclasses import dataclass, field
|
|
from typing import List
|
|
from utilities.logger import simple_logger
|
|
|
|
|
|
###########################################################################################
|
|
verbose = True #Set to True to see CrewAI process information in the console
|
|
###########################################################################################
|
|
|
|
###########################################################################################
|
|
printLogToConsole = False #Set to True to save and print log information to console, else set to False to only save log information to file
|
|
###########################################################################################
|
|
|
|
###########################################################################################
|
|
useSerpAPI = True #Set to True to use SerpAPI google engine for web search (requires an API Key). If set to False, DuckDuckGo will be used
|
|
###########################################################################################
|
|
|
|
###########################################################################################
|
|
#Define logger parameter
|
|
###########################################################################################
|
|
logger = logging.getLogger()
|
|
def create_logger():
|
|
log_fiename_prefix = "log"
|
|
script_dir = Path(__file__).parent
|
|
target_dir = script_dir / "log"
|
|
target_dir.mkdir(parents=True, exist_ok=True)
|
|
now = datetime.now()
|
|
formatted_DateTime = now.strftime("%Y-%m-%d_%H%M%S")
|
|
log_path = f"""log/{log_fiename_prefix}_{formatted_DateTime}.log"""
|
|
global logger
|
|
logger = simple_logger(log_path, printLogToConsole)
|
|
|
|
###########################################################################################
|
|
#Create a 'dataclass' for all configs that can be used anywhere in this Project
|
|
###########################################################################################
|
|
@dataclass
|
|
class AgenticAIConfig:
|
|
# UI Selections from users
|
|
provider:str = "OpenAI"
|
|
model: str = "gpt-4o"
|
|
temperature: float = 0.4
|
|
max_tokens:int = 5000
|
|
|
|
# User Input
|
|
user_query:str=""
|
|
|
|
# Agent Settings (CrewAI Specifics)
|
|
#agent_name:str = "default"
|
|
#tools: List[str] = field(default_factory=list)
|
|
|
|
# Runtime
|
|
response:str=""
|
|
chat_history:List[dict] = field(default_factory=list)
|