LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Fix/workflow tool addition changes (#489)
Rahul Johny51b952dad9c7
diff --git a/backend/tool_instance/serializers.py b/backend/tool_instance/serializers.pyindex 4ce323b49..f36b66f87 100644--- a/backend/tool_instance/serializers.py+++ b/backend/tool_instance/serializers.py@@ -68,6 +68,11 @@ class ToolInstanceSerializer(AuditSerializer):raise ValidationError(f"Workflow with ID {workflow_id} does not exist.")validated_data[TIKey.WORKFLOW] = workflow+ if workflow.workflow_tool.count() > 0:+ raise ValidationError(+ f"Workflow with ID {workflow_id} can't have more than one tool."+ )+tool_uid = validated_data.get(TIKey.TOOL_ID)if not tool_uid:raise ToolDoesNotExist()diff --git a/backend/workflow_manager/workflow/generator.py b/backend/workflow_manager/workflow/generator.pyindex 7c901b4bf..31aabafb6 100644--- a/backend/workflow_manager/workflow/generator.py+++ b/backend/workflow_manager/workflow/generator.py@@ -17,6 +17,7 @@ from unstract.core.llm_workflow_generator.llm_interface import LLMInterfacelogger = logging.getLogger(__name__)+# TODO: Can be removed as not getting used with UX chnages.class WorkflowGenerator:"""Helps with generating a workflow using the LLM."""diff --git a/backend/workflow_manager/workflow/views.py b/backend/workflow_manager/workflow/views.pyindex c02569355..0a3c451cf 100644--- a/backend/workflow_manager/workflow/views.py+++ b/backend/workflow_manager/workflow/views.py@@ -4,6 +4,7 @@ from typing import Any, Optionalfrom connector.connector_instance_helper import ConnectorInstanceHelperfrom django.conf import settingsfrom django.db.models.query import QuerySet+from numpy import deprecate_with_docfrom permissions.permission import IsOwnerfrom pipeline.models import Pipelinefrom pipeline.pipeline_processor import PipelineProcessor@@ -78,6 +79,7 @@ class WorkflowViewSet(viewsets.ModelViewSet):else:return WorkflowSerializer+ @deprecate_with_doc("Not using with the latest UX chnages")def _generate_workflow(self, workflow_id: str) -> WorkflowGenerator:registry_tools: list[Tool] = ToolProcessor.get_registry_tools()generator = WorkflowGenerator(workflow_id=workflow_id)@@ -86,18 +88,12 @@ class WorkflowViewSet(viewsets.ModelViewSet):return generatordef perform_update(self, serializer: WorkflowSerializer) -> Workflow:- """To edit a workflow. Regenerates the tool instances for a new prompt.+ """To edit a workflow.Raises: WorkflowGenerationError"""kwargs = {}- if serializer.validated_data.get(WorkflowKey.PROMPT_TEXT):- workflow: Workflow = self.get_object()- generator = self._generate_workflow(workflow_id=workflow.id)- kwargs = {- WorkflowKey.LLM_RESPONSE: generator.llm_response,- WorkflowKey.WF_IS_ACTIVE: True,- }+try:workflow = serializer.save(**kwargs)return workflowdiff --git a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx b/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsxindex fb5acdaec..2d11f0eeb 100644--- a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx+++ b/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx@@ -1,7 +1,6 @@import { Col, Row } from "antd";import PropTypes from "prop-types";-import { Prompt } from "../prompt/Prompt";import { Steps } from "../steps/Steps";import "./WorkflowExecutionMain.css";import { InputOutput } from "../input-output/InputOutput";@@ -19,9 +18,6 @@ function WorkflowExecutionMain({<Row className="wf-exec-main-layout"><Col span={8} className="wf-exec-main-layout"><div className="wf-exec-main-col-1">- <div className="wf-exec-main-prompt">- <Prompt />- </div><div className="wf-exec-main-steps"><StepssetSteps={setSteps}