From 305593e9b27c332a2c093863e3696302ec946521 Mon Sep 17 00:00:00 2001 From: vinicvaz Date: Mon, 27 Nov 2023 10:06:40 -0300 Subject: [PATCH] bump version --- config.toml | 4 ++-- .../PromptCreatorForImageGeneratorPiece/piece.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config.toml b/config.toml index c2e12c6..8271f4d 100644 --- a/config.toml +++ b/config.toml @@ -8,5 +8,5 @@ REPOSITORY_NAME = "openai_domino_pieces" REPOSITORY_LABEL = "OpenAI Domino Pieces" # The version of this Pieces release -# Attention: changing this will create a new release -VERSION = "0.6.1" \ No newline at end of file +# Attention: changing this will create a new release +VERSION = "0.7.0" \ No newline at end of file diff --git a/pieces/PromptCreatorForImageGeneratorPiece/piece.py b/pieces/PromptCreatorForImageGeneratorPiece/piece.py index 8c0965f..860900e 100644 --- a/pieces/PromptCreatorForImageGeneratorPiece/piece.py +++ b/pieces/PromptCreatorForImageGeneratorPiece/piece.py @@ -26,15 +26,15 @@ def openai_response(self, input_data: InputModel, prompt: str, client: OpenAI): def piece_function(self, input_data: InputModel, secrets_data: SecretsModel): if secrets_data.OPENAI_API_KEY is None: raise Exception("OPENAI_API_KEY not found in ENV vars. Please add it to the secrets section of the Piece.") - + client = OpenAI(api_key=secrets_data.OPENAI_API_KEY) - template = """You have access to an AI that generates images through text prompts. + template = """You have access to an AI that generates images through text prompts. Your function is to write a prompt for this AI from a given context. It is very importat that the maximum size of the output prompt must be 1000 characters. Keep in mind that the AI generating images has no knowledge of the context you've been given. Therefore, it's crucial to include all the important information in the prompt you generate. -You always write a short prompt that is designed to help the image generator AI create an image for the given context. -You are very good at writing these text prompts for any context that is given to you. -You're very creative in how you describe the context you've been given, and like to vary the mood that runs through the prompt you've written. +You always write a short prompt that is designed to help the image generator AI create an image for the given context. +You are very good at writing these text prompts for any context that is given to you. +You're very creative in how you describe the context you've been given, and like to vary the mood that runs through the prompt you've written. You always suggest some specific art style for the AI to create the image. For this one the art style would be: {art_style} Now, create a prompt to help the image generator AI to create an image for this context: @@ -50,7 +50,7 @@ def piece_function(self, input_data: InputModel, secrets_data: SecretsModel): return OutputModel( generated_prompt_string=generated_prompt, ) - + output_file_path = f"{self.results_path}/generated_prompt.txt" with open(output_file_path, "w") as f: f.write(generated_prompt) @@ -61,14 +61,14 @@ def piece_function(self, input_data: InputModel, secrets_data: SecretsModel): return OutputModel( generated_prompt_file_path=output_file_path ) - + self.logger.info(f"Returning prompt as a string and file in: {output_file_path}") self.format_display_result(input_data, generated_prompt) return OutputModel( generated_prompt_string=generated_prompt, generated_prompt_file_path=output_file_path ) - + def format_display_result(self, input_data: InputModel, generated_prompt_string: str): md_text = f""" ## Generated prompt: