Skip to content

Commit

Permalink
comment out prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluder-Paradyne committed Nov 30, 2023
1 parent 28dc19a commit 208541d
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def run_migrations_online() -> None:
"DB_HOST": os.getenv("DB_HOST", ""),
"DB_NAME": os.getenv("DB_NAME", "")
}
print("HERE ARE THE VARIABLES", url_tokens)
#print("HERE ARE THE VARIABLES", url_tokens)
config.set_main_option('sqlalchemy.url', f"postgresql://{url_tokens['DB_USER']}:{url_tokens['DB_PASS']}@{url_tokens['DB_HOST']}:5432/{url_tokens['DB_NAME']}")
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/agent_prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def add_tools_to_prompt(cls, tools: List[BaseTool], add_finish: bool = True) ->
add_finish (bool): Whether to add finish tool or not.
"""
final_string = ""
print(tools)
#print(tools)
for i, item in enumerate(tools):
final_string += f"{i + 1}. {cls._generate_tool_string(item)}\n"
finish_description = (
Expand All @@ -53,7 +53,7 @@ def add_tools_to_prompt(cls, tools: List[BaseTool], add_finish: bool = True) ->
@classmethod
def _generate_tool_string(cls, tool: BaseTool) -> str:
output = f"\"{tool.name}\": {tool.description}"
# print(tool.args)
# #print(tool.args)
output += f", args json schema: {json.dumps(tool.args)}"
return output

Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/agent_tool_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def execute_step(self):
step_tool = AgentWorkflowStepTool.find_by_id(self.session, workflow_step.action_reference_id)
agent_config = Agent.fetch_configuration(self.session, self.agent_id)
agent_execution_config = AgentExecutionConfiguration.fetch_configuration(self.session, self.agent_execution_id)
# print(agent_execution_config)
# #print(agent_execution_config)

if not self._handle_wait_for_permission(execution, workflow_step):
return
Expand Down Expand Up @@ -103,7 +103,7 @@ def _process_input_instruction(self, agent_config, agent_execution_config, step_
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,
completion_prompt=step_tool.completion_prompt)
# print(messages)
# #print(messages)
current_tokens = TokenCounter.count_message_tokens(messages, self.llm.get_model())
response = self.llm.chat_completion(messages, TokenCounter(session=self.session, organisation_id=self.organisation.id).token_limit(self.llm.get_model()) - current_tokens)

Expand Down
4 changes: 2 additions & 2 deletions superagi/agent/queue_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _consume_from_queue(self, task_queue: TaskQueue):

def _process_reply(self, task_queue: TaskQueue, assistant_reply: str):
assistant_reply = JsonCleaner.extract_json_array_section(assistant_reply)
print("Queue reply:", assistant_reply)
#print("Queue reply:", assistant_reply)
task_array = np.array(eval(assistant_reply)).flatten().tolist()
for task in task_array:
task_queue.add_task(str(task))
Expand All @@ -85,7 +85,7 @@ def _process_input_instruction(self, step_tool):
prompt = self._build_queue_input_prompt(step_tool)
logger.info("Prompt: ", prompt)
agent_feeds = AgentExecutionFeed.fetch_agent_execution_feeds(self.session, self.agent_execution_id)
print(".........//////////////..........2")
#print(".........//////////////..........2")
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,
completion_prompt=step_tool.completion_prompt)
Expand Down
2 changes: 1 addition & 1 deletion superagi/agent/task_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, queue_name: str):

def add_task(self, task: str):
self.db.lpush(self.queue_name, task)
# print("Added task. New tasks:", str(self.get_tasks()))
# #print("Added task. New tasks:", str(self.get_tasks()))

def complete_task(self, response):
if len(self.get_tasks()) <= 0:
Expand Down
2 changes: 1 addition & 1 deletion superagi/controllers/agent_execution_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def update_agent_execution_permission_status(agent_execution_permission_id: int,
"""

