Skip to content

Commit

Permalink
style: Reformat code to fix build (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdougal committed Jun 18, 2024
1 parent c2672fd commit 9723b29
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 10 deletions.
2 changes: 2 additions & 0 deletions code/backend/Admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
menu_items=None,
)


def load_css(file_path):
with open(file_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


# Load the common CSS
load_css("pages/common.css")

Expand Down
4 changes: 1 addition & 3 deletions code/backend/batch/utilities/helpers/env_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ def __load_config(self, **kwargs) -> None:
"LOAD_CONFIG_FROM_BLOB_STORAGE"
)

self.AZURE_ML_WORKSPACE_NAME = os.getenv(
"AZURE_ML_WORKSPACE_NAME", ""
)
self.AZURE_ML_WORKSPACE_NAME = os.getenv("AZURE_ML_WORKSPACE_NAME", "")

self.PROMPT_FLOW_ENDPOINT_NAME = os.getenv("PROMPT_FLOW_ENDPOINT_NAME", "")

Expand Down
3 changes: 3 additions & 0 deletions code/backend/pages/01_Ingest_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
menu_items=None,
)


def load_css(file_path):
with open(file_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


# Load the common CSS
load_css("pages/common.css")


def reprocess_all():
backend_url = urllib.parse.urljoin(
env_helper.BACKEND_URL, "/api/BatchStartProcessing"
Expand Down
2 changes: 2 additions & 0 deletions code/backend/pages/02_Explore_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
# Inject CSS with Markdown
st.markdown(hide_table_row_index, unsafe_allow_html=True)


def load_css(file_path):
with open(file_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


# Load the common CSS
load_css("pages/common.css")

Expand Down
2 changes: 2 additions & 0 deletions code/backend/pages/03_Delete_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
menu_items=None,
)


def load_css(file_path):
with open(file_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


# Load the common CSS
load_css("pages/common.css")

Expand Down
2 changes: 2 additions & 0 deletions code/backend/pages/04_Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
menu_items=None,
)


def load_css(file_path):
with open(file_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)


# Load the common CSS
load_css("pages/common.css")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def test_image_passed_to_llm_to_generate_caption(
),
)[0]

assert request.get_json()["messages"][1]["content"][1]["image_url"]["url"].startswith(
assert request.get_json()["messages"][1]["content"][1]["image_url"][
"url"
].startswith(
f"{app_config.get('AZURE_STORAGE_ACCOUNT_ENDPOINT')}{app_config.get('AZURE_BLOB_CONTAINER_NAME')}/{FILE_NAME}"
)

Expand Down
10 changes: 6 additions & 4 deletions code/tests/utilities/helpers/test_llm_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ def test_generate_embeddings_returns_embeddings(azure_openai_mock):
# then
assert actual_embeddings == expected_embeddings

@patch('backend.batch.utilities.helpers.llm_helper.DefaultAzureCredential')
@patch('backend.batch.utilities.helpers.llm_helper.MLClient')

@patch("backend.batch.utilities.helpers.llm_helper.DefaultAzureCredential")
@patch("backend.batch.utilities.helpers.llm_helper.MLClient")
def test_get_ml_client_initializes_with_expected_parameters(
mock_ml_client, mock_default_credential, env_helper_mock):
mock_ml_client, mock_default_credential, env_helper_mock
):
# given
llm_helper = LLMHelper()

Expand All @@ -153,5 +155,5 @@ def test_get_ml_client_initializes_with_expected_parameters(
mock_default_credential.return_value,
env_helper_mock.AZURE_SUBSCRIPTION_ID,
env_helper_mock.AZURE_RESOURCE_GROUP,
env_helper_mock.AZURE_ML_WORKSPACE_NAME
env_helper_mock.AZURE_ML_WORKSPACE_NAME,
)
10 changes: 8 additions & 2 deletions code/tests/utilities/tools/test_question_answer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ def test_use_advanced_vision_processing(env_helper_mock, llm_helper_mock):
"type": "text",
"text": 'Sources: {"retrieved_documents":[{"[doc1]":{"content":"mock content"}},{"[doc2]":{"content":"mock content 2"}}]}, Question: mock question',
},
{"type": "image_url", "image_url": {"url": "mock source 2mock sas"}},
{
"type": "image_url",
"image_url": {"url": "mock source 2mock sas"},
},
],
"role": "user",
},
Expand Down Expand Up @@ -411,7 +414,10 @@ def test_limit_number_of_images_passed_to_llm(
"type": "text",
"text": 'Sources: {"retrieved_documents":[{"[doc1]":{"content":"mock content"}},{"[doc2]":{"content":"mock content 2"}},{"[doc3]":{"content":"mock content 3"}}]}, Question: mock question',
},
{"type": "image_url", "image_url": {"url": "mock source 2mock sas"}},
{
"type": "image_url",
"image_url": {"url": "mock source 2mock sas"},
},
],
"role": "user",
},
Expand Down

0 comments on commit 9723b29

Please sign in to comment.