Skip to content

Commit

Permalink
comment out logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluder-Paradyne committed Nov 30, 2023
1 parent 44a2af1 commit 648b293
Show file tree
Hide file tree
Showing 48 changed files with 132 additions and 132 deletions.
6 changes: 3 additions & 3 deletions cli2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def check_command(command, message):
if not shutil.which(command):
logger.info(message)
#logger.info(message)
sys.exit(1)


Expand All @@ -37,11 +37,11 @@ def run_server(shell=False,a_name=None,a_description=None,goals=None):


def cleanup(api_process, ui_process, celery_process):
logger.info("Shutting down processes...")
#logger.info("Shutting down processes...")
api_process.terminate()
ui_process.terminate()
celery_process.terminate()
logger.info("Processes terminated. Exiting.")
#logger.info("Processes terminated. Exiting.")
sys.exit(1)


Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,21 @@ def replace_old_iteration_workflows(session):
@app.on_event("startup")
async def startup_event():
# Perform startup tasks here
logger.info("Running Startup tasks")
#logger.info("Running Startup tasks")
Session = sessionmaker(bind=engine)
session = Session()
default_user = session.query(User).filter(User.email == "super6@agi.com").first()
logger.info(default_user)
#logger.info(default_user)
if default_user is not None:
organisation = session.query(Organisation).filter_by(id=default_user.organisation_id).first()
logger.info(organisation)
#logger.info(organisation)
register_toolkits(session, organisation)

def register_toolkit_for_all_organisation():
organizations = session.query(Organisation).all()
for organization in organizations:
register_toolkits(session, organization)
logger.info("Successfully registered local toolkits for all Organisations!")
#logger.info("Successfully registered local toolkits for all Organisations!")

def register_toolkit_for_master_organisation():
marketplace_organisation_id = superagi.config.config.get_config("MARKETPLACE_ORGANISATION_ID")
Expand Down
6 changes: 3 additions & 3 deletions run_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def check_command(command, message):
if not shutil.which(command):
logger.info(message)
#logger.info(message)
sys.exit(1)

def run_npm_commands():
Expand All @@ -27,10 +27,10 @@ def run_server():
return api_process, ui_process

def cleanup(api_process, ui_process):
logger.info("Shutting down processes...")
#logger.info("Shutting down processes...")
api_process.terminate()
ui_process.terminate()
logger.info("Processes terminated. Exiting.")
#logger.info("Processes terminated. Exiting.")
sys.exit(1)

if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/agent_iteration_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def execute_step(self):
.build_agent_messages(prompt, agent_feeds, history_enabled=iteration_workflow_step.history_enabled,
completion_prompt=iteration_workflow_step.completion_prompt)

logger.debug("Prompt messages:", messages)
# logger.debug("Prompt messages:", messages)
current_tokens = TokenCounter.count_message_tokens(messages = messages, model = self.llm.get_model())
response = self.llm.chat_completion(messages, TokenCounter(session=self.session, organisation_id=organisation.id).token_limit(self.llm.get_model()) - current_tokens)

Expand Down Expand Up @@ -116,7 +116,7 @@ def execute_step(self):
else:
# moving to next step of iteration or workflow
self._update_agent_execution_next_step(execution, iteration_workflow_step.next_step_id)
logger.info(f"Starting next job for agent execution id: {self.agent_execution_id}")
#logger.info(f"Starting next job for agent execution id: {self.agent_execution_id}")

self.session.flush()

Expand Down
2 changes: 1 addition & 1 deletion superagi/agent/agent_prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def replace_main_variables(cls, super_agi_prompt: str, goals: List[str], instruc
AgentPromptBuilder.add_list_items_to_string(constraints))


# logger.info(tools)
# #logger.info(tools)
tools_string = AgentPromptBuilder.add_tools_to_prompt(tools, add_finish_tool)
super_agi_prompt = super_agi_prompt.replace("{tools}", tools_string)
return super_agi_prompt
Expand Down
2 changes: 1 addition & 1 deletion superagi/agent/agent_tool_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _handle_next_step(self, next_step):
def _process_input_instruction(self, agent_config, agent_execution_config, step_tool, workflow_step):
tool_obj = self._build_tool_obj(agent_config, agent_execution_config, step_tool.tool_name)
prompt = self._build_tool_input_prompt(step_tool, tool_obj, agent_execution_config)
logger.info("Prompt: ", prompt)
#logger.info("Prompt: ", prompt)
agent_feeds = AgentExecutionFeed.fetch_agent_execution_feeds(self.session, self.agent_execution_id)
messages = AgentLlmMessageBuilder(self.session, self.llm, self.llm.get_model(), self.agent_id, self.agent_execution_id) \
.build_agent_messages(prompt, agent_feeds, history_enabled=step_tool.history_enabled,
Expand Down
2 changes: 1 addition & 1 deletion superagi/agent/agent_workflow_step_wait_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, session, agent_id, agent_execution_id):
def execute_step(self):
"""Execute the agent wait step."""

