From 829bf10ce2b54fb7f9a43161f1436898d8df6bba Mon Sep 17 00:00:00 2001 From: Ayyub I Date: Tue, 7 Nov 2023 20:47:05 -0600 Subject: [PATCH] replaced hypothetical embeddings w base embeddings --- packages/backend/src/preprocessor.py | 20 +++++++++---------- .../googlecloud/functions/getanswer/helper.py | 20 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/packages/backend/src/preprocessor.py b/packages/backend/src/preprocessor.py index 87318690..50ea743d 100644 --- a/packages/backend/src/preprocessor.py +++ b/packages/backend/src/preprocessor.py @@ -19,7 +19,7 @@ def create_embeddings(): - llm = ChatOpenAI() + # llm = ChatOpenAI() base_embeddings = OpenAIEmbeddings() @@ -38,16 +38,16 @@ def create_embeddings(): input_variables=["user_query"], template=in_depth_prompt_template ) - llm_chain_general = LLMChain(llm=llm, prompt=general_prompt) - llm_chain_in_depth = LLMChain(llm=llm, prompt=in_depth_prompt) + # llm_chain_general = LLMChain(llm=llm, prompt=general_prompt) + # llm_chain_in_depth = LLMChain(llm=llm, prompt=in_depth_prompt) - general_embeddings = HypotheticalDocumentEmbedder( - llm_chain=llm_chain_general, - base_embeddings=base_embeddings, - ) - in_depth_embeddings = HypotheticalDocumentEmbedder( - llm_chain=llm_chain_in_depth, base_embeddings=base_embeddings - ) + # general_embeddings = HypotheticalDocumentEmbedder( + # llm_chain=llm_chain_general, + # base_embeddings=base_embeddings, + # ) + # in_depth_embeddings = HypotheticalDocumentEmbedder( + # llm_chain=llm_chain_in_depth, base_embeddings=base_embeddings + # ) return base_embeddings, base_embeddings diff --git a/packages/googlecloud/functions/getanswer/helper.py b/packages/googlecloud/functions/getanswer/helper.py index 0d77e6eb..08c34df5 100644 --- a/packages/googlecloud/functions/getanswer/helper.py +++ b/packages/googlecloud/functions/getanswer/helper.py @@ -37,8 +37,6 @@ def get_dbs(): def create_embeddings(): - llm = ChatOpenAI() - general_prompt_template = """ As an AI assistant tasked with generating brief general summaries, your role is to provide succinct, balanced information from the transcripts of New Orleans City Council meetings in response to the question "{question}". The response should not exceed one paragraph in length. If the available information from the transcripts is insufficient to accurately summarize the issue, please respond with 'Insufficient information available.' If the question extends beyond the scope of information contained in the transcripts, state 'I don't know.' Answer:""" @@ -54,19 +52,19 @@ def create_embeddings(): input_variables=["question"], template=in_depth_prompt_template ) - llm_chain_general = LLMChain(llm=llm, prompt=general_prompt) - llm_chain_in_depth = LLMChain(llm=llm, prompt=in_depth_prompt) + # llm_chain_general = LLMChain(llm=llm, prompt=general_prompt) + # llm_chain_in_depth = LLMChain(llm=llm, prompt=in_depth_prompt) base_embeddings = OpenAIEmbeddings() - general_embeddings = HypotheticalDocumentEmbedder( - llm_chain=llm_chain_general, base_embeddings=base_embeddings - ) - in_depth_embeddings = HypotheticalDocumentEmbedder( - llm_chain=llm_chain_in_depth, base_embeddings=base_embeddings - ) + # general_embeddings = HypotheticalDocumentEmbedder( + # llm_chain=llm_chain_general, base_embeddings=base_embeddings + # ) + # in_depth_embeddings = HypotheticalDocumentEmbedder( + # llm_chain=llm_chain_in_depth, base_embeddings=base_embeddings + # ) - return general_embeddings, in_depth_embeddings + return base_embeddings, base_embeddings def sort_retrived_documents(doc_list):