💡 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
Sync docs
davidmezzetti417517f0cded
diff --git a/src/python/txtai/api.py b/src/python/txtai/api.pyindex 19334d6a..4b2ef892 100644--- a/src/python/txtai/api.py+++ b/src/python/txtai/api.py@@ -234,7 +234,7 @@ class API(object):def transform(self, text):"""- Transforms input text into embeddings arrays.+ Transforms text into embeddings arrays.Args:text: input text@@ -354,15 +354,15 @@ def start():def search(query: str, request: Request):"""Finds documents in the embeddings model most similar to the input query. Returns- a list of (id, score) sorted by highest score, where id is the document id in- the embeddings model.+ a list of {id: value, score: value} sorted by highest score, where id is the+ document id in the embeddings model.Args:query: query textrequest: FastAPI requestReturns:- list of (id, score)+ list of {id: value, score: value}"""return INSTANCE.search(query, request)@@ -371,15 +371,15 @@ def search(query: str, request: Request):def batchsearch(queries: List[str] = Body(...), limit: int = Body(...)):"""Finds documents in the embeddings model most similar to the input queries. Returns- a list of (id, score) sorted by highest score per query, where id is the document id- in the embeddings model.+ a list of {id: value, score: value} sorted by highest score per query, where id is+ the document id in the embeddings model.Args:queries: queries textlimit: maximum resultsReturns:- list of (id, score) per query+ list of {id: value, score: value} per query"""return INSTANCE.batchsearch(queries, limit)@@ -408,14 +408,15 @@ def index():def similarity(query: str = Body(...), texts: List[str] = Body(...)):"""Computes the similarity between query and list of text. Returns a list of- (id, score) sorted by highest score, where id is the index in texts.+ {id: value, score: value} sorted by highest score, where id is the index+ in texts.Args:query: query texttexts: list of textReturns:- list of (id, score)+ list of {id: value, score: value}"""return INSTANCE.similarity(query, texts)@@ -424,14 +425,15 @@ def similarity(query: str = Body(...), texts: List[str] = Body(...)):def batchsimilarity(queries: List[str] = Body(...), texts: List[str] = Body(...)):"""Computes the similarity between list of queries and list of text. Returns a list- of (id, score) sorted by highest score per query, where id is the index in texts.+ of {id: value, score: value} sorted by highest score per query, where id is the+ index in texts.Args:queries: queries texttexts: list of textReturns:- list of (id, score) per query+ list of {id: value, score: value} per query"""return INSTANCE.batchsimilarity(queries, texts)@@ -470,11 +472,11 @@ def extract(queue: List[dict] = Body(...), texts: List[str] = Body(...)):Extracts answers to input questions.Args:- queue: list of {name: value, query: value, question: value, snippet: value)+ queue: list of {name: value, query: value, question: value, snippet: value}texts: list of textReturns:- list of (name, answer)+ list of {name: value, answer: value}"""return INSTANCE.extract(queue, texts)@@ -483,14 +485,14 @@ def extract(queue: List[dict] = Body(...), texts: List[str] = Body(...)):def label(text: str = Body(...), labels: List[str] = Body(...)):"""Applies a zero shot classifier to text using a list of labels. Returns a list of- (id, score) sorted by highest score, where id is the index in labels.+ {id: value, score: value} sorted by highest score, where id is the index in labels.Args:text: input textlabels: list of labelsReturns:- list of (id, score)+ list of {id: value, score: value} per text element"""return INSTANCE.label(text, labels)@@ -499,14 +501,15 @@ def label(text: str = Body(...), labels: List[str] = Body(...)):def batchlabel(texts: List[str] = Body(...), labels: List[str] = Body(...)):"""Applies a zero shot classifier to list of text using a list of labels. Returns a list of- (id, score) sorted by highest score, where id is the index in labels per text element.+ {id: value, score: value} sorted by highest score, where id is the index in labels per+ text element.Args:texts: list of textslabels: list of labelsReturns:- list of (id, score) per text element+ list of {id: value score: value} per text element"""return INSTANCE.label(texts, labels)