diff --git a/OAI_CONFIG_LIST.json b/OAI_CONFIG_LIST.json new file mode 100644 index 0000000..10a4b17 --- /dev/null +++ b/OAI_CONFIG_LIST.json @@ -0,0 +1,11 @@ +[ + { + "model": "gpt-3.5-turbo", + "api_key": "api-key-here" + }, + { + "model": "gpt-4", + "api_key": "api-key-here" + } + ] + \ No newline at end of file diff --git a/download_verify_email.py b/download_verify_email.py new file mode 100644 index 0000000..20bbbe7 --- /dev/null +++ b/download_verify_email.py @@ -0,0 +1,62 @@ +import PyPDF2 +import requests +import hashlib +import io +def verify_bank_pdf(pdf_url): + """ + Download a PDF from a given URL and perform basic integrity checks. + + Args: + pdf_url (str): The URL of the PDF file to download and verify. + + Returns: + dict: A dictionary containing verification results. + """ + try: + # Download the PDF + response = requests.get(pdf_url) + if response.status_code != 200: + return {"success": False, "message": f"Failed to download PDF. Status code: {response.status_code}"} + + pdf_content = response.content + + # Calculate MD5 hash of the PDF + md5_hash = hashlib.md5(pdf_content).hexdigest() + + # Read the PDF + pdf_reader = PyPDF2.PdfReader(io.BytesIO(pdf_content)) + + # Extract metadata + metadata = pdf_reader.metadata + + # Check if the PDF is encrypted + is_encrypted = pdf_reader.is_encrypted + + # Get the number of pages + num_pages = len(pdf_reader.pages) + + # Check for digital signatures (this is a basic check and may not catch all types of signatures) + has_signature = '/Sig' in pdf_reader.trailer['/Root'].get('/AcroForm', {}).get('/Fields', {}) + + return { + "success": True, + "md5_hash": md5_hash, + "is_encrypted": is_encrypted, + "num_pages": num_pages, + "has_signature": has_signature, + "metadata": { + "author": metadata.get('/Author', 'N/A'), + "creator": metadata.get('/Creator', 'N/A'), + "producer": metadata.get('/Producer', 'N/A'), + "subject": metadata.get('/Subject', 'N/A'), + "title": metadata.get('/Title', 'N/A'), + "creation_date": metadata.get('/CreationDate', 'N/A'), + "modification_date": metadata.get('/ModDate', 'N/A') + } + } + except Exception as e: + return {"success": False, "message": f"An error occurred: {str(e)}"} + +# Example usage +# result = verify_bank_pdf("https://example.com/bank_statement.pdf") +# print(result) \ No newline at end of file diff --git a/main.py b/main.py index 906274c..9defae0 100644 --- a/main.py +++ b/main.py @@ -5,39 +5,55 @@ from dotenv import load_dotenv load_dotenv() # take environment variables from .env. config_list = [ { - 'model': 'gpt-3.5-turbo-16k', + 'model': 'gpt-3.5-turbo', 'api_key': os.getenv('OPENAI_API_KEY'), } ] llm_config = { - "timeout": 300, + "timeout": 120, "seed": 42, # for caching. once task is run it caches the response, "config_list": config_list, "temperature": 0 #lower temperature more standard lesss creative response, higher is more creative } -assistant = autogen.AssistantAgent( - name="laon_assistant", +front_desk_assistant = autogen.AssistantAgent( + name="front_desk_assistant", llm_config=llm_config, - system_message="checks the bank documents. extract pdf using extract_pdf_skill.", + system_message="""You have a personality of monopoly banker. You have to ask questions and collect information from user + Questions that you have to ask : What is your name, How much do you want to borrow, What country do you live in, + What bank do you use, Do you have a job/proof of income, Do you have any history of not paying back loans? + once you collect all these answers, create a json response with following key + {"first_name" : "", last_name: "", "country" : "", "bank" : "", "income" : "", "history" : "", loan_amount : ""} + Ask user for confirmation that the details are right and want to proceed with it. Show the response in json format and save it to a file + """, ) +# assistant = autogen.AssistantAgent( +# name="laon_assistant", +# llm_config=llm_config, +# system_message="checks the bank documents. extract pdf using extract_pdf_skill.", +# ) + user_proxy = autogen.UserProxyAgent( name="user_proxy", - human_input_mode="TERMINATE", + human_input_mode="ALWAYS", max_consecutive_auto_reply=3, is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"), - code_execution_config={"work_dir": "web"}, + code_execution_config={ + "last_n_messages": 3, + "work_dir": "code", + "use_docker": False, + }, llm_config=llm_config, system_message="""Reply TERMINATE if the task has been solved at full satisfaction otherwise, reply CONTINUE, or the reason why the task is not solved yet.""" ) def main(): - task = """""" - user_proxy.initiate_chat(assistant, message=task) + # task = """""" + user_proxy.initiate_chat(front_desk_assistant, message="I want to apply for a loan, please help me") if __name__ == "__main__": main() \ No newline at end of file