feat: frontend

This commit is contained in:
Florian Hönicke
2023-03-20 00:34:25 +01:00
parent 45b709ed15
commit 0116449082
12 changed files with 414 additions and 198 deletions

View File

@@ -7,7 +7,9 @@ def general_guidelines():
"General guidelines: "
"The code you write is production ready. "
"Every file starts with comments describing what the code is doing before the first import. "
"Then all imports are listed. It is important to import all modules that could be needed in the executor code."
"Then all imports are listed. "
"It is important to import all modules that could be needed in the executor code. "
"Always import BytesIO from io. "
"Comments can only be written between tags. "
"Start from top-level and then fully implement all methods. "
"\n"
@@ -18,13 +20,14 @@ def _task(task, tag_name, file_name):
return task + f"The code will go into {file_name}. Wrap the code in the string $$$start_{tag_name}$$$...$$$end_{tag_name}$$$ \n\n"
def executor_file_task(executor_name, input_executor_description, input_modality, input_doc_field,
def executor_file_task(executor_name, executor_description, input_modality, input_doc_field,
output_modality, output_doc_field):
return _task(
f"Write the executor called '{executor_name}'. "
f"It matches the following description: '{input_executor_description}'. "
f"It matches the following description: '{executor_description}'. "
f"It gets a DocumentArray as input where each document has the input modality '{input_modality}' that is stored in document.{input_doc_field}. "
f"It returns a DocumentArray as output where each document has the output modality '{output_modality}' that is stored in document.{output_doc_field}. ",
f"It returns a DocumentArray as output where each document has the output modality '{output_modality}' that is stored in document.{output_doc_field}. "
f"Have in mind that d.uri is never a path to a local file. It is always a url.",
'executor',
EXECUTOR_FILE_NAME
)
@@ -37,13 +40,13 @@ def requirements_file_task():
REQUIREMENTS_FILE_NAME)
def test_executor_file_task(executor_name, input_test_in, input_test_out):
def test_executor_file_task(executor_name, test_in, test_out):
return _task(
"Write a small unit test for the executor. "
"Start the test with an extensive comment about the test case. "
+ (
"Test that the executor converts the input '" + input_test_in + "' to the output '" + input_test_out + "'. "
) if input_test_in and input_test_out else ""
"Test that the executor converts the input '" + test_in + "' to the output '" + test_out + "'. "
) if test_in and test_out else ""
"Use the following import to import the executor: "
f"from executor import {executor_name} ",
'test_executor',