From 224e4249da7bf803665c6d200d31e1906a4f0c6f Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 4 Nov 2024 22:56:49 -0500 Subject: [PATCH] [FEAT][Output file types] --- agentverse_test.py | 0 example.py | 2 +- notes.txt | 0 pyproject.toml | 2 +- roth_ira_report.md | 0 roth_ira_report.pdf | 87 ------------------------------- swarms/artifacts/main_artifact.py | 42 +++++++-------- 7 files changed, 23 insertions(+), 110 deletions(-) delete mode 100644 agentverse_test.py delete mode 100644 notes.txt delete mode 100644 roth_ira_report.md delete mode 100644 roth_ira_report.pdf diff --git a/agentverse_test.py b/agentverse_test.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example.py b/example.py index b6a0949f..8f6f22da 100644 --- a/example.py +++ b/example.py @@ -38,7 +38,7 @@ agent = Agent( auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task artifacts_on=True, artifacts_output_path="roth_ira_report", - artifacts_file_extension=".md", + artifacts_file_extension=".txt", max_tokens=8000, ) diff --git a/notes.txt b/notes.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/pyproject.toml b/pyproject.toml index 9317fa9e..24cd0922 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "6.0.3" +version = "6.0.4" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/roth_ira_report.md b/roth_ira_report.md deleted file mode 100644 index e69de29b..00000000 diff --git a/roth_ira_report.pdf b/roth_ira_report.pdf deleted file mode 100644 index 7e2e570e..00000000 --- a/roth_ira_report.pdf +++ /dev/null @@ -1,87 +0,0 @@ -%PDF-1.3 -%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com -1 0 obj -<< -/F1 2 0 R ->> -endobj -2 0 obj -<< -/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font ->> -endobj -3 0 obj -<< -/Contents 8 0 R /MediaBox [ 0 0 612 792 ] /Parent 7 0 R /Resources << -/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] ->> /Rotate 0 /Trans << - ->> - /Type /Page ->> -endobj -4 0 obj -<< -/Contents 9 0 R /MediaBox [ 0 0 612 792 ] /Parent 7 0 R /Resources << -/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] ->> /Rotate 0 /Trans << - ->> - /Type /Page ->> -endobj -5 0 obj -<< -/PageMode /UseNone /Pages 7 0 R /Type /Catalog ->> -endobj -6 0 obj -<< -/Author (anonymous) /CreationDate (D:20241104180641-05'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20241104180641-05'00') /Producer (ReportLab PDF Library - www.reportlab.com) - /Subject (unspecified) /Title (untitled) /Trapped /False ->> -endobj -7 0 obj -<< -/Count 2 /Kids [ 3 0 R 4 0 R ] /Type /Pages ->> -endobj -8 0 obj -<< -/Filter [ /ASCII85Decode /FlateDecode ] /Length 2270 ->> -stream -GasaqgMYb8&:O"K%$3S2L?sf/fQ#c4M[Q:SMomN,!e+:76YU%nX6qU:W*eF<92_Q+P6m1-1,#tT3HO>A+r]Jh$GYVkkl$Bf^5XP0cmkl*Fuc>JDtIc:'aZWF>:d?8^nqKMSRH*tr)gZi68MO)8#l#+&)e6'^/c=88+j6dX*T+e_\!5eJDD[^Mq\E/kZN/K@O.$qXDHBDBCg/rEHc]Yif[=e2-`2\G0"66M)QaGJ`D]=R$VY$9/(p7ZmkO:)``D+<4jVihC@]MXrX[;P;di6!ORJ+ZuFZQ+Eq^0n:F)ZlbFVuiZ1OjO'm]GO"ot7D:F@grs$!TAjKY0.Eop`Z65;-b"=f56!.cup-*DItcL^em0f;1u6.AFP-lY-TrRU4dC%1F49Zg(B87[04t4ecuc9bNF##7ZMYrF7BQU!)1U1PJFQ!j,P5"rn&Y`j<<35mN\3kc>TClO]XeIJd>eU"q;]94j*l[*hf]Pd\YN"Q-L!l,em?8clRIId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?hV)qq!\8fF5m/c9&O67>qG2`dgg3^2AMCJ&o]juRT4+G%*/1o$E3pk\DoWS\eM1(W+nlJ,N5gJ,)=T1u'@Z$PY/WeIo[q#W)5h,Ng6N>Qp]nR,F)QTAmejpUK=6W(cC5g"W<7>CT-oKf<"j?o===)4ejC(l8r*RGW1XttHO8(NCcK-1&S?+4WmmfB`+TM[\2UOQk38WeWo$oW2t=GI&_R6";'j4bm$endstream -endobj -9 0 obj -<< -/Filter [ /ASCII85Decode /FlateDecode ] /Length 272 ->> -stream -Gap@Hd7T$G%#+0E'Z[g7ZE5nP>!ZTTe`[B_?#$_5Dedb9e$h8nKEMq%Et33B=Ll0a-fDsRrT<#Zi"Omh[=s+NX'aN8rM,Dm4B_Of9:oA7W(QBS9a2\2&J/NRNA;716'+BL0O5h.Ucf\MXI77eJU?W!]DXOK1h`5##+&cF7&?AO3ML.Q:mK+qPHEdO#:btJlO(7WDjc`?`MC$^g[I4mSu!jZZ]JlpcB_ZYiQ;q7Pp.T9Q:P$EObbV\Nendstream -endobj -xref -0 10 -0000000000 65535 f -0000000073 00000 n -0000000104 00000 n -0000000211 00000 n -0000000404 00000 n -0000000597 00000 n -0000000665 00000 n -0000000961 00000 n -0000001026 00000 n -0000003387 00000 n -trailer -<< -/ID -[<9407f775befdeb4ef8b5cf72ca950654><9407f775befdeb4ef8b5cf72ca950654>] -% ReportLab generated PDF document -- digest (http://www.reportlab.com) - -/Info 6 0 R -/Root 5 0 R -/Size 10 ->> -startxref -3749 -%%EOF diff --git a/swarms/artifacts/main_artifact.py b/swarms/artifacts/main_artifact.py index 551cabfb..d2009476 100644 --- a/swarms/artifacts/main_artifact.py +++ b/swarms/artifacts/main_artifact.py @@ -33,6 +33,7 @@ class Artifact(BaseModel): Represents a file artifact. Attributes: + folder_path file_path (str): The path to the file. file_type (str): The type of the file. contents (str): The contents of the file. @@ -272,28 +273,27 @@ class Artifact(BaseModel): if output_format == ".pdf": self._save_as_pdf(output_path) else: - with open(output_path, "w", encoding="utf-8"): - if output_format == ".md": - # Create the file in the specified folder - create_file_in_folder( - self.folder_path, - self.file_path, - f"{os.path.basename(self.file_path)}\n\n{self.contents}", - ) + if output_format == ".md": + # Create the file in the specified folder + create_file_in_folder( + self.folder_path, + self.file_path, + f"{os.path.basename(self.file_path)}\n\n{self.contents}", + ) - elif output_format == ".py": - # Add Python file header - create_file_in_folder( - self.folder_path, - self.file_path, - f"#{os.path.basename(self.file_path)}\n\n{self.contents}", - ) - else: # .txt - create_file_in_folder( - self.folder_path, - self.file_path, - self.contents, - ) + elif output_format == ".py": + # Add Python file header + create_file_in_folder( + self.folder_path, + self.file_path, + f"#{os.path.basename(self.file_path)}\n\n{self.contents}", + ) + else: # .txt + create_file_in_folder( + self.folder_path, + self.file_path, + self.contents, + ) def _save_as_pdf(self, output_path: str) -> None: """