From 11daadcf6cb445a3de669c8f27bcadcf4bcc1a89 Mon Sep 17 00:00:00 2001 From: threnjen Date: Mon, 23 Dec 2024 11:40:44 -0800 Subject: [PATCH] minor hotfixes --- Dockerfiles/Dockerfile.rag_description_generation | 2 +- modules/rag_description_generation/rag_dynamodb.py | 8 +++++++- modules/rag_description_generation/rag_weaviate.py | 12 ++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Dockerfiles/Dockerfile.rag_description_generation b/Dockerfiles/Dockerfile.rag_description_generation index b79a4e4..2fa947a 100644 --- a/Dockerfiles/Dockerfile.rag_description_generation +++ b/Dockerfiles/Dockerfile.rag_description_generation @@ -24,7 +24,7 @@ COPY modules/rag_description_generation modules/rag_description_generation COPY utils utils COPY modules/rag_description_generation/Pipfile* . COPY config* . -COPY modules/rag_description_generation/nltk_data root/nltk_data +COPY nltk_data root/nltk_data # Install dependencies with pipenv RUN pipenv sync diff --git a/modules/rag_description_generation/rag_dynamodb.py b/modules/rag_description_generation/rag_dynamodb.py index 751c69a..7ce84d1 100644 --- a/modules/rag_description_generation/rag_dynamodb.py +++ b/modules/rag_description_generation/rag_dynamodb.py @@ -17,8 +17,14 @@ def divide_and_process_generated_summary(self, game_id: str, summary: str) -> No .split("\n\n### Cons\n")[0] .replace("\n", "") .replace("-", "") + .strip() + ) + cons = ( + summary.split("\n\n### Cons\n")[-1] + .replace("\n", "") + .replace("-", "") + .strip() ) - cons = summary.split("\n\n### Cons\n")[-1].replace("\n", "").replace("-", "") response = self.dynamodb_client.put_item( TableName="game_generated_descriptions", diff --git a/modules/rag_description_generation/rag_weaviate.py b/modules/rag_description_generation/rag_weaviate.py index b1003b3..0475d34 100644 --- a/modules/rag_description_generation/rag_weaviate.py +++ b/modules/rag_description_generation/rag_weaviate.py @@ -147,12 +147,12 @@ def create_weaviate_collection(self): self.weaviate_client.collections.create( name=self.collection_name, - # vectorizer_config=[ - # Configure.NamedVectors.text2vec_transformers( - # name="title_vector", - # source_properties=["title"], - # ) - # ], + vectorizer_config=[ + Configure.NamedVectors.text2vec_transformers( + name="title_vector", + source_properties=["title"], + ) + ], generative_config=wvc.config.Configure.Generative.openai( model="gpt-4o-mini" ),