diff --git a/leonardo_engine/leonardo_sync.py b/leonardo_engine/leonardo_sync.py index 0225f96..485210c 100644 --- a/leonardo_engine/leonardo_sync.py +++ b/leonardo_engine/leonardo_sync.py @@ -62,7 +62,7 @@ def get_user_info(self): self.___logger.error(f"Error occurred while getting user info: {str(error)}") raise - async def post_generations( + def post_generations( self, prompt: str, negative_prompt: str = None, @@ -146,7 +146,7 @@ async def post_generations( self.___logger.error(f"Error occurred while post generations: {str(error)}") raise - async def get_single_generation(self, generation_id: str): + def get_single_generation(self, generation_id: str): """ This endpoint will provide information about a specific generation. @@ -167,7 +167,7 @@ async def get_single_generation(self, generation_id: str): self.___logger.error(f"Error occurred while get single generations: {str(error)}") raise - async def delete_single_generation(self, generation_id: str): + def delete_single_generation(self, generation_id: str): """ This endpoint deletes a specific generation. @@ -188,7 +188,7 @@ async def delete_single_generation(self, generation_id: str): self.___logger.error(f"Error occurred while delete generation: {str(error)}") raise - async def get_generations_by_user(self, user_id: str, offset: int = 0, limit: int = 10): + def get_generations_by_user(self, user_id: str, offset: int = 0, limit: int = 10): """ This endpoint returns all generations by a specific user. @@ -261,7 +261,7 @@ def upload_init_image(self, file_path: str): self.___logger.error(f"Error occurred while upload init image: {str(error)}") raise - async def get_single_init_image(self, image_id: str): + def get_single_init_image(self, image_id: str): """ This endpoint will return a single init image. @@ -282,7 +282,7 @@ async def get_single_init_image(self, image_id: str): self.___logger.error(f"Error occurred while obtain single init image: {str(error)}") raise - async def delete_init_image(self, image_id: str): + def delete_init_image(self, image_id: str): """ This endpoint deletes an init image. @@ -303,7 +303,7 @@ async def delete_init_image(self, image_id: str): self.___logger.error(f"Error occurred while deleting init image: {str(error)}") raise - async def create_upscale(self, image_id: str): + def create_upscale(self, image_id: str): """ This endpoint will create an upscale for the provided image ID. @@ -327,7 +327,7 @@ async def create_upscale(self, image_id: str): self.___logger.error(f"Error occurred while upscaling image: {str(error)}") raise - async def get_variation_by_id(self, generation_id: str): + def get_variation_by_id(self, generation_id: str): """ This endpoint will get the variation by ID. @@ -348,7 +348,7 @@ async def get_variation_by_id(self, generation_id: str): self.___logger.error(f"Error occurred while get variation by id: {str(error)}") raise - async def create_dataset(self, name: str, description: str = None): + def create_dataset(self, name: str, description: str = None): """ This endpoint creates a new dataset. @@ -373,7 +373,7 @@ async def create_dataset(self, name: str, description: str = None): self.___logger.error(f"Error occurred while create dataset: {str(error)}") raise - async def get_dataset_by_id(self, dataset_id: str): + def get_dataset_by_id(self, dataset_id: str): """ This endpoint gets the specific dataset. @@ -394,7 +394,7 @@ async def get_dataset_by_id(self, dataset_id: str): self.___logger.error(f"Error occurred while get dataset: {str(error)}") raise - async def delete_dataset_by_id(self, dataset_id: str): + def delete_dataset_by_id(self, dataset_id: str): """ This endpoint deletes the specific dataset. @@ -466,7 +466,7 @@ def upload_dataset_image(self, dataset_id: str, file_path: str): self.___logger.error(f"Error occurred uploading dataset: {str(error)}") raise - async def upload_generated_image_to_dataset(self, dataset_id: str, generated_image_id: str): + def upload_generated_image_to_dataset(self, dataset_id: str, generated_image_id: str): """ This endpoint will upload a previously generated image to the dataset. @@ -497,7 +497,7 @@ async def upload_generated_image_to_dataset(self, dataset_id: str, generated_ima self.___logger.error(f"Error occurred while upload generated image to dataset: {str(error)}") raise - async def train_custom_model( + def train_custom_model( self, name: str, dataset_id: str, @@ -541,7 +541,7 @@ async def train_custom_model( url, json=payload, headers=self.___session.headers.copy().update(self.___post_headers) ) response.raise_for_status() - response = await response.text() + response = response.text() if self.___logger: self.___logger.debug(f"Custom modal has been trained: {response}") return response @@ -550,7 +550,7 @@ async def train_custom_model( self.___logger.error(f"Error training custom model: {str(error)}") raise - async def get_custom_model_by_id(self, model_id: str): + def get_custom_model_by_id(self, model_id: str): """ This endpoint gets the specific custom model. @@ -571,7 +571,7 @@ async def get_custom_model_by_id(self, model_id: str): self.___logger.error(f"Error obtaining custom model: {str(error)}") raise - async def delete_custom_model_by_id(self, model_id: str): + def delete_custom_model_by_id(self, model_id: str): """ This endpoint will delete a specific custom model. @@ -583,7 +583,7 @@ async def delete_custom_model_by_id(self, model_id: str): try: response = self.___session.delete(url, headers=self.___session.headers.copy().update(self.___get_headers)) response.raise_for_status() - response = await response.text() + response = response.text() if self.___logger: self.___logger.debug(f"Custom modal has been deleted: {response}") return response @@ -592,7 +592,7 @@ async def delete_custom_model_by_id(self, model_id: str): self.___logger.error(f"Error delete custom model: {str(error)}") raise - async def wait_for_image_generation(self, generation_id, image_index=None, poll_interval=5, timeout=120): + def wait_for_image_generation(self, generation_id, image_index=None, poll_interval=5, timeout=120): """ This method waits for the completion of image generation. @@ -608,7 +608,7 @@ async def wait_for_image_generation(self, generation_id, image_index=None, poll_ """ timeout_counter = 0 while True: - response = await self.get_single_generation(generation_id) + response = self.get_single_generation(generation_id) generation = response.get("generations_by_pk", {}) status = generation.get("status") diff --git a/openai_engine/chatgpt.py b/openai_engine/chatgpt.py index 97bd52a..1cbbcb7 100644 --- a/openai_engine/chatgpt.py +++ b/openai_engine/chatgpt.py @@ -695,7 +695,6 @@ async def process_chat(self, prompt, default_choice=0, chat_name=None): func_call[key] = value if chunk["choices"][default_choice]["finish_reason"] is not None: if chunk["choices"][default_choice]["finish_reason"] == 'function_call': - print(func_call) func_response = await self.process_function(function_call=func_call) break if "content" in chunk["choices"][default_choice]["delta"]: