From 2cd5f7069c73b0930bd5e9fad941064a88fc3ed9 Mon Sep 17 00:00:00 2001 From: Denis Pajaziti Date: Wed, 12 Nov 2025 12:48:20 +0100 Subject: [PATCH 1/2] Enhance tool transformation logic in RequestAdapter to handle non-list inputs and invalid tool structures. Added logging for skipped transformations to improve debugging. --- app/azure/request_adapter.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/azure/request_adapter.py b/app/azure/request_adapter.py index 697db1e..30ace59 100644 --- a/app/azure/request_adapter.py +++ b/app/azure/request_adapter.py @@ -92,8 +92,31 @@ class RequestAdapter: def _transform_tools_for_responses(self, tools: Any) -> Any: out: List[Dict[str, Any]] = [] - for tool in tools: + if not isinstance(tools, list): + current_app.logger.debug( + "Skipping tool transformation because tools payload is not a list: %r", + tools, + ) + return out + + for idx, tool in enumerate(tools): + if not isinstance(tool, dict): + current_app.logger.warning( + "Skipping tool at index %s because it is not a dict (got %s).", + idx, + type(tool).__name__, + ) + continue + function = tool.get("function") + if not isinstance(function, dict): + current_app.logger.warning( + "Skipping tool at index %s because function payload is missing or invalid: %r", + idx, + function, + ) + continue + transformed: Dict[str, Any] = { "type": "function", "name": function.get("name"), From 28499689c019a0776c28d946ef9a7415bba82cde Mon Sep 17 00:00:00 2001 From: Denis Pajaziti Date: Wed, 12 Nov 2025 12:50:47 +0100 Subject: [PATCH 2/2] Remove development service from docker-compose.yml and update production service port from 8080 to 9090. --- docker-compose.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 62be134..73b5d8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,17 +6,6 @@ x-default-volumes: &default_volumes - ./:/app services: - flask-dev: - build: - context: . - target: development - args: - <<: *build_args - image: "app-development" - ports: - - "8080:5000" - <<: *default_volumes - flask-prod: build: context: . @@ -25,7 +14,7 @@ services: <<: *build_args image: "app-production" ports: - - "8080:5000" + - "9090:5000" environment: FLASK_ENV: production FLASK_DEBUG: 0