Skip to content

style: Reformat code to fix build #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading