💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add safeopen validation to retrieve task output, closes #1181
davidmezzetti84be3476d82f
diff --git a/src/python/txtai/workflow/task/retrieve.py b/src/python/txtai/workflow/task/retrieve.pyindex c5fa2340..9285f784 100644--- a/src/python/txtai/workflow/task/retrieve.py+++ b/src/python/txtai/workflow/task/retrieve.py@@ -52,11 +52,17 @@ class RetrieveTask(Task):if self.flatten:# Flatten directory structure (default)path = os.path.join(self.directory, os.path.basename(path))+ directory = Noneelse:# Derive output pathpath = os.path.join(self.directory, os.path.normpath(path.lstrip("/")))directory = os.path.dirname(path)+ # Validate output path+ self.safeopen.valid(path)++ # Create output directory, if necessary+ if directory:# Create local directory, if necessaryos.makedirs(directory, exist_ok=True)