logger.info("Executing Wait Step")
#logger.info("Executing Wait Step")
execution = AgentExecution.get_agent_execution_from_id(self.session, self.agent_execution_id)
workflow_step = AgentWorkflowStep.find_by_id(self.session, execution.current_agent_step_id)
step_wait = AgentWorkflowStepWait.find_by_id(self.session, workflow_step.action_reference_id)
Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/output_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def handle(self, session, assistant_reply):
for task in reversed(tasks):
self.task_queue.add_task(task)
if len(tasks) > 0:
logger.info("Adding task to queue: " + str(tasks))
#logger.info("Adding task to queue: " + str(tasks))
agent_execution = AgentExecution.find_by_id(session, self.agent_execution_id)
for task in tasks:
agent_execution_feed = AgentExecutionFeed(agent_execution_id=self.agent_execution_id,
Expand Down Expand Up @@ -182,7 +182,7 @@ def handle(self, session, assistant_reply):
for task in reversed(tasks):
self.task_queue.add_task(task)
if len(tasks) > 0:
logger.info("Tasks reprioritized in order: " + str(tasks))
#logger.info("Tasks reprioritized in order: " + str(tasks))
status = "COMPLETE" if len(self.task_queue.get_tasks()) == 0 else "PENDING"
session.commit()
return TaskExecutorResponse(status=status, retry=False)
Expand Down
8 changes: 4 additions & 4 deletions superagi/agent/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def parse(self, response: str) -> AgentGPTAction:

# OpenAI returns `str(content_dict)`, literal_eval reverses this
try:
logger.debug("AgentSchemaOutputParser: ", response)
#logger.debug("AgentSchemaOutputParser: ", response)
response_obj = ast.literal_eval(response)
args = response_obj['tool']['args'] if 'args' in response_obj['tool'] else {}
return AgentGPTAction(
name=response_obj['tool']['name'],
args=args,
)
except BaseException as e:
logger.info(f"AgentSchemaOutputParser: Error parsing JSON response {e}")
#logger.info(f"AgentSchemaOutputParser: Error parsing JSON response {e}")
raise e


Expand All @@ -58,13 +58,13 @@ def parse(self, response: str) -> AgentGPTAction:

# OpenAI returns `str(content_dict)`, literal_eval reverses this
try:
logger.debug("AgentSchemaOutputParser: ", response)
#logger.debug("AgentSchemaOutputParser: ", response)
response_obj = ast.literal_eval(response)
args = response_obj['args'] if 'args' in response_obj else {}
return AgentGPTAction(
name=response_obj['name'],
args=args,
)
except BaseException as e:
logger.info(f"AgentSchemaToolOutputParser: Error parsing JSON response {e}")
#logger.info(f"AgentSchemaToolOutputParser: Error parsing JSON response {e}")
raise e
4 changes: 2 additions & 2 deletions superagi/agent/queue_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def _process_reply(self, task_queue: TaskQueue, assistant_reply: str):
task_array = np.array(eval(assistant_reply)).flatten().tolist()
for task in task_array:
task_queue.add_task(str(task))
logger.info("RAMRAM: Added task to queue: ", task)
#logger.info("RAMRAM: Added task to queue: ", task)

def _process_input_instruction(self, step_tool):
prompt = self._build_queue_input_prompt(step_tool)
logger.info("Prompt: ", prompt)
#logger.info("Prompt: ", prompt)
agent_feeds = AgentExecutionFeed.fetch_agent_execution_feeds(self.session, self.agent_execution_id)
#print(".........//////////////..........2")
messages = AgentLlmMessageBuilder(self.session, self.llm, self.llm.get_model(), self.agent_id, self.agent_execution_id) \
Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/tool_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def execute(self, session, tool_name, tool_args):
tools = {t.name.lower().replace(" ", ""): t for t in self.tools}
tool_name = tool_name.lower().replace(" ", "")
if tool_name == ToolExecutor.FINISH or tool_name == "":
logger.info("\nTask Finished :) \n")
#logger.info("\nTask Finished :) \n")
return ToolExecutorResponse(status="COMPLETE", result="")
if tool_name in tools.keys():
status = "SUCCESS"
Expand Down Expand Up @@ -61,7 +61,7 @@ def execute(self, session, tool_name, tool_args):
)
output = ToolExecutorResponse(status="ERROR", result=result, retry=True)

