From aca00981e532d9eed526f0234519daa6b3314476 Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 10:39:46 +0100 Subject: [PATCH 1/7] change backend files and 4-pages --- code/backend/{Admin.py => admin.py} | 0 .../batch/{AddURLEmbeddings.py => add_url_embeddings.py} | 0 .../batch/{BatchPushResults.py => batch_push_results.py} | 0 ...{BatchStartProcessing.py => batch_start_processing.py} | 0 code/backend/batch/function_app.py | 8 ++++---- ...nversationResponse.py => get_conversation_response.py} | 0 .../batch/utilities/common/{Answer.py => answer.py} | 2 +- .../common/{SourceDocument.py => source_document.py} | 0 .../utilities/document_chunking/document_chunking_base.py | 2 +- .../utilities/document_chunking/fixed_size_overlap.py | 2 +- code/backend/batch/utilities/document_chunking/layout.py | 2 +- code/backend/batch/utilities/document_chunking/page.py | 2 +- .../batch/utilities/document_chunking/paragraph.py | 2 +- .../utilities/document_loading/document_loading_base.py | 2 +- code/backend/batch/utilities/document_loading/layout.py | 2 +- code/backend/batch/utilities/document_loading/read.py | 2 +- code/backend/batch/utilities/document_loading/web.py | 2 +- .../batch/utilities/document_loading/word_document.py | 2 +- .../embedders/integrated_vectorization_embedder.py | 8 ++++---- .../batch/utilities/helpers/embedders/push_embedder.py | 2 +- ...zureSearchDatasource.py => azure_search_datasource.py} | 0 .../{AzureSearchIndex.py => azure_search_index.py} | 0 .../{AzureSearchIndexer.py => azure_search_indexer.py} | 0 .../{AzureSearchSkillset.py => azure_search_skillset.py} | 0 .../{ConversationLogger.py => conversation_logger.py} | 0 .../batch/utilities/orchestrator/lang_chain_agent.py | 8 ++++---- .../batch/utilities/orchestrator/open_ai_functions.py | 8 ++++---- .../batch/utilities/orchestrator/orchestrator_base.py | 4 ++-- .../batch/utilities/orchestrator/semantic_kernel.py | 2 +- code/backend/batch/utilities/parser/output_parser_tool.py | 2 +- code/backend/batch/utilities/parser/parser_base.py | 2 +- code/backend/batch/utilities/plugins/chat_plugin.py | 6 +++--- .../batch/utilities/plugins/post_answering_plugin.py | 4 ++-- .../{AzureSearchHandler.py => azure_search_handler.py} | 4 ++-- ...dler.py => integrated_vectorization_search_handler.py} | 4 ++-- .../batch/utilities/search/{Search.py => search.py} | 6 +++--- .../{SearchHandlerBase.py => search_handler_base.py} | 2 +- ...{AnswerProcessingBase.py => answer_processing_base.py} | 2 +- .../{AnsweringToolBase.py => answering_tool_base.py} | 2 +- ...{ContentSafetyChecker.py => content_safety_checker.py} | 4 ++-- .../tools/{PostPromptTool.py => post_prompt_tool.py} | 2 +- .../{QuestionAnswerTool.py => question_answer_tool.py} | 8 ++++---- .../{TextProcessingTool.py => text_processing_tool.py} | 4 ++-- .../pages/{01_Ingest_Data.py => 01_ingest_data.py} | 0 .../pages/{02_Explore_Data.py => 02_explore_data.py} | 0 .../pages/{03_Delete_Data.py => 03_delete_data.py} | 0 .../pages/{04_Configuration.py => 04_donfiguration.py} | 0 code/tests/common/test_source_document.py | 2 +- .../tests/functions/test_advanced_image_processing.py | 2 +- code/tests/search_utilities/test_AzureSearchHandler.py | 4 ++-- .../test_IntegratedVectorizationSearchHandler.py | 4 ++-- code/tests/search_utilities/test_Search.py | 6 +++--- code/tests/test_AddURLEmbeddings.py | 2 +- code/tests/test_BatchPushResults.py | 2 +- code/tests/test_BatchStartProcessing.py | 2 +- code/tests/test_ContentSafetyChecker.py | 2 +- code/tests/test_GetConversationResponse.py | 2 +- code/tests/test_OutputParserTool.py | 2 +- .../utilities/helpers/test_document_chunking_helper.py | 2 +- code/tests/utilities/helpers/test_push_embedder.py | 2 +- .../test_azure_search_datasource.py | 2 +- .../integrated_vectorization/test_azure_search_index.py | 2 +- .../integrated_vectorization/test_azure_search_indexer.py | 2 +- .../test_azure_search_skillset.py | 2 +- .../tests/utilities/orchestrator/test_lang_chain_agent.py | 2 +- code/tests/utilities/orchestrator/test_semantic_kernel.py | 2 +- code/tests/utilities/plugins/test_chat_plugin.py | 2 +- .../tests/utilities/plugins/test_post_answering_plugin.py | 2 +- code/tests/utilities/test_question_answer_tool.py | 6 +++--- 69 files changed, 85 insertions(+), 85 deletions(-) rename code/backend/{Admin.py => admin.py} (100%) rename code/backend/batch/{AddURLEmbeddings.py => add_url_embeddings.py} (100%) rename code/backend/batch/{BatchPushResults.py => batch_push_results.py} (100%) rename code/backend/batch/{BatchStartProcessing.py => batch_start_processing.py} (100%) rename code/backend/batch/{GetConversationResponse.py => get_conversation_response.py} (100%) rename code/backend/batch/utilities/common/{Answer.py => answer.py} (97%) rename code/backend/batch/utilities/common/{SourceDocument.py => source_document.py} (100%) rename code/backend/batch/utilities/integrated_vectorization/{AzureSearchDatasource.py => azure_search_datasource.py} (100%) rename code/backend/batch/utilities/integrated_vectorization/{AzureSearchIndex.py => azure_search_index.py} (100%) rename code/backend/batch/utilities/integrated_vectorization/{AzureSearchIndexer.py => azure_search_indexer.py} (100%) rename code/backend/batch/utilities/integrated_vectorization/{AzureSearchSkillset.py => azure_search_skillset.py} (100%) rename code/backend/batch/utilities/loggers/{ConversationLogger.py => conversation_logger.py} (100%) rename code/backend/batch/utilities/search/{AzureSearchHandler.py => azure_search_handler.py} (97%) rename code/backend/batch/utilities/search/{IntegratedVectorizationSearchHandler.py => integrated_vectorization_search_handler.py} (97%) rename code/backend/batch/utilities/search/{Search.py => search.py} (74%) rename code/backend/batch/utilities/search/{SearchHandlerBase.py => search_handler_base.py} (95%) rename code/backend/batch/utilities/tools/{AnswerProcessingBase.py => answer_processing_base.py} (88%) rename code/backend/batch/utilities/tools/{AnsweringToolBase.py => answering_tool_base.py} (89%) rename code/backend/batch/utilities/tools/{ContentSafetyChecker.py => content_safety_checker.py} (97%) rename code/backend/batch/utilities/tools/{PostPromptTool.py => post_prompt_tool.py} (98%) rename code/backend/batch/utilities/tools/{QuestionAnswerTool.py => question_answer_tool.py} (96%) rename code/backend/batch/utilities/tools/{TextProcessingTool.py => text_processing_tool.py} (92%) rename code/backend/pages/{01_Ingest_Data.py => 01_ingest_data.py} (100%) rename code/backend/pages/{02_Explore_Data.py => 02_explore_data.py} (100%) rename code/backend/pages/{03_Delete_Data.py => 03_delete_data.py} (100%) rename code/backend/pages/{04_Configuration.py => 04_donfiguration.py} (100%) diff --git a/code/backend/Admin.py b/code/backend/admin.py similarity index 100% rename from code/backend/Admin.py rename to code/backend/admin.py diff --git a/code/backend/batch/AddURLEmbeddings.py b/code/backend/batch/add_url_embeddings.py similarity index 100% rename from code/backend/batch/AddURLEmbeddings.py rename to code/backend/batch/add_url_embeddings.py diff --git a/code/backend/batch/BatchPushResults.py b/code/backend/batch/batch_push_results.py similarity index 100% rename from code/backend/batch/BatchPushResults.py rename to code/backend/batch/batch_push_results.py diff --git a/code/backend/batch/BatchStartProcessing.py b/code/backend/batch/batch_start_processing.py similarity index 100% rename from code/backend/batch/BatchStartProcessing.py rename to code/backend/batch/batch_start_processing.py diff --git a/code/backend/batch/function_app.py b/code/backend/batch/function_app.py index f26c6f706..5eca04a1e 100644 --- a/code/backend/batch/function_app.py +++ b/code/backend/batch/function_app.py @@ -1,10 +1,10 @@ import logging import os import azure.functions as func -from AddURLEmbeddings import bp_add_url_embeddings -from BatchPushResults import bp_batch_push_results -from BatchStartProcessing import bp_batch_start_processing -from GetConversationResponse import bp_get_conversation_response +from add_url_embeddings import bp_add_url_embeddings +from batch_push_results import bp_batch_push_results +from batch_start_processing import bp_batch_start_processing +from get_conversation_response import bp_get_conversation_response from azure.monitor.opentelemetry import configure_azure_monitor logging.captureWarnings(True) diff --git a/code/backend/batch/GetConversationResponse.py b/code/backend/batch/get_conversation_response.py similarity index 100% rename from code/backend/batch/GetConversationResponse.py rename to code/backend/batch/get_conversation_response.py diff --git a/code/backend/batch/utilities/common/Answer.py b/code/backend/batch/utilities/common/answer.py similarity index 97% rename from code/backend/batch/utilities/common/Answer.py rename to code/backend/batch/utilities/common/answer.py index 33222c64e..19e56fecd 100644 --- a/code/backend/batch/utilities/common/Answer.py +++ b/code/backend/batch/utilities/common/answer.py @@ -1,6 +1,6 @@ import json from typing import List, Optional -from .SourceDocument import SourceDocument +from .source_document import SourceDocument class Answer: diff --git a/code/backend/batch/utilities/common/SourceDocument.py b/code/backend/batch/utilities/common/source_document.py similarity index 100% rename from code/backend/batch/utilities/common/SourceDocument.py rename to code/backend/batch/utilities/common/source_document.py diff --git a/code/backend/batch/utilities/document_chunking/document_chunking_base.py b/code/backend/batch/utilities/document_chunking/document_chunking_base.py index 178f89769..9b28d8fa7 100644 --- a/code/backend/batch/utilities/document_chunking/document_chunking_base.py +++ b/code/backend/batch/utilities/document_chunking/document_chunking_base.py @@ -1,7 +1,7 @@ # Create an abstract class for document loading from typing import List from abc import ABC, abstractmethod -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument from .chunking_strategy import ChunkingSettings diff --git a/code/backend/batch/utilities/document_chunking/fixed_size_overlap.py b/code/backend/batch/utilities/document_chunking/fixed_size_overlap.py index a6341b6e0..4baa83d2a 100644 --- a/code/backend/batch/utilities/document_chunking/fixed_size_overlap.py +++ b/code/backend/batch/utilities/document_chunking/fixed_size_overlap.py @@ -2,7 +2,7 @@ from .document_chunking_base import DocumentChunkingBase from langchain.text_splitter import TokenTextSplitter from .chunking_strategy import ChunkingSettings -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class FixedSizeOverlapDocumentChunking(DocumentChunkingBase): diff --git a/code/backend/batch/utilities/document_chunking/layout.py b/code/backend/batch/utilities/document_chunking/layout.py index 1c07df86a..dd90f84d5 100644 --- a/code/backend/batch/utilities/document_chunking/layout.py +++ b/code/backend/batch/utilities/document_chunking/layout.py @@ -2,7 +2,7 @@ from .document_chunking_base import DocumentChunkingBase from langchain.text_splitter import MarkdownTextSplitter from .chunking_strategy import ChunkingSettings -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class LayoutDocumentChunking(DocumentChunkingBase): diff --git a/code/backend/batch/utilities/document_chunking/page.py b/code/backend/batch/utilities/document_chunking/page.py index ab52ae90a..012cffcea 100644 --- a/code/backend/batch/utilities/document_chunking/page.py +++ b/code/backend/batch/utilities/document_chunking/page.py @@ -2,7 +2,7 @@ from .document_chunking_base import DocumentChunkingBase from langchain.text_splitter import MarkdownTextSplitter from .chunking_strategy import ChunkingSettings -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class PageDocumentChunking(DocumentChunkingBase): diff --git a/code/backend/batch/utilities/document_chunking/paragraph.py b/code/backend/batch/utilities/document_chunking/paragraph.py index 2499cda8b..e62f2d146 100644 --- a/code/backend/batch/utilities/document_chunking/paragraph.py +++ b/code/backend/batch/utilities/document_chunking/paragraph.py @@ -1,7 +1,7 @@ from typing import List from .document_chunking_base import DocumentChunkingBase from .chunking_strategy import ChunkingSettings -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class ParagraphDocumentChunking(DocumentChunkingBase): diff --git a/code/backend/batch/utilities/document_loading/document_loading_base.py b/code/backend/batch/utilities/document_loading/document_loading_base.py index 1309a0383..6a9090be3 100644 --- a/code/backend/batch/utilities/document_loading/document_loading_base.py +++ b/code/backend/batch/utilities/document_loading/document_loading_base.py @@ -1,7 +1,7 @@ # Create an abstract class for document loading from typing import List from abc import ABC, abstractmethod -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class DocumentLoadingBase(ABC): diff --git a/code/backend/batch/utilities/document_loading/layout.py b/code/backend/batch/utilities/document_loading/layout.py index 752cb7ff4..c89f1e5ba 100644 --- a/code/backend/batch/utilities/document_loading/layout.py +++ b/code/backend/batch/utilities/document_loading/layout.py @@ -1,7 +1,7 @@ from typing import List from .document_loading_base import DocumentLoadingBase from ..helpers.azure_form_recognizer_helper import AzureFormRecognizerClient -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class LayoutDocumentLoading(DocumentLoadingBase): diff --git a/code/backend/batch/utilities/document_loading/read.py b/code/backend/batch/utilities/document_loading/read.py index 6a88d53f8..470c6afde 100644 --- a/code/backend/batch/utilities/document_loading/read.py +++ b/code/backend/batch/utilities/document_loading/read.py @@ -1,7 +1,7 @@ from typing import List from .document_loading_base import DocumentLoadingBase from ..helpers.azure_form_recognizer_helper import AzureFormRecognizerClient -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class ReadDocumentLoading(DocumentLoadingBase): diff --git a/code/backend/batch/utilities/document_loading/web.py b/code/backend/batch/utilities/document_loading/web.py index 14f9af44d..f0c8fa631 100644 --- a/code/backend/batch/utilities/document_loading/web.py +++ b/code/backend/batch/utilities/document_loading/web.py @@ -3,7 +3,7 @@ from langchain.docstore.document import Document from langchain_community.document_loaders import WebBaseLoader from .document_loading_base import DocumentLoadingBase -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class WebDocumentLoading(DocumentLoadingBase): diff --git a/code/backend/batch/utilities/document_loading/word_document.py b/code/backend/batch/utilities/document_loading/word_document.py index c55fddd06..6e59293ab 100644 --- a/code/backend/batch/utilities/document_loading/word_document.py +++ b/code/backend/batch/utilities/document_loading/word_document.py @@ -3,7 +3,7 @@ from docx import Document import requests from .document_loading_base import DocumentLoadingBase -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class WordDocumentLoading(DocumentLoadingBase): diff --git a/code/backend/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py b/code/backend/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py index b92cf8375..3723e129a 100644 --- a/code/backend/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py +++ b/code/backend/batch/utilities/helpers/embedders/integrated_vectorization_embedder.py @@ -1,10 +1,10 @@ from .embedder_base import EmbedderBase from ..env_helper import EnvHelper from ..llm_helper import LLMHelper -from ...integrated_vectorization.AzureSearchIndex import AzureSearchIndex -from ...integrated_vectorization.AzureSearchIndexer import AzureSearchIndexer -from ...integrated_vectorization.AzureSearchDatasource import AzureSearchDatasource -from ...integrated_vectorization.AzureSearchSkillset import AzureSearchSkillset +from ...integrated_vectorization.azure_search_index import AzureSearchIndex +from ...integrated_vectorization.azure_search_indexer import AzureSearchIndexer +from ...integrated_vectorization.azure_search_datasource import AzureSearchDatasource +from ...integrated_vectorization.azure_search_skillset import AzureSearchSkillset from ..config.config_helper import ConfigHelper import logging diff --git a/code/backend/batch/utilities/helpers/embedders/push_embedder.py b/code/backend/batch/utilities/helpers/embedders/push_embedder.py index 342a5633b..9f793e150 100644 --- a/code/backend/batch/utilities/helpers/embedders/push_embedder.py +++ b/code/backend/batch/utilities/helpers/embedders/push_embedder.py @@ -13,7 +13,7 @@ from ..azure_search_helper import AzureSearchHelper from ..document_loading_helper import DocumentLoading from ..document_chunking_helper import DocumentChunking -from ...common.SourceDocument import SourceDocument +from ...common.source_document import SourceDocument logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/integrated_vectorization/AzureSearchDatasource.py b/code/backend/batch/utilities/integrated_vectorization/azure_search_datasource.py similarity index 100% rename from code/backend/batch/utilities/integrated_vectorization/AzureSearchDatasource.py rename to code/backend/batch/utilities/integrated_vectorization/azure_search_datasource.py diff --git a/code/backend/batch/utilities/integrated_vectorization/AzureSearchIndex.py b/code/backend/batch/utilities/integrated_vectorization/azure_search_index.py similarity index 100% rename from code/backend/batch/utilities/integrated_vectorization/AzureSearchIndex.py rename to code/backend/batch/utilities/integrated_vectorization/azure_search_index.py diff --git a/code/backend/batch/utilities/integrated_vectorization/AzureSearchIndexer.py b/code/backend/batch/utilities/integrated_vectorization/azure_search_indexer.py similarity index 100% rename from code/backend/batch/utilities/integrated_vectorization/AzureSearchIndexer.py rename to code/backend/batch/utilities/integrated_vectorization/azure_search_indexer.py diff --git a/code/backend/batch/utilities/integrated_vectorization/AzureSearchSkillset.py b/code/backend/batch/utilities/integrated_vectorization/azure_search_skillset.py similarity index 100% rename from code/backend/batch/utilities/integrated_vectorization/AzureSearchSkillset.py rename to code/backend/batch/utilities/integrated_vectorization/azure_search_skillset.py diff --git a/code/backend/batch/utilities/loggers/ConversationLogger.py b/code/backend/batch/utilities/loggers/conversation_logger.py similarity index 100% rename from code/backend/batch/utilities/loggers/ConversationLogger.py rename to code/backend/batch/utilities/loggers/conversation_logger.py diff --git a/code/backend/batch/utilities/orchestrator/lang_chain_agent.py b/code/backend/batch/utilities/orchestrator/lang_chain_agent.py index 66a469fcb..18774231e 100644 --- a/code/backend/batch/utilities/orchestrator/lang_chain_agent.py +++ b/code/backend/batch/utilities/orchestrator/lang_chain_agent.py @@ -8,10 +8,10 @@ from .orchestrator_base import OrchestratorBase from ..helpers.llm_helper import LLMHelper -from ..tools.PostPromptTool import PostPromptTool -from ..tools.QuestionAnswerTool import QuestionAnswerTool -from ..tools.TextProcessingTool import TextProcessingTool -from ..common.Answer import Answer +from ..tools.post_prompt_tool import PostPromptTool +from ..tools.question_answer_tool import QuestionAnswerTool +from ..tools.text_processing_tool import TextProcessingTool +from ..common.answer import Answer logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/orchestrator/open_ai_functions.py b/code/backend/batch/utilities/orchestrator/open_ai_functions.py index d46ecae31..fcd611184 100644 --- a/code/backend/batch/utilities/orchestrator/open_ai_functions.py +++ b/code/backend/batch/utilities/orchestrator/open_ai_functions.py @@ -4,10 +4,10 @@ from .orchestrator_base import OrchestratorBase from ..helpers.llm_helper import LLMHelper -from ..tools.PostPromptTool import PostPromptTool -from ..tools.QuestionAnswerTool import QuestionAnswerTool -from ..tools.TextProcessingTool import TextProcessingTool -from ..common.Answer import Answer +from ..tools.post_prompt_tool import PostPromptTool +from ..tools.question_answer_tool import QuestionAnswerTool +from ..tools.text_processing_tool import TextProcessingTool +from ..common.answer import Answer logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/orchestrator/orchestrator_base.py b/code/backend/batch/utilities/orchestrator/orchestrator_base.py index c514d2863..1073b9ec0 100644 --- a/code/backend/batch/utilities/orchestrator/orchestrator_base.py +++ b/code/backend/batch/utilities/orchestrator/orchestrator_base.py @@ -2,10 +2,10 @@ from uuid import uuid4 from typing import List, Optional from abc import ABC, abstractmethod -from ..loggers.ConversationLogger import ConversationLogger +from ..loggers.conversation_logger import ConversationLogger from ..helpers.config.config_helper import ConfigHelper from ..parser.output_parser_tool import OutputParserTool -from ..tools.ContentSafetyChecker import ContentSafetyChecker +from ..tools.content_safety_checker import ContentSafetyChecker logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/orchestrator/semantic_kernel.py b/code/backend/batch/utilities/orchestrator/semantic_kernel.py index 35b9fd27d..27b1b9fc5 100644 --- a/code/backend/batch/utilities/orchestrator/semantic_kernel.py +++ b/code/backend/batch/utilities/orchestrator/semantic_kernel.py @@ -7,7 +7,7 @@ from semantic_kernel.contents.chat_message_content import ChatMessageContent from semantic_kernel.contents.finish_reason import FinishReason -from ..common.Answer import Answer +from ..common.answer import Answer from ..helpers.llm_helper import LLMHelper from ..plugins.chat_plugin import ChatPlugin from ..plugins.post_answering_plugin import PostAnsweringPlugin diff --git a/code/backend/batch/utilities/parser/output_parser_tool.py b/code/backend/batch/utilities/parser/output_parser_tool.py index c26aaf82d..4455ac20b 100644 --- a/code/backend/batch/utilities/parser/output_parser_tool.py +++ b/code/backend/batch/utilities/parser/output_parser_tool.py @@ -3,7 +3,7 @@ import re import json from .parser_base import ParserBase -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/parser/parser_base.py b/code/backend/batch/utilities/parser/parser_base.py index 1fb987d87..f9b703b3f 100644 --- a/code/backend/batch/utilities/parser/parser_base.py +++ b/code/backend/batch/utilities/parser/parser_base.py @@ -1,7 +1,7 @@ # Create an abstract class for parser from abc import ABC, abstractmethod from typing import List -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class ParserBase(ABC): diff --git a/code/backend/batch/utilities/plugins/chat_plugin.py b/code/backend/batch/utilities/plugins/chat_plugin.py index 2d672537a..a5bc5c2ef 100644 --- a/code/backend/batch/utilities/plugins/chat_plugin.py +++ b/code/backend/batch/utilities/plugins/chat_plugin.py @@ -2,9 +2,9 @@ from semantic_kernel.functions import kernel_function -from ..common.Answer import Answer -from ..tools.QuestionAnswerTool import QuestionAnswerTool -from ..tools.TextProcessingTool import TextProcessingTool +from ..common.answer import Answer +from ..tools.question_answer_tool import QuestionAnswerTool +from ..tools.text_processing_tool import TextProcessingTool class ChatPlugin: diff --git a/code/backend/batch/utilities/plugins/post_answering_plugin.py b/code/backend/batch/utilities/plugins/post_answering_plugin.py index 1c5d87378..da613955f 100644 --- a/code/backend/batch/utilities/plugins/post_answering_plugin.py +++ b/code/backend/batch/utilities/plugins/post_answering_plugin.py @@ -1,8 +1,8 @@ from semantic_kernel.functions import kernel_function from semantic_kernel.functions.kernel_arguments import KernelArguments -from ..common.Answer import Answer -from ..tools.PostPromptTool import PostPromptTool +from ..common.answer import Answer +from ..tools.post_prompt_tool import PostPromptTool class PostAnsweringPlugin: diff --git a/code/backend/batch/utilities/search/AzureSearchHandler.py b/code/backend/batch/utilities/search/azure_search_handler.py similarity index 97% rename from code/backend/batch/utilities/search/AzureSearchHandler.py rename to code/backend/batch/utilities/search/azure_search_handler.py index 33052ebb8..65c330c60 100644 --- a/code/backend/batch/utilities/search/AzureSearchHandler.py +++ b/code/backend/batch/utilities/search/azure_search_handler.py @@ -1,8 +1,8 @@ from typing import List -from .SearchHandlerBase import SearchHandlerBase +from .search_handler_base import SearchHandlerBase from ..helpers.llm_helper import LLMHelper from ..helpers.azure_search_helper import AzureSearchHelper -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument import json from azure.search.documents.models import VectorizedQuery import tiktoken diff --git a/code/backend/batch/utilities/search/IntegratedVectorizationSearchHandler.py b/code/backend/batch/utilities/search/integrated_vectorization_search_handler.py similarity index 97% rename from code/backend/batch/utilities/search/IntegratedVectorizationSearchHandler.py rename to code/backend/batch/utilities/search/integrated_vectorization_search_handler.py index b3b501425..a85b6e44c 100644 --- a/code/backend/batch/utilities/search/IntegratedVectorizationSearchHandler.py +++ b/code/backend/batch/utilities/search/integrated_vectorization_search_handler.py @@ -1,11 +1,11 @@ from typing import List -from .SearchHandlerBase import SearchHandlerBase +from .search_handler_base import SearchHandlerBase from azure.search.documents import SearchClient from azure.search.documents.indexes import SearchIndexClient from azure.search.documents.models import VectorizableTextQuery from azure.core.credentials import AzureKeyCredential from azure.identity import DefaultAzureCredential -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument import re diff --git a/code/backend/batch/utilities/search/Search.py b/code/backend/batch/utilities/search/search.py similarity index 74% rename from code/backend/batch/utilities/search/Search.py rename to code/backend/batch/utilities/search/search.py index 6d16f3935..1c0a37789 100644 --- a/code/backend/batch/utilities/search/Search.py +++ b/code/backend/batch/utilities/search/search.py @@ -1,8 +1,8 @@ -from ..search.AzureSearchHandler import AzureSearchHandler -from ..search.IntegratedVectorizationSearchHandler import ( +from ..search.azure_search_handler import AzureSearchHandler +from ..search.integrated_vectorization_search_handler import ( IntegratedVectorizationSearchHandler, ) -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument from ..helpers.env_helper import EnvHelper diff --git a/code/backend/batch/utilities/search/SearchHandlerBase.py b/code/backend/batch/utilities/search/search_handler_base.py similarity index 95% rename from code/backend/batch/utilities/search/SearchHandlerBase.py rename to code/backend/batch/utilities/search/search_handler_base.py index b1dba8e96..4a937d7b9 100644 --- a/code/backend/batch/utilities/search/SearchHandlerBase.py +++ b/code/backend/batch/utilities/search/search_handler_base.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from ..helpers.env_helper import EnvHelper -from ..common.SourceDocument import SourceDocument +from ..common.source_document import SourceDocument class SearchHandlerBase(ABC): diff --git a/code/backend/batch/utilities/tools/AnswerProcessingBase.py b/code/backend/batch/utilities/tools/answer_processing_base.py similarity index 88% rename from code/backend/batch/utilities/tools/AnswerProcessingBase.py rename to code/backend/batch/utilities/tools/answer_processing_base.py index 040c00c4e..4b1b8a1d1 100644 --- a/code/backend/batch/utilities/tools/AnswerProcessingBase.py +++ b/code/backend/batch/utilities/tools/answer_processing_base.py @@ -1,6 +1,6 @@ # Create an abstract class for tool from abc import ABC, abstractmethod -from ..common.Answer import Answer +from ..common.answer import Answer class AnswerProcessingBase(ABC): diff --git a/code/backend/batch/utilities/tools/AnsweringToolBase.py b/code/backend/batch/utilities/tools/answering_tool_base.py similarity index 89% rename from code/backend/batch/utilities/tools/AnsweringToolBase.py rename to code/backend/batch/utilities/tools/answering_tool_base.py index a4f1fb2ac..235ef2bfd 100644 --- a/code/backend/batch/utilities/tools/AnsweringToolBase.py +++ b/code/backend/batch/utilities/tools/answering_tool_base.py @@ -1,7 +1,7 @@ # Create an abstract class for tool from abc import ABC, abstractmethod from typing import List -from ..common.Answer import Answer +from ..common.answer import Answer class AnsweringToolBase(ABC): diff --git a/code/backend/batch/utilities/tools/ContentSafetyChecker.py b/code/backend/batch/utilities/tools/content_safety_checker.py similarity index 97% rename from code/backend/batch/utilities/tools/ContentSafetyChecker.py rename to code/backend/batch/utilities/tools/content_safety_checker.py index 681531975..d04c77f23 100644 --- a/code/backend/batch/utilities/tools/ContentSafetyChecker.py +++ b/code/backend/batch/utilities/tools/content_safety_checker.py @@ -5,8 +5,8 @@ from azure.core.exceptions import HttpResponseError from azure.ai.contentsafety.models import AnalyzeTextOptions from ..helpers.env_helper import EnvHelper -from .AnswerProcessingBase import AnswerProcessingBase -from ..common.Answer import Answer +from .answer_processing_base import AnswerProcessingBase +from ..common.answer import Answer logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/tools/PostPromptTool.py b/code/backend/batch/utilities/tools/post_prompt_tool.py similarity index 98% rename from code/backend/batch/utilities/tools/PostPromptTool.py rename to code/backend/batch/utilities/tools/post_prompt_tool.py index ef13985d0..728cdeb52 100644 --- a/code/backend/batch/utilities/tools/PostPromptTool.py +++ b/code/backend/batch/utilities/tools/post_prompt_tool.py @@ -1,7 +1,7 @@ from langchain.chains.llm import LLMChain from langchain.prompts import PromptTemplate from langchain_community.callbacks import get_openai_callback -from ..common.Answer import Answer +from ..common.answer import Answer from ..helpers.llm_helper import LLMHelper from ..helpers.config.config_helper import ConfigHelper diff --git a/code/backend/batch/utilities/tools/QuestionAnswerTool.py b/code/backend/batch/utilities/tools/question_answer_tool.py similarity index 96% rename from code/backend/batch/utilities/tools/QuestionAnswerTool.py rename to code/backend/batch/utilities/tools/question_answer_tool.py index 37fef75c4..710f55c9d 100644 --- a/code/backend/batch/utilities/tools/QuestionAnswerTool.py +++ b/code/backend/batch/utilities/tools/question_answer_tool.py @@ -2,9 +2,9 @@ import logging import warnings -from ..common.SourceDocument import SourceDocument -from ..search.Search import Search -from .AnsweringToolBase import AnsweringToolBase +from ..common.source_document import SourceDocument +from ..search.search import Search +from .answering_tool_base import AnsweringToolBase from langchain.chains.llm import LLMChain from langchain.prompts import ( @@ -21,7 +21,7 @@ from ..helpers.config.config_helper import ConfigHelper from ..helpers.llm_helper import LLMHelper from ..helpers.env_helper import EnvHelper -from ..common.Answer import Answer +from ..common.answer import Answer logger = logging.getLogger(__name__) diff --git a/code/backend/batch/utilities/tools/TextProcessingTool.py b/code/backend/batch/utilities/tools/text_processing_tool.py similarity index 92% rename from code/backend/batch/utilities/tools/TextProcessingTool.py rename to code/backend/batch/utilities/tools/text_processing_tool.py index 1a0c0e33e..715418aae 100644 --- a/code/backend/batch/utilities/tools/TextProcessingTool.py +++ b/code/backend/batch/utilities/tools/text_processing_tool.py @@ -1,7 +1,7 @@ from typing import List from ..helpers.llm_helper import LLMHelper -from .AnsweringToolBase import AnsweringToolBase -from ..common.Answer import Answer +from .answering_tool_base import AnsweringToolBase +from ..common.answer import Answer class TextProcessingTool(AnsweringToolBase): diff --git a/code/backend/pages/01_Ingest_Data.py b/code/backend/pages/01_ingest_data.py similarity index 100% rename from code/backend/pages/01_Ingest_Data.py rename to code/backend/pages/01_ingest_data.py diff --git a/code/backend/pages/02_Explore_Data.py b/code/backend/pages/02_explore_data.py similarity index 100% rename from code/backend/pages/02_Explore_Data.py rename to code/backend/pages/02_explore_data.py diff --git a/code/backend/pages/03_Delete_Data.py b/code/backend/pages/03_delete_data.py similarity index 100% rename from code/backend/pages/03_Delete_Data.py rename to code/backend/pages/03_delete_data.py diff --git a/code/backend/pages/04_Configuration.py b/code/backend/pages/04_donfiguration.py similarity index 100% rename from code/backend/pages/04_Configuration.py rename to code/backend/pages/04_donfiguration.py diff --git a/code/tests/common/test_source_document.py b/code/tests/common/test_source_document.py index f175e1953..f6a23597a 100644 --- a/code/tests/common/test_source_document.py +++ b/code/tests/common/test_source_document.py @@ -1,7 +1,7 @@ import hashlib from unittest.mock import patch from urllib.parse import urlparse -from backend.batch.utilities.common.SourceDocument import ( +from backend.batch.utilities.common.source_document import ( SourceDocument, SourceDocumentDecoder, SourceDocumentEncoder, diff --git a/code/tests/functional/tests/functions/test_advanced_image_processing.py b/code/tests/functional/tests/functions/test_advanced_image_processing.py index 3f5942dc9..42550f2a4 100644 --- a/code/tests/functional/tests/functions/test_advanced_image_processing.py +++ b/code/tests/functional/tests/functions/test_advanced_image_processing.py @@ -17,7 +17,7 @@ os.path.join(os.path.dirname(sys.path[0]), "..", "..", "backend", "batch") ) -from backend.batch.BatchPushResults import batch_push_results # noqa: E402 +from backend.batch.batch_push_results import batch_push_results # noqa: E402 pytestmark = pytest.mark.functional diff --git a/code/tests/search_utilities/test_AzureSearchHandler.py b/code/tests/search_utilities/test_AzureSearchHandler.py index 454c212c7..5e175b590 100644 --- a/code/tests/search_utilities/test_AzureSearchHandler.py +++ b/code/tests/search_utilities/test_AzureSearchHandler.py @@ -1,10 +1,10 @@ import pytest from unittest.mock import MagicMock, Mock, patch -from backend.batch.utilities.search.AzureSearchHandler import AzureSearchHandler +from backend.batch.utilities.search.azure_search_handler import AzureSearchHandler import json from azure.search.documents.models import VectorizedQuery -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument @pytest.fixture diff --git a/code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py b/code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py index 3959f3a5b..cf4f9c378 100644 --- a/code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py +++ b/code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py @@ -1,11 +1,11 @@ import pytest from unittest.mock import Mock, patch -from backend.batch.utilities.search.IntegratedVectorizationSearchHandler import ( +from backend.batch.utilities.search.integrated_vectorization_search_handler import ( IntegratedVectorizationSearchHandler, ) from azure.search.documents.models import VectorizableTextQuery -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument @pytest.fixture diff --git a/code/tests/search_utilities/test_Search.py b/code/tests/search_utilities/test_Search.py index 4af9d88d2..c284a7a2b 100644 --- a/code/tests/search_utilities/test_Search.py +++ b/code/tests/search_utilities/test_Search.py @@ -1,10 +1,10 @@ import pytest from unittest.mock import Mock, MagicMock, patch -from backend.batch.utilities.search.Search import Search -from backend.batch.utilities.search.IntegratedVectorizationSearchHandler import ( +from backend.batch.utilities.search.search import Search +from backend.batch.utilities.search.integrated_vectorization_search_handler import ( IntegratedVectorizationSearchHandler, ) -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument @pytest.fixture diff --git a/code/tests/test_AddURLEmbeddings.py b/code/tests/test_AddURLEmbeddings.py index 614c28604..9b6e4c670 100644 --- a/code/tests/test_AddURLEmbeddings.py +++ b/code/tests/test_AddURLEmbeddings.py @@ -6,7 +6,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "backend", "batch")) -from backend.batch.AddURLEmbeddings import add_url_embeddings # noqa: E402 +from backend.batch.add_url_embeddings import add_url_embeddings # noqa: E402 @patch("backend.batch.AddURLEmbeddings.EmbedderFactory") diff --git a/code/tests/test_BatchPushResults.py b/code/tests/test_BatchPushResults.py index 0bd566f0a..dddfa70cd 100644 --- a/code/tests/test_BatchPushResults.py +++ b/code/tests/test_BatchPushResults.py @@ -7,7 +7,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "backend", "batch")) -from backend.batch.BatchPushResults import ( # noqa: E402 +from backend.batch.batch_push_results import ( # noqa: E402 batch_push_results, _get_file_name_from_message, ) diff --git a/code/tests/test_BatchStartProcessing.py b/code/tests/test_BatchStartProcessing.py index 9b5fbe75e..5f99782f0 100644 --- a/code/tests/test_BatchStartProcessing.py +++ b/code/tests/test_BatchStartProcessing.py @@ -4,7 +4,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "backend", "batch")) -from backend.batch.BatchStartProcessing import batch_start_processing # noqa: E402 +from backend.batch.batch_start_processing import batch_start_processing # noqa: E402 @patch("backend.batch.BatchStartProcessing.create_queue_client") diff --git a/code/tests/test_ContentSafetyChecker.py b/code/tests/test_ContentSafetyChecker.py index 7aa4de603..68e039459 100644 --- a/code/tests/test_ContentSafetyChecker.py +++ b/code/tests/test_ContentSafetyChecker.py @@ -1,5 +1,5 @@ import pytest -from backend.batch.utilities.tools.ContentSafetyChecker import ContentSafetyChecker +from backend.batch.utilities.tools.content_safety_checker import ContentSafetyChecker @pytest.mark.azure("This test requires Azure Content Safety configured") diff --git a/code/tests/test_GetConversationResponse.py b/code/tests/test_GetConversationResponse.py index a8f21d37e..1a3d4acf6 100644 --- a/code/tests/test_GetConversationResponse.py +++ b/code/tests/test_GetConversationResponse.py @@ -6,7 +6,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "backend", "batch")) -from backend.batch.GetConversationResponse import ( # noqa: E402 +from backend.batch.get_conversation_response import ( # noqa: E402 get_conversation_response, ) diff --git a/code/tests/test_OutputParserTool.py b/code/tests/test_OutputParserTool.py index 323b8d44d..a01e73ef7 100644 --- a/code/tests/test_OutputParserTool.py +++ b/code/tests/test_OutputParserTool.py @@ -3,7 +3,7 @@ from typing import List from backend.batch.utilities.parser.output_parser_tool import OutputParserTool -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument def test_returns_parsed_messages(): diff --git a/code/tests/utilities/helpers/test_document_chunking_helper.py b/code/tests/utilities/helpers/test_document_chunking_helper.py index a44b4af80..fd6a1541c 100644 --- a/code/tests/utilities/helpers/test_document_chunking_helper.py +++ b/code/tests/utilities/helpers/test_document_chunking_helper.py @@ -1,4 +1,4 @@ -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument from backend.batch.utilities.helpers.document_chunking_helper import DocumentChunking from backend.batch.utilities.document_chunking.chunking_strategy import ( ChunkingStrategy, diff --git a/code/tests/utilities/helpers/test_push_embedder.py b/code/tests/utilities/helpers/test_push_embedder.py index 21de29880..015382902 100644 --- a/code/tests/utilities/helpers/test_push_embedder.py +++ b/code/tests/utilities/helpers/test_push_embedder.py @@ -5,7 +5,7 @@ from backend.batch.utilities.document_chunking.chunking_strategy import ChunkingSettings from backend.batch.utilities.document_loading import LoadingSettings from backend.batch.utilities.document_loading.strategies import LoadingStrategy -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument from backend.batch.utilities.helpers.config.embedding_config import EmbeddingConfig CHUNKING_SETTINGS = ChunkingSettings({"strategy": "layout", "size": 1, "overlap": 0}) diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py b/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py index f2cdd168f..cc66538eb 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py @@ -1,6 +1,6 @@ import pytest from unittest.mock import MagicMock, patch -from backend.batch.utilities.integrated_vectorization.AzureSearchDatasource import ( +from backend.batch.utilities.integrated_vectorization.azure_search_datasource import ( AzureSearchDatasource, ) from azure.search.documents.indexes._generated.models import ( diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_index.py b/code/tests/utilities/integrated_vectorization/test_azure_search_index.py index 314564880..edaad4b12 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_index.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_index.py @@ -1,6 +1,6 @@ import pytest from unittest.mock import ANY, MagicMock, patch -from backend.batch.utilities.integrated_vectorization.AzureSearchIndex import ( +from backend.batch.utilities.integrated_vectorization.azure_search_index import ( AzureSearchIndex, ) from azure.search.documents.indexes.models import ( diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py b/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py index 1513d31fe..efaa844c6 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py @@ -1,6 +1,6 @@ import pytest from unittest.mock import ANY, MagicMock, patch -from backend.batch.utilities.integrated_vectorization.AzureSearchIndexer import ( +from backend.batch.utilities.integrated_vectorization.azure_search_indexer import ( AzureSearchIndexer, ) diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py b/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py index 24a4c19df..2bd59f400 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py @@ -1,6 +1,6 @@ import pytest from unittest.mock import MagicMock, patch -from backend.batch.utilities.integrated_vectorization.AzureSearchSkillset import ( +from backend.batch.utilities.integrated_vectorization.azure_search_skillset import ( AzureSearchSkillset, ) from azure.search.documents.indexes.models import ( diff --git a/code/tests/utilities/orchestrator/test_lang_chain_agent.py b/code/tests/utilities/orchestrator/test_lang_chain_agent.py index 8125d572d..0d3843479 100644 --- a/code/tests/utilities/orchestrator/test_lang_chain_agent.py +++ b/code/tests/utilities/orchestrator/test_lang_chain_agent.py @@ -2,7 +2,7 @@ import pytest from backend.batch.utilities.orchestrator.lang_chain_agent import LangChainAgent -from backend.batch.utilities.common.Answer import Answer +from backend.batch.utilities.common.answer import Answer class LangChainAgentNoInit(LangChainAgent): diff --git a/code/tests/utilities/orchestrator/test_semantic_kernel.py b/code/tests/utilities/orchestrator/test_semantic_kernel.py index 256084160..aeb9fd572 100644 --- a/code/tests/utilities/orchestrator/test_semantic_kernel.py +++ b/code/tests/utilities/orchestrator/test_semantic_kernel.py @@ -1,7 +1,7 @@ from unittest.mock import ANY, AsyncMock, MagicMock, call, patch import pytest -from backend.batch.utilities.common.Answer import Answer +from backend.batch.utilities.common.answer import Answer from backend.batch.utilities.orchestrator.semantic_kernel import ( SemanticKernelOrchestrator, ) diff --git a/code/tests/utilities/plugins/test_chat_plugin.py b/code/tests/utilities/plugins/test_chat_plugin.py index 19ebdccfb..333839efd 100644 --- a/code/tests/utilities/plugins/test_chat_plugin.py +++ b/code/tests/utilities/plugins/test_chat_plugin.py @@ -1,7 +1,7 @@ from unittest.mock import patch, MagicMock import pytest -from backend.batch.utilities.common.Answer import Answer +from backend.batch.utilities.common.answer import Answer from backend.batch.utilities.plugins.chat_plugin import ChatPlugin from semantic_kernel import Kernel diff --git a/code/tests/utilities/plugins/test_post_answering_plugin.py b/code/tests/utilities/plugins/test_post_answering_plugin.py index 55fc30fab..4f7ecaa28 100644 --- a/code/tests/utilities/plugins/test_post_answering_plugin.py +++ b/code/tests/utilities/plugins/test_post_answering_plugin.py @@ -1,7 +1,7 @@ from unittest.mock import patch, MagicMock import pytest -from backend.batch.utilities.common.Answer import Answer +from backend.batch.utilities.common.answer import Answer from backend.batch.utilities.plugins.post_answering_plugin import PostAnsweringPlugin from semantic_kernel import Kernel diff --git a/code/tests/utilities/test_question_answer_tool.py b/code/tests/utilities/test_question_answer_tool.py index 2fe8f5680..9d4b8e0c3 100644 --- a/code/tests/utilities/test_question_answer_tool.py +++ b/code/tests/utilities/test_question_answer_tool.py @@ -2,10 +2,10 @@ from unittest.mock import MagicMock, patch import pytest -from backend.batch.utilities.common.Answer import Answer -from backend.batch.utilities.tools.QuestionAnswerTool import QuestionAnswerTool +from backend.batch.utilities.common.answer import Answer +from backend.batch.utilities.tools.question_answer_tool import QuestionAnswerTool from langchain_core.documents import Document -from backend.batch.utilities.common.SourceDocument import SourceDocument +from backend.batch.utilities.common.source_document import SourceDocument @pytest.fixture(autouse=True) From c3957a2f217e05990a2a886b2a6f8a44b004cf47 Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 11:11:12 +0100 Subject: [PATCH 2/7] updates to tests. --- code/tests/common/test_source_document.py | 2 +- .../{test_Search.py => test__search.py} | 0 ...chHandler.py => test_azure_search_handler.py} | 10 +++++----- ...t_integrated_vectorization_search_handler.py} | 0 ...LEmbeddings.py => test_add_url_embeddings.py} | 16 ++++++++-------- ...BlobStorage.py => test_azure_blob_storage.py} | 0 ...PushResults.py => test_batch_push_results.py} | 6 +++--- ...cessing.py => test_batch_start_processing.py} | 4 ++-- ...Checker.py => test_content_safety_checker.py} | 0 ...ntProcessor.py => test_document_processor.py} | 0 ...onse.py => test_get_conversation_response.py} | 8 ++++---- ...tParserTool.py => test_output_parser_tool.py} | 0 12 files changed, 23 insertions(+), 23 deletions(-) rename code/tests/search_utilities/{test_Search.py => test__search.py} (100%) rename code/tests/search_utilities/{test_AzureSearchHandler.py => test_azure_search_handler.py} (94%) rename code/tests/search_utilities/{test_IntegratedVectorizationSearchHandler.py => test_integrated_vectorization_search_handler.py} (100%) rename code/tests/{test_AddURLEmbeddings.py => test_add_url_embeddings.py} (89%) rename code/tests/{test_AzureBlobStorage.py => test_azure_blob_storage.py} (100%) rename code/tests/{test_BatchPushResults.py => test_batch_push_results.py} (88%) rename code/tests/{test_BatchStartProcessing.py => test_batch_start_processing.py} (89%) rename code/tests/{test_ContentSafetyChecker.py => test_content_safety_checker.py} (100%) rename code/tests/{test_DocumentProcessor.py => test_document_processor.py} (100%) rename code/tests/{test_GetConversationResponse.py => test_get_conversation_response.py} (89%) rename code/tests/{test_OutputParserTool.py => test_output_parser_tool.py} (100%) diff --git a/code/tests/common/test_source_document.py b/code/tests/common/test_source_document.py index f6a23597a..8d6f8a63d 100644 --- a/code/tests/common/test_source_document.py +++ b/code/tests/common/test_source_document.py @@ -27,7 +27,7 @@ def test_get_filename(): assert filename == "file" -@patch("backend.batch.utilities.common.SourceDocument.AzureBlobStorageClient") +@patch("backend.batch.utilities.common.source_document.AzureBlobStorageClient") def test_get_markdown_url(azure_blob_service_mock): # Given azure_blob_service_mock().get_container_sas.return_value = "_12345" diff --git a/code/tests/search_utilities/test_Search.py b/code/tests/search_utilities/test__search.py similarity index 100% rename from code/tests/search_utilities/test_Search.py rename to code/tests/search_utilities/test__search.py diff --git a/code/tests/search_utilities/test_AzureSearchHandler.py b/code/tests/search_utilities/test_azure_search_handler.py similarity index 94% rename from code/tests/search_utilities/test_AzureSearchHandler.py rename to code/tests/search_utilities/test_azure_search_handler.py index 5e175b590..d4310e113 100644 --- a/code/tests/search_utilities/test_AzureSearchHandler.py +++ b/code/tests/search_utilities/test_azure_search_handler.py @@ -19,7 +19,7 @@ def env_helper_mock(): @pytest.fixture def mock_search_client(): with patch( - "backend.batch.utilities.search.AzureSearchHandler.AzureSearchHelper" + "backend.batch.utilities.search.azure_search_handler.AzureSearchHelper" ) as mock: search_client = mock.return_value.get_search_client.return_value yield search_client @@ -27,7 +27,7 @@ def mock_search_client(): @pytest.fixture def mock_llm_helper(): - with patch("backend.batch.utilities.search.AzureSearchHandler.LLMHelper") as mock: + with patch("backend.batch.utilities.search.azure_search_handler.LLMHelper") as mock: mock_llm_helper = mock.return_value yield mock_llm_helper @@ -35,11 +35,11 @@ def mock_llm_helper(): @pytest.fixture def handler(env_helper_mock, mock_search_client, mock_llm_helper): with patch( - "backend.batch.utilities.search.AzureSearchHandler.AzureSearchHelper", + "backend.batch.utilities.search.azure_search_handler.AzureSearchHelper", return_value=mock_search_client, ): with patch( - "backend.batch.utilities.search.AzureSearchHandler.LLMHelper", + "backend.batch.utilities.search.azure_search_handler.LLMHelper", return_value=mock_llm_helper, ): return AzureSearchHandler(env_helper_mock) @@ -126,7 +126,7 @@ def test_get_files(handler): ) -@patch("backend.batch.utilities.search.AzureSearchHandler.tiktoken") +@patch("backend.batch.utilities.search.azure_search_handler.tiktoken") def test_query_search_uses_tiktoken_encoder(mock_tiktoken, handler, mock_llm_helper): # given question = "What is the answer?" diff --git a/code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py b/code/tests/search_utilities/test_integrated_vectorization_search_handler.py similarity index 100% rename from code/tests/search_utilities/test_IntegratedVectorizationSearchHandler.py rename to code/tests/search_utilities/test_integrated_vectorization_search_handler.py diff --git a/code/tests/test_AddURLEmbeddings.py b/code/tests/test_add_url_embeddings.py similarity index 89% rename from code/tests/test_AddURLEmbeddings.py rename to code/tests/test_add_url_embeddings.py index 9b6e4c670..2e7abb744 100644 --- a/code/tests/test_AddURLEmbeddings.py +++ b/code/tests/test_add_url_embeddings.py @@ -9,7 +9,7 @@ from backend.batch.add_url_embeddings import add_url_embeddings # noqa: E402 -@patch("backend.batch.AddURLEmbeddings.EmbedderFactory") +@patch("backend.batch.add_url_embeddings.EmbedderFactory") def test_add_url_embeddings(mock_embedder_factory: MagicMock): # given fake_request = func.HttpRequest( @@ -46,7 +46,7 @@ def test_add_url_embeddings_returns_400_when_url_not_set(): assert response.status_code == 400 -@patch("backend.batch.AddURLEmbeddings.EmbedderFactory") +@patch("backend.batch.add_url_embeddings.EmbedderFactory") def test_add_url_embeddings_returns_500_when_exception_occurs( mock_embedder_factory: MagicMock, ): @@ -71,9 +71,9 @@ def test_add_url_embeddings_returns_500_when_exception_occurs( ) -@patch("backend.batch.AddURLEmbeddings.EnvHelper") -@patch("backend.batch.AddURLEmbeddings.AzureBlobStorageClient") -@patch("backend.batch.AddURLEmbeddings.requests") +@patch("backend.batch.add_url_embeddings.EnvHelper") +@patch("backend.batch.add_url_embeddings.AzureBlobStorageClient") +@patch("backend.batch.add_url_embeddings.requests") def test_add_url_embeddings_integrated_vectorization( mock_requests: MagicMock, mock_blob_storage_client: MagicMock, @@ -105,9 +105,9 @@ def test_add_url_embeddings_integrated_vectorization( ) -@patch("backend.batch.AddURLEmbeddings.EnvHelper") -@patch("backend.batch.AddURLEmbeddings.AzureBlobStorageClient") -@patch("backend.batch.AddURLEmbeddings.requests") +@patch("backend.batch.add_url_embeddings.EnvHelper") +@patch("backend.batch.add_url_embeddings.AzureBlobStorageClient") +@patch("backend.batch.add_url_embeddings.requests") def test_add_url_embeddings_integrated_vectorization_returns_500_when_exception_occurs( mock_requests: MagicMock, mock_blob_storage_client: MagicMock, diff --git a/code/tests/test_AzureBlobStorage.py b/code/tests/test_azure_blob_storage.py similarity index 100% rename from code/tests/test_AzureBlobStorage.py rename to code/tests/test_azure_blob_storage.py diff --git a/code/tests/test_BatchPushResults.py b/code/tests/test_batch_push_results.py similarity index 88% rename from code/tests/test_BatchPushResults.py rename to code/tests/test_batch_push_results.py index dddfa70cd..b7c39c267 100644 --- a/code/tests/test_BatchPushResults.py +++ b/code/tests/test_batch_push_results.py @@ -15,7 +15,7 @@ @pytest.fixture(autouse=True) def get_processor_handler_mock(): - with patch("backend.batch.BatchPushResults.EmbedderFactory.create") as mock: + with patch("backend.batch.batch_push_results.EmbedderFactory.create") as mock: processor_handler = mock.return_value yield processor_handler @@ -40,8 +40,8 @@ def test_get_file_name_from_message_no_filename(): assert file_name == "test_filename.md" -@patch("backend.batch.BatchPushResults.EnvHelper") -@patch("backend.batch.BatchPushResults.AzureBlobStorageClient") +@patch("backend.batch.batch_push_results.EnvHelper") +@patch("backend.batch.batch_push_results.AzureBlobStorageClient") def test_batch_push_results( mock_azure_blob_storage_client, mock_env_helper, get_processor_handler_mock ): diff --git a/code/tests/test_BatchStartProcessing.py b/code/tests/test_batch_start_processing.py similarity index 89% rename from code/tests/test_BatchStartProcessing.py rename to code/tests/test_batch_start_processing.py index 5f99782f0..2bdbc952e 100644 --- a/code/tests/test_BatchStartProcessing.py +++ b/code/tests/test_batch_start_processing.py @@ -7,8 +7,8 @@ from backend.batch.batch_start_processing import batch_start_processing # noqa: E402 -@patch("backend.batch.BatchStartProcessing.create_queue_client") -@patch("backend.batch.BatchStartProcessing.AzureBlobStorageClient") +@patch("backend.batch.batch_start_processing.create_queue_client") +@patch("backend.batch.batch_start_processing.AzureBlobStorageClient") def test_batch_start_processing_processes_all( mock_blob_storage_client, mock_create_queue_client ): diff --git a/code/tests/test_ContentSafetyChecker.py b/code/tests/test_content_safety_checker.py similarity index 100% rename from code/tests/test_ContentSafetyChecker.py rename to code/tests/test_content_safety_checker.py diff --git a/code/tests/test_DocumentProcessor.py b/code/tests/test_document_processor.py similarity index 100% rename from code/tests/test_DocumentProcessor.py rename to code/tests/test_document_processor.py diff --git a/code/tests/test_GetConversationResponse.py b/code/tests/test_get_conversation_response.py similarity index 89% rename from code/tests/test_GetConversationResponse.py rename to code/tests/test_get_conversation_response.py index 1a3d4acf6..63c76e8be 100644 --- a/code/tests/test_GetConversationResponse.py +++ b/code/tests/test_get_conversation_response.py @@ -11,8 +11,8 @@ ) -@patch("backend.batch.GetConversationResponse.ConfigHelper") -@patch("backend.batch.GetConversationResponse.Orchestrator") +@patch("backend.batch.get_conversation_response.ConfigHelper") +@patch("backend.batch.get_conversation_response.Orchestrator") @pytest.mark.asyncio async def test_get_conversation_response(mock_create_message_orchestrator, _): mock_http_request = Mock() @@ -53,8 +53,8 @@ async def test_get_conversation_response(mock_create_message_orchestrator, _): ] -@patch("backend.batch.GetConversationResponse.ConfigHelper") -@patch("backend.batch.GetConversationResponse.Orchestrator") +@patch("backend.batch.get_conversation_response.ConfigHelper") +@patch("backend.batch.get_conversation_response.Orchestrator") @pytest.mark.asyncio async def test_get_conversation_error(_, __): mock_http_request = Mock() diff --git a/code/tests/test_OutputParserTool.py b/code/tests/test_output_parser_tool.py similarity index 100% rename from code/tests/test_OutputParserTool.py rename to code/tests/test_output_parser_tool.py From b2555df598f460418771918ffeaf41b910024bad Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 11:22:51 +0100 Subject: [PATCH 3/7] fix more tests --- code/tests/search_utilities/test__search.py | 2 +- ...st_integrated_vectorization_search_handler.py | 6 +++--- .../test_azure_search_datasource.py | 8 ++++---- .../test_azure_search_index.py | 6 +++--- .../test_azure_search_indexer.py | 6 +++--- .../test_azure_search_skillset.py | 4 ++-- .../tests/utilities/test_question_answer_tool.py | 16 ++++++++-------- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/code/tests/search_utilities/test__search.py b/code/tests/search_utilities/test__search.py index c284a7a2b..bbfb8c5b4 100644 --- a/code/tests/search_utilities/test__search.py +++ b/code/tests/search_utilities/test__search.py @@ -21,7 +21,7 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def iv_search_handler_mock(): with patch( - "backend.batch.utilities.search.IntegratedVectorizationSearchHandler" + "backend.batch.utilities.search.integrated_vectorization_search_handler" ) as mock: yield mock diff --git a/code/tests/search_utilities/test_integrated_vectorization_search_handler.py b/code/tests/search_utilities/test_integrated_vectorization_search_handler.py index cf4f9c378..c85e67107 100644 --- a/code/tests/search_utilities/test_integrated_vectorization_search_handler.py +++ b/code/tests/search_utilities/test_integrated_vectorization_search_handler.py @@ -38,7 +38,7 @@ def search_index_does_not_exists_mock(): @pytest.fixture def search_client_mock(): with patch( - "backend.batch.utilities.search.IntegratedVectorizationSearchHandler.SearchClient" + "backend.batch.utilities.search.integrated_vectorization_search_handler.SearchClient" ) as mock: yield mock @@ -46,7 +46,7 @@ def search_client_mock(): @pytest.fixture def handler(env_helper_mock, search_client_mock, search_index_mock): with patch( - "backend.batch.utilities.search.IntegratedVectorizationSearchHandler.SearchClient", + "backend.batch.utilities.search.integrated_vectorization_search_handler.SearchClient", return_value=search_client_mock, ): return IntegratedVectorizationSearchHandler(env_helper_mock) @@ -57,7 +57,7 @@ def handler_index_does_not_exists( env_helper_mock, search_client_mock, search_index_does_not_exists_mock ): with patch( - "backend.batch.utilities.search.IntegratedVectorizationSearchHandler.SearchClient", + "backend.batch.utilities.search.integrated_vectorization_search_handler.SearchClient", return_value=search_client_mock, ): return IntegratedVectorizationSearchHandler(env_helper_mock) diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py b/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py index cc66538eb..2fb2cece3 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_datasource.py @@ -23,7 +23,7 @@ @pytest.fixture(autouse=True) def env_helper_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchDatasource.EnvHelper" + "backend.batch.utilities.integrated_vectorization.azure_search_datasource.EnvHelper" ) as mock: env_helper = mock.return_value env_helper.AZURE_AUTH_TYPE = AZURE_AUTH_TYPE @@ -40,7 +40,7 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def search_indexer_client_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchDatasource.SearchIndexerClient" + "backend.batch.utilities.integrated_vectorization.azure_search_datasource.SearchIndexerClient" ) as mock: yield mock @@ -48,7 +48,7 @@ def search_indexer_client_mock(): @pytest.fixture(autouse=True) def search_indexer_data_container_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchDatasource.SearchIndexerDataContainer" + "backend.batch.utilities.integrated_vectorization.azure_search_datasource.SearchIndexerDataContainer" ) as mock: yield mock @@ -56,7 +56,7 @@ def search_indexer_data_container_mock(): @pytest.fixture(autouse=True) def search_indexer_datasource_connection_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchDatasource.SearchIndexerDataSourceConnection" + "backend.batch.utilities.integrated_vectorization.azure_search_datasource.SearchIndexerDataSourceConnection" ) as mock: yield mock diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_index.py b/code/tests/utilities/integrated_vectorization/test_azure_search_index.py index edaad4b12..fbcc8a833 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_index.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_index.py @@ -18,7 +18,7 @@ @pytest.fixture(autouse=True) def env_helper_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndex.EnvHelper" + "backend.batch.utilities.integrated_vectorization.azure_search_index.EnvHelper" ) as mock: env_helper = mock.return_value env_helper.AZURE_AUTH_TYPE = AZURE_AUTH_TYPE @@ -32,7 +32,7 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def llm_helper_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndex.LLMHelper" + "backend.batch.utilities.integrated_vectorization.azure_search_index.LLMHelper" ) as mock: llm_helper = mock.return_value llm_helper.get_embedding_model.return_value.embed_query.return_value = [ @@ -45,7 +45,7 @@ def llm_helper_mock(): @pytest.fixture(autouse=True) def search_index_client_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndex.SearchIndexClient" + "backend.batch.utilities.integrated_vectorization.azure_search_index.SearchIndexClient" ) as mock: indexer_client = mock.return_value indexer_client.create_or_update_index.return_value = SearchIndex( diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py b/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py index efaa844c6..a128e682d 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_indexer.py @@ -13,7 +13,7 @@ @pytest.fixture(autouse=True) def env_helper_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndexer.EnvHelper" + "backend.batch.utilities.integrated_vectorization.azure_search_indexer.EnvHelper" ) as mock: env_helper = mock.return_value env_helper.AZURE_AUTH_TYPE = AZURE_AUTH_TYPE @@ -27,7 +27,7 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def search_indexer_client_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndexer.SearchIndexerClient" + "backend.batch.utilities.integrated_vectorization.azure_search_indexer.SearchIndexerClient" ) as mock: yield mock @@ -35,7 +35,7 @@ def search_indexer_client_mock(): @pytest.fixture(autouse=True) def search_indexer_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchIndexer.SearchIndexer" + "backend.batch.utilities.integrated_vectorization.azure_search_indexer.SearchIndexer" ) as mock: yield mock diff --git a/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py b/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py index 2bd59f400..19150b948 100644 --- a/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py +++ b/code/tests/utilities/integrated_vectorization/test_azure_search_skillset.py @@ -21,7 +21,7 @@ @pytest.fixture(autouse=True) def env_helper_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchSkillset.EnvHelper" + "backend.batch.utilities.integrated_vectorization.azure_search_skillset.EnvHelper" ) as mock: env_helper = mock.return_value env_helper.AZURE_AUTH_TYPE = AZURE_AUTH_TYPE @@ -37,7 +37,7 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def search_indexer_client_mock(): with patch( - "backend.batch.utilities.integrated_vectorization.AzureSearchSkillset.SearchIndexerClient" + "backend.batch.utilities.integrated_vectorization.azure_search_skillset.SearchIndexerClient" ) as mock: indexer_client = mock.return_value indexer_client.create_or_update_skillset.return_value = SearchIndexerSkillset( diff --git a/code/tests/utilities/test_question_answer_tool.py b/code/tests/utilities/test_question_answer_tool.py index 9d4b8e0c3..86e16d7f2 100644 --- a/code/tests/utilities/test_question_answer_tool.py +++ b/code/tests/utilities/test_question_answer_tool.py @@ -10,7 +10,7 @@ @pytest.fixture(autouse=True) def config_mock(): - with patch("backend.batch.utilities.tools.QuestionAnswerTool.ConfigHelper") as mock: + with patch("backend.batch.utilities.tools.question_answer_tool.ConfigHelper") as mock: config = mock.get_active_config_or_default.return_value config.prompts.answering_system_prompt = "mock answering system prompt" config.prompts.answering_user_prompt = ( @@ -31,7 +31,7 @@ def config_mock(): @pytest.fixture(autouse=True) def env_helper_mock(): - with patch("backend.batch.utilities.tools.QuestionAnswerTool.EnvHelper") as mock: + with patch("backend.batch.utilities.tools.question_answer_tool.EnvHelper") as mock: env_helper = mock.return_value env_helper.AZURE_OPENAI_SYSTEM_MESSAGE = "mock azure openai system message" env_helper.AZURE_SEARCH_TOP_K = 1 @@ -43,13 +43,13 @@ def env_helper_mock(): @pytest.fixture(autouse=True) def LLMHelperMock(): - with patch("backend.batch.utilities.tools.QuestionAnswerTool.LLMHelper") as mock: + with patch("backend.batch.utilities.tools.question_answer_tool.LLMHelper") as mock: yield mock @pytest.fixture(autouse=True) def LLMChainMock(): - with patch("backend.batch.utilities.tools.QuestionAnswerTool.LLMChain") as mock: + with patch("backend.batch.utilities.tools.question_answer_tool.LLMChain") as mock: mock.return_value.return_value = {"text": "mock content"} yield mock @@ -58,7 +58,7 @@ def LLMChainMock(): @pytest.fixture(autouse=True) def get_openai_callback_mock(): with patch( - "backend.batch.utilities.tools.QuestionAnswerTool.get_openai_callback" + "backend.batch.utilities.tools.question_answer_tool.get_openai_callback" ) as mock: yield mock @@ -66,7 +66,7 @@ def get_openai_callback_mock(): @pytest.fixture(autouse=True) def get_search_handler_mock(): with patch( - "backend.batch.utilities.tools.QuestionAnswerTool.Search.get_search_handler" + "backend.batch.utilities.tools.question_answer_tool.Search.get_search_handler" ) as mock: search_handler = mock.return_value @@ -76,7 +76,7 @@ def get_search_handler_mock(): @pytest.fixture(autouse=True) def get_source_documents_mock(): with patch( - "backend.batch.utilities.tools.QuestionAnswerTool.Search.get_source_documents" + "backend.batch.utilities.tools.question_answer_tool.Search.get_source_documents" ) as mock: source_documents = mock.return_value yield source_documents @@ -85,7 +85,7 @@ def get_source_documents_mock(): @pytest.fixture(autouse=True) def get_source_documents_yield(): with patch( - "backend.batch.utilities.tools.QuestionAnswerTool.Search.get_source_documents" + "backend.batch.utilities.tools.question_answer_tool.Search.get_source_documents" ) as mock: documents = [ SourceDocument( From 9007b0cd60cf2a24e1d6968989f609399cdcef92 Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 11:36:07 +0100 Subject: [PATCH 4/7] fix another tests --- code/tests/search_utilities/test__search.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/tests/search_utilities/test__search.py b/code/tests/search_utilities/test__search.py index bbfb8c5b4..7d3a3744d 100644 --- a/code/tests/search_utilities/test__search.py +++ b/code/tests/search_utilities/test__search.py @@ -1,6 +1,8 @@ import pytest from unittest.mock import Mock, MagicMock, patch -from backend.batch.utilities.search.search import Search +from backend.batch.utilities.search.search import ( + Search, +) from backend.batch.utilities.search.integrated_vectorization_search_handler import ( IntegratedVectorizationSearchHandler, ) @@ -92,7 +94,7 @@ def test_get_source_documents_integrated_vectorization_no_results(env_helper_moc assert len(source_documents) == len(search_results) -@patch("backend.batch.utilities.search.Search") +@patch("backend.batch.utilities.search.search") def test_get_source_documents_azure_search(search_handler_mock: MagicMock): # given question = "example question" From 72fd6ecfe207277d66e90b28f27df67344fa4def Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 13:30:12 +0100 Subject: [PATCH 5/7] Keep navigation pages as-is to avoid lower case tab menu options. ( looks odd). --- code/backend/pages/{01_ingest_data.py => 01_Ingest_Data.py} | 0 code/backend/pages/{02_explore_data.py => 02_Explore_Data.py} | 2 +- code/backend/pages/{03_delete_data.py => 03_Delete_Data.py} | 2 +- code/backend/pages/{04_donfiguration.py => 04_Configuration.py} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename code/backend/pages/{01_ingest_data.py => 01_Ingest_Data.py} (100%) rename code/backend/pages/{02_explore_data.py => 02_Explore_Data.py} (96%) rename code/backend/pages/{03_delete_data.py => 03_Delete_Data.py} (97%) rename code/backend/pages/{04_donfiguration.py => 04_Configuration.py} (100%) diff --git a/code/backend/pages/01_ingest_data.py b/code/backend/pages/01_Ingest_Data.py similarity index 100% rename from code/backend/pages/01_ingest_data.py rename to code/backend/pages/01_Ingest_Data.py diff --git a/code/backend/pages/02_explore_data.py b/code/backend/pages/02_Explore_Data.py similarity index 96% rename from code/backend/pages/02_explore_data.py rename to code/backend/pages/02_Explore_Data.py index 593a2b476..60cc984b8 100644 --- a/code/backend/pages/02_explore_data.py +++ b/code/backend/pages/02_Explore_Data.py @@ -4,7 +4,7 @@ import sys import pandas as pd from batch.utilities.helpers.env_helper import EnvHelper -from batch.utilities.search.Search import Search +from batch.utilities.search.search import Search sys.path.append(os.path.join(os.path.dirname(__file__), "..")) env_helper: EnvHelper = EnvHelper() diff --git a/code/backend/pages/03_delete_data.py b/code/backend/pages/03_Delete_Data.py similarity index 97% rename from code/backend/pages/03_delete_data.py rename to code/backend/pages/03_Delete_Data.py index f93a92aed..4eb3dd978 100644 --- a/code/backend/pages/03_delete_data.py +++ b/code/backend/pages/03_Delete_Data.py @@ -4,7 +4,7 @@ import sys import logging from batch.utilities.helpers.env_helper import EnvHelper -from batch.utilities.search.Search import Search +from batch.utilities.search.search import Search sys.path.append(os.path.join(os.path.dirname(__file__), "..")) env_helper: EnvHelper = EnvHelper() diff --git a/code/backend/pages/04_donfiguration.py b/code/backend/pages/04_Configuration.py similarity index 100% rename from code/backend/pages/04_donfiguration.py rename to code/backend/pages/04_Configuration.py From 7fee339e41298efb9f0da7a2071de7655a3afd3d Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 13:34:40 +0100 Subject: [PATCH 6/7] merge conflicts. --- code/tests/test_batch_start_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/tests/test_batch_start_processing.py b/code/tests/test_batch_start_processing.py index 37606a458..9b3e5c3c6 100644 --- a/code/tests/test_batch_start_processing.py +++ b/code/tests/test_batch_start_processing.py @@ -10,7 +10,7 @@ @pytest.fixture(autouse=True) def env_helper_mock(): - with patch("backend.batch.BatchStartProcessing.EnvHelper") as mock: + with patch("backend.batch.batch_start_processing.EnvHelper") as mock: env_helper = mock.return_value env_helper.AZURE_SEARCH_INDEXER_NAME = "AZURE_SEARCH_INDEXER_NAME" From 885de9bcf38f9bbaea5a9e50bcbf5bcc8cbf9885 Mon Sep 17 00:00:00 2001 From: ArpitGaur Date: Tue, 14 May 2024 14:59:02 +0100 Subject: [PATCH 7/7] fix a typo. --- .../search_utilities/{test__search.py => test_search.py} | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename code/tests/search_utilities/{test__search.py => test_search.py} (98%) diff --git a/code/tests/search_utilities/test__search.py b/code/tests/search_utilities/test_search.py similarity index 98% rename from code/tests/search_utilities/test__search.py rename to code/tests/search_utilities/test_search.py index 7d3a3744d..05741fbaa 100644 --- a/code/tests/search_utilities/test__search.py +++ b/code/tests/search_utilities/test_search.py @@ -1,8 +1,6 @@ import pytest from unittest.mock import Mock, MagicMock, patch -from backend.batch.utilities.search.search import ( - Search, -) +from backend.batch.utilities.search.search import Search from backend.batch.utilities.search.integrated_vectorization_search_handler import ( IntegratedVectorizationSearchHandler, )