mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-22 16:14:20 +01:00
feat: uncomment
This commit is contained in:
146
micro_chain.py
146
micro_chain.py
@@ -18,85 +18,83 @@ def wrap_content_in_code_block(executor_content, file_name, tag):
|
||||
def main(
|
||||
executor_description,
|
||||
input_modality,
|
||||
# input_doc_field,
|
||||
output_modality,
|
||||
# output_doc_field,
|
||||
test_scenario,
|
||||
do_validation=True
|
||||
):
|
||||
# input_doc_field = 'text' if input_modality == 'text' else 'blob'
|
||||
# output_doc_field = 'text' if output_modality == 'text' else 'blob'
|
||||
# # random integer at the end of the executor name to avoid name clashes
|
||||
# executor_name = f'MicroChainExecutor{random.randint(0, 1000_000)}'
|
||||
# recreate_folder('executor')
|
||||
# EXECUTOR_FOLDER_v1 = 'executor/v1'
|
||||
# recreate_folder(EXECUTOR_FOLDER_v1)
|
||||
# recreate_folder('flow')
|
||||
#
|
||||
# print_colored('', '############# Executor #############', 'red')
|
||||
# user_query = (
|
||||
# general_guidelines()
|
||||
# + executor_file_task(executor_name, executor_description, input_modality, input_doc_field,
|
||||
# output_modality, output_doc_field)
|
||||
# + chain_of_thought_creation()
|
||||
# )
|
||||
# conversation = gpt.Conversation()
|
||||
# conversation.query(user_query)
|
||||
# executor_content_raw = conversation.query(chain_of_thought_optimization('python', 'executor.py'))
|
||||
# executor_content = extract_content_from_result(executor_content_raw, 'executor.py')
|
||||
# persist_file(executor_content, 'executor.py')
|
||||
#
|
||||
# print_colored('', '############# Test Executor #############', 'red')
|
||||
# user_query = (
|
||||
# general_guidelines()
|
||||
# + wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
# + test_executor_file_task(executor_name, test_scenario)
|
||||
# )
|
||||
# conversation = gpt.Conversation()
|
||||
# conversation.query(user_query)
|
||||
# test_executor_content_raw = conversation.query(
|
||||
# chain_of_thought_optimization('python', 'test_executor.py')
|
||||
# + "Don't add any additional tests. "
|
||||
# )
|
||||
# test_executor_content = extract_content_from_result(test_executor_content_raw, 'test_executor.py')
|
||||
# persist_file(test_executor_content, 'test_executor.py')
|
||||
#
|
||||
# print_colored('', '############# Requirements #############', 'red')
|
||||
# user_query = (
|
||||
# general_guidelines()
|
||||
# + wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
# + wrap_content_in_code_block(test_executor_content, 'test_executor.py', 'python')
|
||||
# + requirements_file_task()
|
||||
# )
|
||||
# conversation = gpt.Conversation()
|
||||
# conversation.query(user_query)
|
||||
# requirements_content_raw = conversation.query(chain_of_thought_optimization('', 'requirements.txt') + "Keep the same version of jina ")
|
||||
#
|
||||
# requirements_content = extract_content_from_result(requirements_content_raw, 'requirements.txt')
|
||||
# persist_file(requirements_content, 'requirements.txt')
|
||||
#
|
||||
# print_colored('', '############# Dockerfile #############', 'red')
|
||||
# user_query = (
|
||||
# general_guidelines()
|
||||
# + wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
# + wrap_content_in_code_block(test_executor_content, 'test_executor.py', 'python')
|
||||
# + wrap_content_in_code_block(requirements_content, 'requirements.txt', '')
|
||||
# + docker_file_task()
|
||||
# )
|
||||
# conversation = gpt.Conversation()
|
||||
# conversation.query(user_query)
|
||||
# dockerfile_content_raw = conversation.query(chain_of_thought_optimization('dockerfile', 'Dockerfile'))
|
||||
# dockerfile_content = extract_content_from_result(dockerfile_content_raw, 'Dockerfile')
|
||||
# persist_file(dockerfile_content, 'Dockerfile')
|
||||
#
|
||||
# write_config_yml(executor_name, EXECUTOR_FOLDER_v1)
|
||||
input_doc_field = 'text' if input_modality == 'text' else 'blob'
|
||||
output_doc_field = 'text' if output_modality == 'text' else 'blob'
|
||||
# random integer at the end of the executor name to avoid name clashes
|
||||
executor_name = f'MicroChainExecutor{random.randint(0, 1000_000)}'
|
||||
recreate_folder('executor')
|
||||
EXECUTOR_FOLDER_v1 = 'executor/v1'
|
||||
recreate_folder(EXECUTOR_FOLDER_v1)
|
||||
recreate_folder('flow')
|
||||
|
||||
print_colored('', '############# Executor #############', 'red')
|
||||
user_query = (
|
||||
general_guidelines()
|
||||
+ executor_file_task(executor_name, executor_description, input_modality, input_doc_field,
|
||||
output_modality, output_doc_field)
|
||||
+ chain_of_thought_creation()
|
||||
)
|
||||
conversation = gpt.Conversation()
|
||||
conversation.query(user_query)
|
||||
executor_content_raw = conversation.query(chain_of_thought_optimization('python', 'executor.py'))
|
||||
executor_content = extract_content_from_result(executor_content_raw, 'executor.py')
|
||||
persist_file(executor_content, 'executor.py')
|
||||
|
||||
print_colored('', '############# Test Executor #############', 'red')
|
||||
user_query = (
|
||||
general_guidelines()
|
||||
+ wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
+ test_executor_file_task(executor_name, test_scenario)
|
||||
)
|
||||
conversation = gpt.Conversation()
|
||||
conversation.query(user_query)
|
||||
test_executor_content_raw = conversation.query(
|
||||
chain_of_thought_optimization('python', 'test_executor.py')
|
||||
+ "Don't add any additional tests. "
|
||||
)
|
||||
test_executor_content = extract_content_from_result(test_executor_content_raw, 'test_executor.py')
|
||||
persist_file(test_executor_content, 'test_executor.py')
|
||||
|
||||
print_colored('', '############# Requirements #############', 'red')
|
||||
user_query = (
|
||||
general_guidelines()
|
||||
+ wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
+ wrap_content_in_code_block(test_executor_content, 'test_executor.py', 'python')
|
||||
+ requirements_file_task()
|
||||
)
|
||||
conversation = gpt.Conversation()
|
||||
conversation.query(user_query)
|
||||
requirements_content_raw = conversation.query(chain_of_thought_optimization('', 'requirements.txt') + "Keep the same version of jina ")
|
||||
|
||||
requirements_content = extract_content_from_result(requirements_content_raw, 'requirements.txt')
|
||||
persist_file(requirements_content, 'requirements.txt')
|
||||
|
||||
print_colored('', '############# Dockerfile #############', 'red')
|
||||
user_query = (
|
||||
general_guidelines()
|
||||
+ wrap_content_in_code_block(executor_content, 'executor.py', 'python')
|
||||
+ wrap_content_in_code_block(test_executor_content, 'test_executor.py', 'python')
|
||||
+ wrap_content_in_code_block(requirements_content, 'requirements.txt', '')
|
||||
+ docker_file_task()
|
||||
)
|
||||
conversation = gpt.Conversation()
|
||||
conversation.query(user_query)
|
||||
dockerfile_content_raw = conversation.query(chain_of_thought_optimization('dockerfile', 'Dockerfile'))
|
||||
dockerfile_content = extract_content_from_result(dockerfile_content_raw, 'Dockerfile')
|
||||
persist_file(dockerfile_content, 'Dockerfile')
|
||||
|
||||
write_config_yml(executor_name, EXECUTOR_FOLDER_v1)
|
||||
|
||||
for i in range(1, 20):
|
||||
conversation = gpt.Conversation()
|
||||
error = build_docker(f'executor_level2/v{i}')
|
||||
error = build_docker(f'executor/v{i}')
|
||||
if error:
|
||||
recreate_folder(f'executor_level2/v{i + 1}')
|
||||
file_name_to_content = get_all_executor_files_with_content(f'executor_level2/v{i}')
|
||||
recreate_folder(f'executor/v{i + 1}')
|
||||
file_name_to_content = get_all_executor_files_with_content(f'executor/v{i}')
|
||||
all_files_string = files_to_string(file_name_to_content)
|
||||
user_query = (
|
||||
'Here are all the files I use:\n'
|
||||
@@ -120,12 +118,12 @@ def main(
|
||||
file_name_to_content[file_name] = updated_file
|
||||
|
||||
for file_name, content in file_name_to_content.items():
|
||||
persist_file(content, f'executor_level2/v{i + 1}/{file_name}')
|
||||
persist_file(content, f'executor/v{i + 1}/{file_name}')
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
error = jina_cloud.push_executor('executor_level2')
|
||||
jina_cloud.push_executor('executor')
|
||||
host = jina_cloud.deploy_flow(executor_name, do_validation, 'flow')
|
||||
|
||||
# create playgorund and client.py
|
||||
@@ -149,7 +147,7 @@ if __name__ == '__main__':
|
||||
"and outputs a 2D image projection of that object where the full object is shown. ",
|
||||
input_modality='3d',
|
||||
output_modality='image',
|
||||
test_scenario='Test that 3d object from https://raw.githubusercontent.com/makehumancommunity/communityassets-wip/master/clothes/leotard_fs/leotard_fs.obj '
|
||||
test_scenario='Test that 3d object from https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj '
|
||||
'is put in and out comes a 2d rendering of it',
|
||||
do_validation=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user