agent_execution_permission = db.session.query(AgentExecutionPermission).get(agent_execution_permission_id)
print(agent_execution_permission)
#print(agent_execution_permission)
if agent_execution_permission is None:
raise HTTPException(status_code=400, detail="Invalid Request")
if status is None:
Expand Down
4 changes: 2 additions & 2 deletions superagi/controllers/agent_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ def list_agent_templates(template_source="local", search_str="", page=0, organis
local_templates_hash = {}
for local_template in local_templates:
local_templates_hash[local_template.marketplace_template_id] = True
print(local_templates_hash)
#print(local_templates_hash)
templates = AgentTemplate.fetch_marketplace_list(search_str, page)
print(templates)
#print(templates)
for template in templates:
template["is_installed"] = local_templates_hash.get(template["id"], False)
template["organisation_id"] = organisation.id
Expand Down
6 changes: 3 additions & 3 deletions superagi/controllers/google_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ async def google_auth_calendar(code: str = Query(...), state: str = Query(...)):
if response.status_code != 200:
raise HTTPException(status_code=400, detail="Invalid Client Secret")
response = response.json()
print("----------------------------------------------------------------")
print(response)
#print("----------------------------------------------------------------")
#print(response)
expire_time = datetime.utcnow() + timedelta(seconds=response['expires_in'])
expire_time = expire_time - timedelta(minutes=5)
response['expiry'] = expire_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
Expand All @@ -74,7 +74,7 @@ def send_google_calendar_configs(google_creds: dict, toolkit_id: int, Authorize:
user_id = current_user.id
toolkit = db.session.query(Toolkit).filter(Toolkit.id == toolkit_id).first()
google_creds = json.dumps(google_creds)
print(google_creds)
#print(google_creds)
tokens = OauthTokens().add_or_update(session, toolkit_id, user_id, toolkit.organisation_id, "GOOGLE_CALENDAR_OAUTH_TOKENS", google_creds)
if tokens:
success = True
Expand Down
12 changes: 6 additions & 6 deletions superagi/controllers/models_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def get_marketplace_models_list(page: int = 0):

models_list = []
try:
print("///////////////////1")
print(models)
#print("///////////////////1")
#print(models)
for model in models:
model_dict = model.__dict__
print(model_dict)
print("///////////////////2")
print(db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first())
print(db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first().provider)
#print(model_dict)
#print("///////////////////2")
#print(db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first())
#print(db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first().provider)
model_dict["provider"] = db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first().provider
models_list.append(model_dict)
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions superagi/helper/prompt_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read_tools_prompt(current_file: str, prompt_file: str) -> str:
file_content = f.read()
f.close()
except FileNotFoundError as e:
print(e.__str__())
#print(e.__str__())
raise e
return file_content

Expand All @@ -22,6 +22,6 @@ def read_agent_prompt(current_file: str, prompt_file: str) -> str:
file_content = f.read()
f.close()
except FileNotFoundError as e:
print(e.__str__())
#print(e.__str__())
raise e
return file_content
2 changes: 1 addition & 1 deletion superagi/helper/s3_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def read_from_s3(self, file_path):

def read_binary_from_s3(self, file_path):
file_path = "resources" + file_path
print("____________________________________________LOG TEST: FINAL PATH_____________", file_path)
#print("____________________________________________LOG TEST: FINAL PATH_____________", file_path)
logger.info(f"Reading file from s3: {file_path}")
response = self.s3.get_object(Bucket=get_config("BUCKET_NAME"), Key=file_path)
if response['ResponseMetadata']['HTTPStatusCode'] == 200:
Expand Down
2 changes: 1 addition & 1 deletion superagi/helper/token_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def count_message_tokens(messages: List[BaseMessage], model: str = "gpt-3.5-turb
num_tokens += len(encoding.encode(message['content']))

num_tokens += 3
print("tokens",num_tokens)
#print("tokens",num_tokens)
return num_tokens

@staticmethod
Expand Down
8 changes: 4 additions & 4 deletions superagi/helper/tool_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def add_tool_to_json(repo_link):


def handle_tools_import():
print("Handling tools import")
#print("Handling tools import")
tool_paths = ["superagi/tools", "superagi/tools/marketplace_tools", "superagi/tools/external_tools"]
for tool_path in tool_paths:
if not os.path.exists(tool_path):
Expand Down Expand Up @@ -335,7 +335,7 @@ def compare_toolkit(toolkit1, toolkit2):
tool_configs_diff = any(compare_configs(config1, config2) for config1, config2 in zip(tool_configs1,
tool_configs2))

print("toolkit_diff : ", toolkit_diff)
print("tools_diff : ", tools_diff)
print("tool_configs_diff : ", tool_configs_diff)
#print("toolkit_diff : ", toolkit_diff)
#print("tools_diff : ", tools_diff)
#print("tool_configs_diff : ", tool_configs_diff)
return toolkit_diff or tools_diff or tool_configs_diff
4 changes: 2 additions & 2 deletions superagi/helper/twitter_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def get_file_path(self, session, file_name, agent_id, agent_execution_id):
return final_path

def _get_image_data(self, file_path):
print("______________________________________________LOG TEST : FILE PATH _______________________ ",file_path)
#print("______________________________________________LOG TEST : FILE PATH _______________________ ",file_path)
if StorageType.get_storage_type(get_config("STORAGE_TYPE", StorageType.FILE.value)) == StorageType.S3:
print("______________________Testing__________________ S3___________")
#print("______________________Testing__________________ S3___________")
attachment_data = S3Helper().read_binary_from_s3(file_path)
else:
with open(file_path, "rb") as file:
Expand Down
2 changes: 1 addition & 1 deletion superagi/jobs/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __execute_workflow_step(self, agent, agent_config, agent_execution_id, agent
organisation_id=organisation.id)
, agent_id=agent.id,
agent_execution_id=agent_execution_id, memory=memory)
print(get_model(model=agent_config["model"], api_key=model_api_key, organisation_id=organisation.id))
#print(get_model(model=agent_config["model"], api_key=model_api_key, organisation_id=organisation.id))
iteration_step_handler.execute_step()
elif agent_workflow_step.action_type == AgentWorkflowStepAction.WAIT_STEP.value:
(AgentWaitStepHandler(session=session, agent_id=agent.id,
Expand Down
2 changes: 1 addition & 1 deletion superagi/llms/google_palm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def chat_completion(self, messages, max_tokens=get_config("MAX_MODEL_TOKEN_LIMIT
prompt=prompt,
max_output_tokens=int(max_tokens),
)
# print(completion.result)
# #print(completion.result)
return {"response": completion, "content": completion.result}
except Exception as exception:
logger.info("Google palm Exception:", exception)
Expand Down
12 changes: 6 additions & 6 deletions superagi/llms/llm_model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def get_model(organisation_id, api_key, model="gpt-3.5-turbo", **kwargs):
print("Fetching model details from database...")
#print("Fetching model details from database...")
engine = connect_db()
Session = sessionmaker(bind=engine)
session = Session()
Expand All @@ -23,19 +23,19 @@ def get_model(organisation_id, api_key, model="gpt-3.5-turbo", **kwargs):
session.close()

if provider_name == 'OpenAI':
print("Provider is OpenAI")
#print("Provider is OpenAI")
return OpenAi(model=model_instance.model_name, api_key=api_key, **kwargs)
elif provider_name == 'Replicate':
print("Provider is Replicate")
#print("Provider is Replicate")
return Replicate(model=model_instance.model_name, version=model_instance.version, api_key=api_key, **kwargs)
elif provider_name == 'Google Palm':
print("Provider is Google Palm")
#print("Provider is Google Palm")
return GooglePalm(model=model_instance.model_name, api_key=api_key, **kwargs)
elif provider_name == 'Hugging Face':
print("Provider is Hugging Face")
#print("Provider is Hugging Face")
return HuggingFace(model=model_instance.model_name, end_point=model_instance.end_point, api_key=api_key, **kwargs)
elif provider_name == 'Local LLM':
print("Provider is Local LLM")
#print("Provider is Local LLM")
return LocalLLM(model=model_instance.model_name, context_length=model_instance.context_length)
else:
print('Unknown provider.')
Expand Down
4 changes: 2 additions & 2 deletions superagi/llms/replicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def chat_completion(self, messages, max_tokens=get_config("MAX_MODEL_TOKEN_LIMIT
if not final_output:
logger.error("Replicate model didn't return any output.")
return {"error": "Replicate model didn't return any output."}
print(final_output)
print(temp_output)
#print(final_output)
#print(temp_output)
logger.info("Replicate response:", final_output)

return {"response": temp_output, "content": final_output}
Expand Down
4 changes: 2 additions & 2 deletions superagi/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def fetch_marketplace_list(cls, page):

@classmethod
def get_model_install_details(cls, session, marketplace_models, organisation_id, type=ModelsTypes.CUSTOM.value):
print("///////////////////////3")
print(marketplace_models)
#print("///////////////////////3")
#print(marketplace_models)
installed_models = session.query(Models).filter(Models.org_id == organisation_id).all()
model_counts_dict = dict(
session.query(Models.model_name, func.count(Models.org_id)).group_by(Models.model_name).all()
Expand Down
2 changes: 1 addition & 1 deletion superagi/resource_manager/resource_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def generate_agent_summary(self, generate_all: bool = False) -> str:
self.session.commit()

def fetch_or_create_agent_resource_summary(self, default_summary: str):
print(self.__get_model_source())
#print(self.__get_model_source())
if ModelSourceType.GooglePalm.value in self.__get_model_source():
return
self.generate_agent_summary(generate_all=True)
Expand Down
2 changes: 1 addition & 1 deletion superagi/tools/apollo/apollo_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def apollo_search_results(self, page, per_page, person_titles, num_of_employees
data["person_locations"] = [person_location]

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response)
#print(response)
if response.status_code == 200:
return response.json()
else:
Expand Down
10 changes: 5 additions & 5 deletions superagi/tools/email/send_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def _execute(self, to: str, subject: str, body: str) -> str:
Returns:
success or error message.
"""
print("to: ", to, "/////////////////////////////////////")
print("subject: ", subject, "/////////////////////////////////////")
print("body: ", body, "/////////////////////////////////////")
#print("to: ", to, "/////////////////////////////////////")
#print("subject: ", subject, "/////////////////////////////////////")
#print("body: ", body, "/////////////////////////////////////")
email_sender = self.get_tool_config('EMAIL_ADDRESS')
email_password = self.get_tool_config('EMAIL_PASSWORD')
print("email_sender: ", email_sender, "/////////////////////////////////////")
print("email_password: ", email_password, "/////////////////////////////////////")
#print("email_sender: ", email_sender, "/////////////////////////////////////")
#print("email_password: ", email_password, "/////////////////////////////////////")
if email_sender is None or email_sender == "" or email_sender.isspace():
return "Error: Email Not Sent. Enter a valid Email Address."
if email_password is None or email_password == "" or email_password.isspace():
Expand Down
6 changes: 3 additions & 3 deletions superagi/tools/google_search/google_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def _execute(self, query: str) -> tuple:
Returns:
Search result summary along with related links
"""
print("query: ", query, "/////////////////////////////////////")
#print("query: ", query, "/////////////////////////////////////")
api_key = self.get_tool_config("GOOGLE_API_KEY")
search_engine_id = self.get_tool_config("SEARCH_ENGINE_ID")
print("api_key: ", api_key, "/////////////////////////////////////")
print("search_engine_id: ", search_engine_id, "/////////////////////////////////////")
#print("api_key: ", api_key, "/////////////////////////////////////")
#print("search_engine_id: ", search_engine_id, "/////////////////////////////////////")
num_results = 10
num_pages = 1
num_extracts = 3
Expand Down
2 changes: 1 addition & 1 deletion superagi/tools/instagram_tool/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def get_img_url_and_encoded_caption(self,photo_description,file_path,filename):
#encoding the caption with possible emojis and hashtags and removing the starting and ending double quotes
encoded_caption=self.create_caption(photo_description)

print(image_url, encoded_caption)
#print(image_url, encoded_caption)

return image_url,encoded_caption

Expand Down
2 changes: 1 addition & 1 deletion superagi/vector_store/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_matching_text(self, query: str, top_k: int = 5, metadata: Optional[dict]
.tobytes()
}

# print(self.index)
# #print(self.index)
results = self.redis_client.ft(self.index).search(query,params_dict)

# Prepare document results
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/tools/code/test_write_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def test_execute(self, tool):
tool.tool_response_manager.get_last_response.return_value = "Mocked Spec"

response = tool._execute("Test spec description")
assert response == "File1.py\n```python\nprint('Hello World')\n```\n\nFile2.py\n```python\nprint('Hello again')\n```\n Codes generated and saved successfully in File1.py, File2.py"
assert response == "File1.py\n```python\n#print('Hello World')\n```\n\nFile2.py\n```python\n#print('Hello again')\n```\n Codes generated and saved successfully in File1.py, File2.py"

tool.resource_manager.write_file.assert_any_call("README.md", 'File1.py\n')
tool.resource_manager.write_file.assert_any_call("File1.py", "print('Hello World')\n")
tool.resource_manager.write_file.assert_any_call("File2.py", "print('Hello again')\n")
tool.resource_manager.write_file.assert_any_call("File1.py", "#print('Hello World')\n")
tool.resource_manager.write_file.assert_any_call("File2.py", "#print('Hello again')\n")
tool.tool_response_manager.get_last_response.assert_called_once_with("WriteSpecTool")

0 comments on commit 208541d

Please sign in to comment.