Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Make texts parameter optional for extractor pipeline in applications, closes #420

davidmezzetti5251777f63e1
diff --git a/src/python/txtai/api/routers/extractor.py b/src/python/txtai/api/routers/extractor.py
index f5eb71c4..011a9097 100644
--- a/src/python/txtai/api/routers/extractor.py
+++ b/src/python/txtai/api/routers/extractor.py
@@ -2,7 +2,7 @@
Defines API paths for extractor endpoints.
"""
-from typing import List
+from typing import List, Optional
from fastapi import APIRouter, Body
@@ -12,13 +12,13 @@ router = APIRouter()
@router.post("/extract")
-def extract(queue: List[dict] = Body(...), texts: List[str] = Body(...)):
+def extract(queue: List[dict] = Body(...), texts: Optional[List[str]] = Body(default=None)):
"""
Extracts answers to input questions.
Args:
queue: list of {name: value, query: value, question: value, snippet: value}
- texts: list of text
+ texts: optional list of text
Returns:
list of {name: value, answer: value}
diff --git a/src/python/txtai/app/base.py b/src/python/txtai/app/base.py
index 7983a432..4b31a80e 100644
--- a/src/python/txtai/app/base.py
+++ b/src/python/txtai/app/base.py
@@ -561,13 +561,13 @@ class Application:
return None
- def extract(self, queue, texts):
+ def extract(self, queue, texts=None):
"""
Extracts answers to input questions.
Args:
queue: list of {name: value, query: value, question: value, snippet: value}
- texts: list of text
+ texts: optional list of text
Returns:
list of {name: value, answer: value}