Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Rename workflows to workflow for naming consistency

davidmezzetti52a192526e3b
diff --git a/src/python/txtai/api/application.py b/src/python/txtai/api/application.py
index 16d89957..f2bbb974 100644
--- a/src/python/txtai/api/application.py
+++ b/src/python/txtai/api/application.py
@@ -12,7 +12,7 @@ from .base import API
from .factory import Factory
# pylint: disable=R0401
-from .routers import embeddings, extractor, labels, segmentation, similarity, summary, textractor, transcription, translation, workflows
+from .routers import embeddings, extractor, labels, segmentation, similarity, summary, textractor, transcription, translation, workflow
# API instance
app = FastAPI()
@@ -63,7 +63,7 @@ def start():
("textractor", textractor.router),
("transcription", transcription.router),
("translation", translation.router),
- ("workflows", workflows.router),
+ ("workflow", workflow.router),
]
# Conditionally add routes based on configuration
diff --git a/src/python/txtai/api/base.py b/src/python/txtai/api/base.py
index d6e76aab..96a023d9 100644
--- a/src/python/txtai/api/base.py
+++ b/src/python/txtai/api/base.py
@@ -72,10 +72,11 @@ class API:
self.workflows = {}
- # Resolve pipeline actions and create workflow
- if "workflows" in self.config:
- for workflow, config in self.config["workflows"].items():
+ # Create workflows
+ if "workflow" in self.config:
+ for workflow, config in self.config["workflow"].items():
for task in config["tasks"]:
+ # Resolve pipeline action
if "action" in task:
task["action"] = self.pipelines[task["action"]]
diff --git a/src/python/txtai/api/routers/__init__.py b/src/python/txtai/api/routers/__init__.py
index 5d7090ef..338bae5d 100644
--- a/src/python/txtai/api/routers/__init__.py
+++ b/src/python/txtai/api/routers/__init__.py
@@ -10,4 +10,4 @@ from . import summary
from . import textractor
from . import transcription
from . import translation
-from . import workflows
+from . import workflow
diff --git a/src/python/txtai/api/routers/workflows.py b/src/python/txtai/api/routers/workflow.py
similarity index 100%
rename from src/python/txtai/api/routers/workflows.py
rename to src/python/txtai/api/routers/workflow.py
diff --git a/test/python/testapi/testworkflow.py b/test/python/testapi/testworkflow.py
index e004993f..a7b6b4ec 100644
--- a/test/python/testapi/testworkflow.py
+++ b/test/python/testapi/testworkflow.py
@@ -21,8 +21,8 @@ WORKFLOWS = """
segmentation:
sentences: true
-# Workflows
-workflows:
+# Workflow definitions
+workflow:
segment:
tasks:
- action: segmentation