diff --git a/docs/_src/api/api/document_classifier.md b/docs/_src/api/api/document_classifier.md index a55a1e2a1..8e89683f7 100644 --- a/docs/_src/api/api/document_classifier.md +++ b/docs/_src/api/api/document_classifier.md @@ -2,7 +2,7 @@ # Module base -## BaseDocumentClassifier Objects +## BaseDocumentClassifier ```python class BaseDocumentClassifier(BaseComponent) @@ -21,7 +21,7 @@ Wrapper method used to time functions. # Module transformers -## TransformersDocumentClassifier Objects +## TransformersDocumentClassifier ```python class TransformersDocumentClassifier(BaseDocumentClassifier) diff --git a/docs/_src/api/api/evaluation.md b/docs/_src/api/api/evaluation.md index fbaa084db..0ccd2dc28 100644 --- a/docs/_src/api/api/evaluation.md +++ b/docs/_src/api/api/evaluation.md @@ -2,7 +2,7 @@ # Module evaluator -## EvalDocuments Objects +## EvalDocuments ```python class EvalDocuments(BaseComponent) @@ -48,7 +48,7 @@ Run this node on one sample and its labels Print the evaluation results -## EvalAnswers Objects +## EvalAnswers ```python class EvalAnswers(BaseComponent) diff --git a/docs/_src/api/api/pipelines.md b/docs/_src/api/api/pipelines.md index 3faa60f55..b8f326908 100644 --- a/docs/_src/api/api/pipelines.md +++ b/docs/_src/api/api/pipelines.md @@ -2,7 +2,7 @@ # Module base -## RootNode Objects +## RootNode ```python class RootNode(BaseComponent) @@ -11,7 +11,7 @@ class RootNode(BaseComponent) RootNode feeds inputs together with corresponding params to a Pipeline. -## BasePipeline Objects +## BasePipeline ```python class BasePipeline() @@ -72,7 +72,7 @@ Here's a sample configuration: `_` sign must be used to specify nested hierarchical properties. -## Pipeline Objects +## Pipeline ```python class Pipeline(BasePipeline) @@ -268,7 +268,7 @@ Save a YAML configuration for the Pipeline that can be used with `Pipeline.load_ - `return_defaults`: whether to output parameters that have the default values. -## RayPipeline Objects +## RayPipeline ```python class RayPipeline(Pipeline) @@ -369,7 +369,7 @@ Here's a sample configuration: - `address`: The IP address for the Ray cluster. If set to None, a local Ray instance is started. -## \_RayDeploymentWrapper Objects +## \_RayDeploymentWrapper ```python class _RayDeploymentWrapper() @@ -410,7 +410,7 @@ Ray calls this method which is then re-directed to the corresponding component's # Module standard\_pipelines -## BaseStandardPipeline Objects +## BaseStandardPipeline ```python class BaseStandardPipeline(ABC) @@ -482,7 +482,7 @@ Create a Graphviz visualization of the pipeline. - `path`: the path to save the image. -## ExtractiveQAPipeline Objects +## ExtractiveQAPipeline ```python class ExtractiveQAPipeline(BaseStandardPipeline) @@ -521,7 +521,7 @@ Pipeline for Extractive Question Answering. by this method under the key "_debug" -## DocumentSearchPipeline Objects +## DocumentSearchPipeline ```python class DocumentSearchPipeline(BaseStandardPipeline) @@ -558,7 +558,7 @@ Pipeline for semantic document search. by this method under the key "_debug" -## GenerativeQAPipeline Objects +## GenerativeQAPipeline ```python class GenerativeQAPipeline(BaseStandardPipeline) @@ -597,7 +597,7 @@ Pipeline for Generative Question Answering. by this method under the key "_debug" -## SearchSummarizationPipeline Objects +## SearchSummarizationPipeline ```python class SearchSummarizationPipeline(BaseStandardPipeline) @@ -639,7 +639,7 @@ Pipeline that retrieves documents for a query and then summarizes those document by this method under the key "_debug" -## FAQPipeline Objects +## FAQPipeline ```python class FAQPipeline(BaseStandardPipeline) @@ -676,7 +676,7 @@ Pipeline for finding similar FAQs using semantic document search. by this method under the key "_debug" -## TranslationWrapperPipeline Objects +## TranslationWrapperPipeline ```python class TranslationWrapperPipeline(BaseStandardPipeline) @@ -702,7 +702,7 @@ Wrap a given `pipeline` with the `input_translator` and `output_translator`. Note that pipelines with split or merge nodes are currently not supported. -## QuestionGenerationPipeline Objects +## QuestionGenerationPipeline ```python class QuestionGenerationPipeline(BaseStandardPipeline) @@ -712,7 +712,7 @@ A simple pipeline that takes documents as input and generates questions that it thinks can be answered by the documents. -## RetrieverQuestionGenerationPipeline Objects +## RetrieverQuestionGenerationPipeline ```python class RetrieverQuestionGenerationPipeline(BaseStandardPipeline) @@ -722,7 +722,7 @@ A simple pipeline that takes a query as input, performs retrieval, and then gene questions that it thinks can be answered by the retrieved documents. -## QuestionAnswerGenerationPipeline Objects +## QuestionAnswerGenerationPipeline ```python class QuestionAnswerGenerationPipeline(BaseStandardPipeline) @@ -732,7 +732,7 @@ This is a pipeline which takes a document as input, generates questions that the this document, and then performs question answering of this questions using that single document. -## MostSimilarDocumentsPipeline Objects +## MostSimilarDocumentsPipeline ```python class MostSimilarDocumentsPipeline(BaseStandardPipeline) diff --git a/docs/_src/api/api/query_classifier.md b/docs/_src/api/api/query_classifier.md index d1ce77464..0e06db13c 100644 --- a/docs/_src/api/api/query_classifier.md +++ b/docs/_src/api/api/query_classifier.md @@ -2,7 +2,7 @@ # Module base -## BaseQueryClassifier Objects +## BaseQueryClassifier ```python class BaseQueryClassifier(BaseComponent) @@ -14,7 +14,7 @@ Abstract class for Query Classifiers # Module sklearn -## SklearnQueryClassifier Objects +## SklearnQueryClassifier ```python class SklearnQueryClassifier(BaseQueryClassifier) @@ -81,7 +81,7 @@ queries or statement vs question queries. # Module transformers -## TransformersQueryClassifier Objects +## TransformersQueryClassifier ```python class TransformersQueryClassifier(BaseQueryClassifier) diff --git a/docs/_src/api/api/question_generator.md b/docs/_src/api/api/question_generator.md index d132c9a32..4b3681709 100644 --- a/docs/_src/api/api/question_generator.md +++ b/docs/_src/api/api/question_generator.md @@ -2,7 +2,7 @@ # Module question\_generator -## QuestionGenerator Objects +## QuestionGenerator ```python class QuestionGenerator(BaseComponent) diff --git a/docs/_src/api/api/ranker.md b/docs/_src/api/api/ranker.md index 33e2d0524..6a84f1cdd 100644 --- a/docs/_src/api/api/ranker.md +++ b/docs/_src/api/api/ranker.md @@ -2,7 +2,7 @@ # Module base -## BaseRanker Objects +## BaseRanker ```python class BaseRanker(BaseComponent) @@ -55,7 +55,7 @@ position in the ranking of documents the correct document is. # Module sentence\_transformers -## SentenceTransformersRanker Objects +## SentenceTransformersRanker ```python class SentenceTransformersRanker(BaseRanker) diff --git a/haystack/utils/export_utils.py b/haystack/utils/export_utils.py index dab1788d7..e66319105 100644 --- a/haystack/utils/export_utils.py +++ b/haystack/utils/export_utils.py @@ -55,8 +55,8 @@ def print_answers(results: dict, details: str = "all", max_text_len: Optional[in # Shorten long text fields if max_text_len is not None: for ans in answers: - if "context" in ans.keys() and len(ans["context"]) > 50: - ans["context"] = ans["context"][:50] + "..." + if getattr(ans, "context") and len(ans.context) > 50: + ans.context = ans.context[:50] + "..." pp.pprint(filtered_answers)