From ec591af8e4e45b3f62fa815ada9df3b67eb82551 Mon Sep 17 00:00:00 2001 From: threnjen Date: Fri, 20 Dec 2024 12:14:30 -0800 Subject: [PATCH] temp disable dynamodb key checking and overwrite all --- aws_terraform_bgg/dynamo_db.tf | 15 -------- modules/rag_description_generation/main.py | 40 ++++++++++------------ 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/aws_terraform_bgg/dynamo_db.tf b/aws_terraform_bgg/dynamo_db.tf index 0d2375d..cc05a71 100644 --- a/aws_terraform_bgg/dynamo_db.tf +++ b/aws_terraform_bgg/dynamo_db.tf @@ -9,21 +9,6 @@ resource "aws_dynamodb_table" "game_generated_descriptions-dynamodb-table" { type = "S" } - # attribute { - # name = "game_description" - # type = "S" - # } - - # attribute { - # name = "game_pros" - # type = "S" - # } - - # attribute { - # name = "game_cons" - # type = "S" - # } - tags = { Name = "game_generated_descriptions" Environment = "production" diff --git a/modules/rag_description_generation/main.py b/modules/rag_description_generation/main.py index 5519810..1895078 100644 --- a/modules/rag_description_generation/main.py +++ b/modules/rag_description_generation/main.py @@ -128,27 +128,25 @@ def process_single_game( all_games_df: pd.DataFrame, generate_prompt: str, ): - if not self.dynamodb_client.check_dynamo_db_key(game_id=game_id): - df, game_name, game_mean = get_single_game_entries( - df=all_games_df, game_id=game_id, sample_pct=0.05 - ) - reviews = df["combined_review"].to_list() - weaviate_client.add_collection_batch(game_id=game_id, reviews=reviews) - current_prompt = weaviate_client.prompt_replacement( - current_prompt=generate_prompt, - overall_stats=self.overall_stats, - game_name=game_name, - game_mean=game_mean, - ) - summary = weaviate_client.generate_aggregated_review( - game_id, current_prompt - ) - self.dynamodb_client.divide_and_process_generated_summary( - game_id, summary=summary.generated - ) - # print(f"\n{summary.generated}") - # weaviate_client.remove_collection_items(game_id=game_id, reviews=reviews) - return + # if not self.dynamodb_client.check_dynamo_db_key(game_id=game_id): + df, game_name, game_mean = get_single_game_entries( + df=all_games_df, game_id=game_id, sample_pct=0.05 + ) + reviews = df["combined_review"].to_list() + weaviate_client.add_collection_batch(game_id=game_id, reviews=reviews) + current_prompt = weaviate_client.prompt_replacement( + current_prompt=generate_prompt, + overall_stats=self.overall_stats, + game_name=game_name, + game_mean=game_mean, + ) + summary = weaviate_client.generate_aggregated_review(game_id, current_prompt) + self.dynamodb_client.divide_and_process_generated_summary( + game_id, summary=summary.generated + ) + # print(f"\n{summary.generated}") + # weaviate_client.remove_collection_items(game_id=game_id, reviews=reviews) + return print(f"Game {game_id} already processed")