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 for classifier tools (#159)
alid4affbb4910a
diff --git a/tools/classifier/src/config/properties.json b/tools/classifier/src/config/properties.jsonindex b1139b9ae..e45351b1d 100644--- a/tools/classifier/src/config/properties.json+++ b/tools/classifier/src/config/properties.json@@ -39,7 +39,7 @@"isEnabled": true,"adapterId": "textExtractorId","title": "Text Extraction Adapter",- "isRequired": false,+ "isRequired": true,"description": "Choose extractor adapter to extract text"}]diff --git a/tools/classifier/src/main.py b/tools/classifier/src/main.pyindex 77d482cef..71dc677fe 100644--- a/tools/classifier/src/main.py+++ b/tools/classifier/src/main.py@@ -23,12 +23,15 @@ class UnstractClassifier(BaseTool):def validate(self, input_file: str, settings: dict[str, Any]) -> None:bins: Optional[list[str]] = settings.get("classificationBins")llm_adapter_instance_id = settings.get(ToolSettingsKey.LLM_ADAPTER_ID)+ text_extraction_adapter_id = settings.get("textExtractorId")if not bins:self.stream_error_and_exit("Classification bins are required")elif len(bins) < 2:self.stream_error_and_exit("At least two bins are required")if not llm_adapter_instance_id:- self.stream_error_and_exit("Choose a llm to process the classifier")+ self.stream_error_and_exit("Choose an LLM to process the classifier")+ if not text_extraction_adapter_id:+ self.stream_error_and_exit("Choose an LLM to extract the documents")def run(self,@@ -60,7 +63,7 @@ class UnstractClassifier(BaseTool):# Update GUIinput_text_for_log = textif len(input_text_for_log) > 500:- input_text_for_log = input_text_for_log[:50000] + "...(truncated)"+ input_text_for_log = input_text_for_log[:500] + "...(truncated)"input_log = (f"### Classification bins:\n```text\n{bins}\n```\n\n"f"### Input text:\n\n```text\n{input_text_for_log}\n```\n\n"diff --git a/unstract/tool-registry/src/unstract/tool_registry/public_tools.json b/unstract/tool-registry/src/unstract/tool_registry/public_tools.jsonindex fe562f013..3ab9c18f8 100644--- a/unstract/tool-registry/src/unstract/tool_registry/public_tools.json+++ b/unstract/tool-registry/src/unstract/tool_registry/public_tools.json@@ -5,7 +5,7 @@"schemaVersion": "0.0.1","displayName": "File Classifier","functionName": "classify",- "toolVersion": "0.0.2",+ "toolVersion": "0.0.3","description": "Classifies a file into a bin based on its contents","input": {"description": "File to be classified"@@ -42,7 +42,7 @@"isEnabled": true,"adapterId": "textExtractorId","title": "Text Extraction Adapter",- "isRequired": false,+ "isRequired": true,"description": "Choose extractor adapter to extract text"}]@@ -139,9 +139,9 @@}},"icon": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n enable-background=\"new 0 0 20 20\"\n height=\"48\"\n viewBox=\"0 0 20 20\"\n width=\"48\"\n fill=\"#000000\"\n version=\"1.1\"\n id=\"svg8109\"\n sodipodi:docname=\"folder_copy_black_48dp.svg\"\n xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:svg=\"http://www.w3.org/2000/svg\">\n <defs\n id=\"defs8113\" />\n <sodipodi:namedview\n id=\"namedview8111\"\n pagecolor=\"#ffffff\"\n bordercolor=\"#000000\"\n borderopacity=\"0.25\"\n inkscape:showpageshadow=\"2\"\n inkscape:pageopacity=\"0.0\"\n inkscape:pagecheckerboard=\"0\"\n inkscape:deskcolor=\"#d1d1d1\"\n showgrid=\"false\" />\n <g\n id=\"g8099\">\n <rect\n fill=\"none\"\n height=\"20\"\n width=\"20\"\n x=\"0\"\n id=\"rect8097\"\n y=\"0\" />\n </g>\n <g\n id=\"g8107\"\n style=\"fill:#ff4d6d;fill-opacity:1\">\n <g\n id=\"g8105\"\n style=\"fill:#ff4d6d;fill-opacity:1\">\n <path\n d=\"M 2.5,5 H 1 V 15.5 C 1,16.33 1.67,17 2.5,17 H 15.68 V 15.5 H 2.5 Z\"\n id=\"path8101\"\n style=\"fill:#ff4d6d;fill-opacity:1\" />\n <path\n d=\"M 16.5,4 H 11 L 9,2 H 5.5 C 4.67,2 4,2.67 4,3.5 v 9 C 4,13.33 4.67,14 5.5,14 h 11 c 0.83,0 1.5,-0.67 1.5,-1.5 v -7 C 18,4.67 17.33,4 16.5,4 Z m 0,8.5 h -11 v -9 h 2.88 l 2,2 h 6.12 z\"\n id=\"path8103\"\n style=\"fill:#ff4d6d;fill-opacity:1\" />\n </g>\n </g>\n</svg>\n",- "image_url": "docker:unstract/tool-classifier:0.0.2",+ "image_url": "docker:unstract/tool-classifier:0.0.3","image_name": "unstract/tool-classifier",- "image_tag": "0.0.2"+ "image_tag": "0.0.3"},"document_indexer": {"tool_uid": "document_indexer",