Skip to content

Commit a547b1e

Browse files
committed
Revert whitespace changes
1 parent ccc28e5 commit a547b1e

File tree

2 files changed

+10
-38
lines changed

2 files changed

+10
-38
lines changed

app/backend/app.py

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,7 @@ async def ask(auth_claims: dict[str, Any]):
188188
try:
189189
approach: Approach = cast(Approach, current_app.config[CONFIG_ASK_APPROACH])
190190
r = await approach.run(
191-
request_json["messages"],
192-
context=context,
193-
session_state=request_json.get("session_state"),
191+
request_json["messages"], context=context, session_state=request_json.get("session_state")
194192
)
195193
return jsonify(r)
196194
except Exception as error:
@@ -331,10 +329,7 @@ async def speech():
331329
+ "#"
332330
+ current_app.config[CONFIG_SPEECH_SERVICE_TOKEN].token
333331
)
334-
speech_config = SpeechConfig(
335-
auth_token=auth_token,
336-
region=current_app.config[CONFIG_SPEECH_SERVICE_LOCATION],
337-
)
332+
speech_config = SpeechConfig(auth_token=auth_token, region=current_app.config[CONFIG_SPEECH_SERVICE_LOCATION])
338333
speech_config.speech_synthesis_voice_name = current_app.config[CONFIG_SPEECH_SERVICE_VOICE]
339334
speech_config.speech_synthesis_output_format = SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3
340335
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=None)
@@ -344,9 +339,7 @@ async def speech():
344339
elif result.reason == ResultReason.Canceled:
345340
cancellation_details = result.cancellation_details
346341
current_app.logger.error(
347-
"Speech synthesis canceled: %s %s",
348-
cancellation_details.reason,
349-
cancellation_details.error_details,
342+
"Speech synthesis canceled: %s %s", cancellation_details.reason, cancellation_details.error_details
350343
)
351344
raise Exception("Speech synthesis canceled. Check logs for details.")
352345
else:
@@ -370,22 +363,11 @@ async def upload(auth_claims: dict[str, Any]):
370363
adls_manager: AdlsBlobManager = current_app.config[CONFIG_USER_BLOB_MANAGER]
371364
file_url = await adls_manager.upload_blob(file, file.filename, user_oid)
372365
ingester: UploadUserFileStrategy = current_app.config[CONFIG_INGESTER]
373-
await ingester.add_file(
374-
File(content=file, url=file_url, acls={"oids": [user_oid]}),
375-
user_oid=user_oid,
376-
)
366+
await ingester.add_file(File(content=file, url=file_url, acls={"oids": [user_oid]}), user_oid=user_oid)
377367
return jsonify({"message": "File uploaded successfully"}), 200
378368
except Exception as error:
379369
current_app.logger.error("Error uploading file: %s", error)
380-
return (
381-
jsonify(
382-
{
383-
"message": "Error uploading file, check server logs for details.",
384-
"status": "failed",
385-
}
386-
),
387-
500,
388-
)
370+
return jsonify({"message": "Error uploading file, check server logs for details.", "status": "failed"}), 500
389371

390372

391373
@bp.post("/delete_uploaded")
@@ -505,17 +487,15 @@ async def setup_clients():
505487
# ManagedIdentityCredential should use AZURE_CLIENT_ID if set in env, but its not working for some reason,
506488
# so we explicitly pass it in as the client ID here. This is necessary for user-assigned managed identities.
507489
current_app.logger.info(
508-
"Setting up Azure credential using ManagedIdentityCredential with client_id %s",
509-
AZURE_CLIENT_ID,
490+
"Setting up Azure credential using ManagedIdentityCredential with client_id %s", AZURE_CLIENT_ID
510491
)
511492
azure_credential = ManagedIdentityCredential(client_id=AZURE_CLIENT_ID)
512493
else:
513494
current_app.logger.info("Setting up Azure credential using ManagedIdentityCredential")
514495
azure_credential = ManagedIdentityCredential()
515496
elif AZURE_TENANT_ID:
516497
current_app.logger.info(
517-
"Setting up Azure credential using AzureDeveloperCliCredential with tenant_id %s",
518-
AZURE_TENANT_ID,
498+
"Setting up Azure credential using AzureDeveloperCliCredential with tenant_id %s", AZURE_TENANT_ID
519499
)
520500
azure_credential = AzureDeveloperCliCredential(tenant_id=AZURE_TENANT_ID, process_timeout=60)
521501
else:
@@ -535,9 +515,7 @@ async def setup_clients():
535515
credential=azure_credential,
536516
)
537517
agent_client = KnowledgeAgentRetrievalClient(
538-
endpoint=AZURE_SEARCH_ENDPOINT,
539-
agent_name=AZURE_SEARCH_AGENT,
540-
credential=azure_credential,
518+
endpoint=AZURE_SEARCH_ENDPOINT, agent_name=AZURE_SEARCH_AGENT, credential=azure_credential
541519
)
542520

543521
# Set up the global blob storage manager (used for global content/images, but not user uploads)
@@ -622,9 +600,7 @@ async def setup_clients():
622600
openai_deployment=AZURE_OPENAI_CHATGPT_DEPLOYMENT if OPENAI_HOST == OpenAIHost.AZURE else None,
623601
)
624602
search_info = await setup_search_info(
625-
search_service=AZURE_SEARCH_SERVICE,
626-
index_name=AZURE_SEARCH_INDEX,
627-
azure_credential=azure_credential,
603+
search_service=AZURE_SEARCH_SERVICE, index_name=AZURE_SEARCH_INDEX, azure_credential=azure_credential
628604
)
629605
text_embeddings_service = setup_embeddings_service(
630606
azure_credential=azure_credential,

app/backend/approaches/approach.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,7 @@ async def compute_multimodal_embedding(self, q: str):
475475
if not self.image_embeddings_client:
476476
raise ValueError("Approach is missing an image embeddings client for multimodal queries")
477477
multimodal_query_vector = await self.image_embeddings_client.create_embedding_for_text(q)
478-
return VectorizedQuery(
479-
vector=multimodal_query_vector,
480-
k_nearest_neighbors=50,
481-
fields="images/embedding",
482-
)
478+
return VectorizedQuery(vector=multimodal_query_vector, k_nearest_neighbors=50, fields="images/embedding")
483479

484480
def get_system_prompt_variables(self, override_prompt: Optional[str]) -> dict[str, str]:
485481
# Allows client to replace the entire prompt, or to inject into the existing prompt using >>>

0 commit comments

Comments
 (0)