diff --git a/backend/llms/gpt.py b/backend/llms/gpt.py index 4b03d4c..20d037e 100644 --- a/backend/llms/gpt.py +++ b/backend/llms/gpt.py @@ -368,6 +368,17 @@ async def generate_chart_config( return parsed_config + async def generate_suggested_column_types(self, data: dict): + """Generate suggested column types for the given data.""" + self._add_system_message(assistant_type="column_type_suggestion") + self._set_response_format(is_json=True) + + prompt = self.prompt_manager.create_column_type_suggestion_prompt(data) + + gpt_response = await self._send_and_receive_message(prompt) + + return gpt_response + def fetch_table_name_from_sample( self, sample_content: str, extra_desc: str, table_metadata: str ): diff --git a/backend/routes/data_profile_routes.py b/backend/routes/data_profile_routes.py index 3721cab..ea4f1f5 100644 --- a/backend/routes/data_profile_routes.py +++ b/backend/routes/data_profile_routes.py @@ -128,6 +128,14 @@ async def preview_data_profile( return extracted_data +# @data_profile_router.post("/data-profiles/preview/column-types/") +# async def generate_suggested_column_types( +# data, current_user: User = Depends(get_current_user) +# ): +# gpt = GPTLLM(chat_id=1, user=current_user) +# suggested_column_types = await gpt.generate_suggested_column_types(data) + + @data_profile_router.post("/data-profiles/{data_profile_name}/preview/") async def preview_data_profile_upload( data_profile_name: str,