logger.info("Tool Response : " + str(output) + "\n")
#logger.info("Tool Response : " + str(output) + "\n")
return output

def clean_tool_args(self, args):
Expand Down
2 changes: 1 addition & 1 deletion superagi/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def load_config(cls, config_file: str) -> dict:

# Merge environment variables and config data
env_vars = dict(os.environ)
logger.info(env_vars)
#logger.info(env_vars)
config_data = {**config_data, **env_vars}

return config_data
Expand Down
6 changes: 3 additions & 3 deletions superagi/controllers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def create_config(config: ConfigurationIn, organisation_id: int,
db.session.flush()
return existing_config

logger.info("NEW CONFIG")
#logger.info("NEW CONFIG")
new_config = Configuration(organisation_id=organisation_id, key=config.key, value=config.value)
logger.info(new_config)
logger.info("ORGANISATION ID : ", organisation_id)
#logger.info(new_config)
#logger.info("ORGANISATION ID : ", organisation_id)
db.session.add(new_config)
db.session.commit()
db.session.flush()
Expand Down
6 changes: 3 additions & 3 deletions superagi/controllers/models_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def verify_end_point(model_api_key: str = None, end_point: str = None, mod
async def store_model(request: StoreModelRequest, organisation=Depends(get_user_organisation)):
try:
#context_length = 4096
logger.info(request)
#logger.info(request)
if 'context_length' in request.dict():
return Models.store_model_details(db.session, organisation.id, request.model_name, request.description, request.end_point, request.model_provider_id, request.token_limit, request.type, request.version, request.context_length)
else:
Expand Down Expand Up @@ -205,9 +205,9 @@ def test_local_llm():
]
response = llm_model.create_chat_completion(messages=messages, grammar=llm_grammar)
content = response["choices"][0]["message"]["content"]
logger.info(content)
#logger.info(content)
return "Model loaded successfully."

except Exception as e:
logger.info("Error: ",e)
#logger.info("Error: ",e)
raise HTTPException(status_code=404, detail="Error while loading the model. Please check your model path and try again.")
2 changes: 1 addition & 1 deletion superagi/controllers/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create_organisation(organisation: OrganisationIn,
db.session.commit()
db.session.flush()
register_toolkits(session=db.session, organisation=new_organisation)
logger.info(new_organisation)
#logger.info(new_organisation)

return new_organisation

Expand Down
2 changes: 1 addition & 1 deletion superagi/controllers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_project(project: ProjectIn,
"""

logger.info("Organisation_id : ", project.organisation_id)
#logger.info("Organisation_id : ", project.organisation_id)
organisation = db.session.query(Organisation).get(project.organisation_id)

if not organisation:
Expand Down
4 changes: 2 additions & 2 deletions superagi/controllers/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def upload(agent_id: int, file: UploadFile = File(...), name=Form(...), si
file_path = 'resources' + file_path
try:
s3.upload_fileobj(file.file, bucket_name, file_path)
logger.info("File uploaded successfully!")
#logger.info("File uploaded successfully!")
except NoCredentialsError:
raise HTTPException(status_code=500, detail="AWS credentials not found. Check your configuration.")

Expand All @@ -92,7 +92,7 @@ async def upload(agent_id: int, file: UploadFile = File(...), name=Form(...), si
db.session.flush()

summarize_resource.delay(agent_id, resource.id)
logger.info(resource)
#logger.info(resource)

return resource

Expand Down
4 changes: 2 additions & 2 deletions superagi/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def create_user(user: UserIn,
db.session.flush()
organisation = Organisation.find_or_create_organisation(db.session, db_user)
Project.find_or_create_default_project(db.session, organisation.id)
logger.info("User created", db_user)
#logger.info("User created", db_user)

#adding local llm configuration
ModelsConfig.add_llm_config(db.session, organisation.id)
Expand Down Expand Up @@ -146,5 +146,5 @@ def update_first_login_source(source: str, Authorize: AuthJWT = Depends(check_au
user.first_login_source = source
db.session.commit()
db.session.flush()
logger.info("User : ",user)
#logger.info("User : ",user)
return user
Loading

0 comments on commit 648b293

Please sign in to comment.