Skip to content

Commit 6182b5a

Browse files
committed
rename artifact to document generator tool
1 parent 6c1d47e commit 6182b5a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

helpers/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const supportedTools: Tool[] = [
7272
name: TOOL_SYSTEM_PROMPT_ENV_VAR,
7373
description: "System prompt for DuckDuckGo search tool.",
7474
value: `You are a DuckDuckGo search agent.
75-
You can use the duckduckgo search tool to get information from the web to answer user questions.
75+
You can use the duckduckgo search tool to get information or images from the web to answer user questions.
7676
For better results, you can specify the region parameter to get results from a specific region but it's optional.`,
7777
},
7878
],

templates/components/engines/python/agent/tools/artifact.py renamed to templates/components/engines/python/agent/tools/document_generator.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
OUTPUT_DIR = "output/tools"
1010

1111

12-
class ArtifactType(Enum):
12+
class DocumentType(Enum):
1313
PDF = "pdf"
1414
HTML = "html"
1515

@@ -98,7 +98,7 @@ class ArtifactType(Enum):
9898
"""
9999

100100

101-
class ArtifactGenerator:
101+
class DocumentGenerator:
102102
@classmethod
103103
def _generate_html_content(cls, original_content: str) -> str:
104104
"""
@@ -159,36 +159,36 @@ def _generate_html(cls, html_content: str) -> str:
159159
)
160160

161161
@classmethod
162-
def generate_artifact(
163-
cls, original_content: str, artifact_type: str, file_name: str
162+
def generate_document(
163+
cls, original_content: str, document_type: str, file_name: str
164164
) -> str:
165165
"""
166166
To generate artifact as PDF or HTML file.
167167
Parameters:
168168
original_content: str (markdown style)
169-
artifact_type: str (pdf or html) specify the type of the file format based on the use case
169+
document_type: str (pdf or html) specify the type of the file format based on the use case
170170
file_name: str (name of the artifact file) must be a valid file name, no extensions needed
171171
Returns:
172172
str (URL to the artifact file): A file URL ready to serve.
173173
"""
174174
try:
175-
artifact_type = ArtifactType(artifact_type.lower())
175+
document_type = DocumentType(document_type.lower())
176176
except ValueError:
177177
raise ValueError(
178-
f"Invalid artifact type: {artifact_type}. Must be 'pdf' or 'html'."
178+
f"Invalid document type: {document_type}. Must be 'pdf' or 'html'."
179179
)
180180
# Always generate html content first
181181
html_content = cls._generate_html_content(original_content)
182182

183183
# Based on the type of artifact, generate the corresponding file
184-
if artifact_type == ArtifactType.PDF:
184+
if document_type == DocumentType.PDF:
185185
content = cls._generate_pdf(html_content)
186186
file_extension = "pdf"
187-
elif artifact_type == ArtifactType.HTML:
187+
elif document_type == DocumentType.HTML:
188188
content = BytesIO(cls._generate_html(html_content).encode("utf-8"))
189189
file_extension = "html"
190190
else:
191-
raise ValueError(f"Unexpected artifact type: {artifact_type}")
191+
raise ValueError(f"Unexpected document type: {document_type}")
192192

193193
file_name = cls._validate_file_name(file_name)
194194
file_path = os.path.join(OUTPUT_DIR, f"{file_name}.{file_extension}")
@@ -226,4 +226,4 @@ def _validate_file_name(file_name: str) -> str:
226226

227227

228228
def get_tools(**kwargs):
229-
return [FunctionTool.from_defaults(ArtifactGenerator.generate_artifact)]
229+
return [FunctionTool.from_defaults(DocumentGenerator.generate_document)]

0 commit comments

Comments
 (0)