Skip to content
Open
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: 1 addition & 1 deletion application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
EXECUTOR_TYPE = 'thread'
EXECUTOR_MAX_WORKERS = 30
SESSION_TYPE = 'filesystem'
VERSION = "0.250.171"
VERSION = "0.250.172"
IS_DEVELOPMENT = is_development_env_enabled()

SESSION_COOKIE_SAMESITE = os.getenv('SESSION_COOKIE_SAMESITE', 'Lax')
Expand Down
51 changes: 45 additions & 6 deletions application/single_app/functions_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
from functions_debug import *
from functions_keyvault import SecretReturnType, keyvault_model_endpoint_get_helper
from functions_model_endpoint_runtime import MODEL_ENDPOINT_PROVIDER_ALLOWLIST, build_model_endpoint_sync_chat_client
from functions_model_endpoint_types import (

Check warning on line 36 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
get_model_endpoint_api_type,

Check warning on line 37 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
resolve_model_endpoint_request_model,

Check warning on line 38 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
)
from model_endpoint_clients import MODEL_ENDPOINT_PROTOCOL_AZURE_OPENAI, infer_model_endpoint_protocol

Check warning on line 40 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.

Check warning on line 40 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
import azure.cognitiveservices.speech as speechsdk

_AUDIO_RUNTIME_CAPABILITIES_CACHE = None
Expand Down Expand Up @@ -126,13 +131,26 @@
return "https://ai.azure.com/.default"


def _build_model_endpoint_client(auth_settings, provider, endpoint, api_version, deployment_name):
def _build_model_endpoint_client(

Check warning on line 134 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
auth_settings,
provider,
endpoint,
api_version,
deployment_name,
*,
api_type='',
anthropic_version='',
allow_private_custom_endpoints=False,
):
client, _ = build_model_endpoint_sync_chat_client(
auth_settings,
provider,
endpoint,
api_version,
deployment_name=deployment_name,
api_type=api_type,
anthropic_version=anthropic_version,
allow_private_custom_endpoints=allow_private_custom_endpoints,
)
return client

Expand Down Expand Up @@ -169,16 +187,37 @@
provider = str(endpoint_cfg.get("provider") or selection["provider"] or "aoai").lower()
connection = endpoint_cfg.get("connection", {}) or {}
auth_settings = endpoint_cfg.get("auth", {}) or {}
deployment = str(model_cfg.get("deploymentName") or model_cfg.get("deployment") or "").strip()
deployment = resolve_model_endpoint_request_model(endpoint_cfg, model_cfg)

Check warning on line 190 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
endpoint = str(connection.get("endpoint") or "").strip()
api_version = str(connection.get("openai_api_version") or connection.get("api_version") or "").strip()
api_type = get_model_endpoint_api_type(endpoint_cfg)

Check warning on line 193 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
anthropic_version = str(connection.get("anthropic_version") or "").strip()
runtime_protocol = infer_model_endpoint_protocol(

Check warning on line 195 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains AI, plugin, agent, or workspace boundary marker. Recommendation%3A Check whether prompts, chat history, uploaded documents, embeddings, citations, settings, or identity can cross a new boundary.
provider,
endpoint,
deployment,
api_type,
)

if provider not in MODEL_ENDPOINT_PROVIDER_ALLOWLIST:
raise ValueError(f"Selected metadata extraction provider '{provider}' is not supported.")
if not endpoint or not api_version or not deployment:
raise ValueError("Selected metadata extraction endpoint is missing endpoint, API version, or deployment configuration.")

return _build_model_endpoint_client(auth_settings, provider, endpoint, api_version, deployment), deployment
if not endpoint or not deployment or (
runtime_protocol == MODEL_ENDPOINT_PROTOCOL_AZURE_OPENAI and not api_version

Check warning on line 205 in application/single_app/functions_documents.py

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
):
raise ValueError("Selected metadata extraction endpoint is incomplete.")

return _build_model_endpoint_client(
auth_settings,
provider,
endpoint,
api_version,
deployment,
api_type=api_type,
anthropic_version=anthropic_version,
allow_private_custom_endpoints=bool(
settings.get("allow_private_custom_model_endpoints", False)
),
), deployment

gpt_model = settings.get('metadata_extraction_model')
if not gpt_model:
Expand Down
Loading
Loading