LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Updated platform key retrieval in PromptIdeBaseTool
Chandrasekharan Mb7d06cfd808c
diff --git a/backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.py b/backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.pyindex d1ea56510..111a891d7 100644--- a/backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.py+++ b/backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.py@@ -1,6 +1,8 @@import os-from account.models import PlatformKey+from platform_settings.platform_auth_service import (+ PlatformAuthenticationService,+)from prompt_studio.prompt_studio_core.constants import LogLevel, ToolStudioKeysfrom unstract.sdk.tool.stream import StreamMixin@@ -32,7 +34,11 @@ class PromptIdeBaseTool(StreamMixin):"""# HACK: Adding platform key for multitenancyif env_key == ToolStudioKeys.PLATFORM_SERVICE_API_KEY:- platform_key = PlatformKey.objects.get(organization=self.org_id)+ platform_key = (+ PlatformAuthenticationService.get_active_platform_key(+ self.org_id+ )+ )key: str = str(platform_key.key)return keyelse:diff --git a/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py b/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.pyindex 3e7818751..a2a4165a1 100644--- a/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py+++ b/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py@@ -4,8 +4,6 @@ import osfrom pathlib import Pathfrom typing import Any, Optional-from account.models import Organization-from account.organization import OrganizationServicefrom django.conf import settingsfrom file_management.file_management_helper import FileManagerHelperfrom prompt_studio.prompt_profile_manager.models import ProfileManager@@ -218,14 +216,8 @@ class PromptStudioHelper:),)logger.info(f"Invoking prompt service for prompt id {id}")- org: Optional[- Organization- ] = OrganizationService.get_organization_by_org_id(org_id=org_id)response = PromptStudioHelper._fetch_response(- path=file_path,- tool=tool,- prompts=prompts,- org_id=org.id, # type:ignore+ path=file_path, tool=tool, prompts=prompts, org_id=org_id)stream_log.publish(tool.tool_id,diff --git a/prompt-service/src/unstract/prompt_service/prompt_ide_base_tool.py b/prompt-service/src/unstract/prompt_service/prompt_ide_base_tool.pyindex 727f4771c..346df91a0 100644--- a/prompt-service/src/unstract/prompt_service/prompt_ide_base_tool.py+++ b/prompt-service/src/unstract/prompt_service/prompt_ide_base_tool.py@@ -30,6 +30,7 @@ class PromptServiceBaseTool(StreamMixin):Returns:str: Value of the env"""+ # HACK: Adding platform key for multitenancyif env_key == PromptServiceContants.PLATFORM_SERVICE_API_KEY:if not self.platform_key:current_app.logger.error(f"{env_key} is required")