mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-08-26 09:26:25 +00:00
Fix print_answers
(#1743)
* Fix a specific path of print_answers that was assuming answers are dictionaries Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
ea3abd305b
commit
09a462d756
@ -2,7 +2,7 @@
|
||||
# Module base
|
||||
|
||||
<a name="base.BaseDocumentClassifier"></a>
|
||||
## BaseDocumentClassifier Objects
|
||||
## BaseDocumentClassifier
|
||||
|
||||
```python
|
||||
class BaseDocumentClassifier(BaseComponent)
|
||||
@ -21,7 +21,7 @@ Wrapper method used to time functions.
|
||||
# Module transformers
|
||||
|
||||
<a name="transformers.TransformersDocumentClassifier"></a>
|
||||
## TransformersDocumentClassifier Objects
|
||||
## TransformersDocumentClassifier
|
||||
|
||||
```python
|
||||
class TransformersDocumentClassifier(BaseDocumentClassifier)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Module evaluator
|
||||
|
||||
<a name="evaluator.EvalDocuments"></a>
|
||||
## EvalDocuments Objects
|
||||
## EvalDocuments
|
||||
|
||||
```python
|
||||
class EvalDocuments(BaseComponent)
|
||||
@ -48,7 +48,7 @@ Run this node on one sample and its labels
|
||||
Print the evaluation results
|
||||
|
||||
<a name="evaluator.EvalAnswers"></a>
|
||||
## EvalAnswers Objects
|
||||
## EvalAnswers
|
||||
|
||||
```python
|
||||
class EvalAnswers(BaseComponent)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Module base
|
||||
|
||||
<a name="base.RootNode"></a>
|
||||
## RootNode Objects
|
||||
## RootNode
|
||||
|
||||
```python
|
||||
class RootNode(BaseComponent)
|
||||
@ -11,7 +11,7 @@ class RootNode(BaseComponent)
|
||||
RootNode feeds inputs together with corresponding params to a Pipeline.
|
||||
|
||||
<a name="base.BasePipeline"></a>
|
||||
## BasePipeline Objects
|
||||
## BasePipeline
|
||||
|
||||
```python
|
||||
class BasePipeline()
|
||||
@ -72,7 +72,7 @@ Here's a sample configuration:
|
||||
`_` sign must be used to specify nested hierarchical properties.
|
||||
|
||||
<a name="base.Pipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="base.RayPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="base._RayDeploymentWrapper"></a>
|
||||
## \_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
|
||||
|
||||
<a name="standard_pipelines.BaseStandardPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="standard_pipelines.ExtractiveQAPipeline"></a>
|
||||
## ExtractiveQAPipeline Objects
|
||||
## ExtractiveQAPipeline
|
||||
|
||||
```python
|
||||
class ExtractiveQAPipeline(BaseStandardPipeline)
|
||||
@ -521,7 +521,7 @@ Pipeline for Extractive Question Answering.
|
||||
by this method under the key "_debug"
|
||||
|
||||
<a name="standard_pipelines.DocumentSearchPipeline"></a>
|
||||
## DocumentSearchPipeline Objects
|
||||
## DocumentSearchPipeline
|
||||
|
||||
```python
|
||||
class DocumentSearchPipeline(BaseStandardPipeline)
|
||||
@ -558,7 +558,7 @@ Pipeline for semantic document search.
|
||||
by this method under the key "_debug"
|
||||
|
||||
<a name="standard_pipelines.GenerativeQAPipeline"></a>
|
||||
## GenerativeQAPipeline Objects
|
||||
## GenerativeQAPipeline
|
||||
|
||||
```python
|
||||
class GenerativeQAPipeline(BaseStandardPipeline)
|
||||
@ -597,7 +597,7 @@ Pipeline for Generative Question Answering.
|
||||
by this method under the key "_debug"
|
||||
|
||||
<a name="standard_pipelines.SearchSummarizationPipeline"></a>
|
||||
## 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"
|
||||
|
||||
<a name="standard_pipelines.FAQPipeline"></a>
|
||||
## 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"
|
||||
|
||||
<a name="standard_pipelines.TranslationWrapperPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="standard_pipelines.QuestionGenerationPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="standard_pipelines.RetrieverQuestionGenerationPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="standard_pipelines.QuestionAnswerGenerationPipeline"></a>
|
||||
## 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.
|
||||
|
||||
<a name="standard_pipelines.MostSimilarDocumentsPipeline"></a>
|
||||
## MostSimilarDocumentsPipeline Objects
|
||||
## MostSimilarDocumentsPipeline
|
||||
|
||||
```python
|
||||
class MostSimilarDocumentsPipeline(BaseStandardPipeline)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Module base
|
||||
|
||||
<a name="base.BaseQueryClassifier"></a>
|
||||
## BaseQueryClassifier Objects
|
||||
## BaseQueryClassifier
|
||||
|
||||
```python
|
||||
class BaseQueryClassifier(BaseComponent)
|
||||
@ -14,7 +14,7 @@ Abstract class for Query Classifiers
|
||||
# Module sklearn
|
||||
|
||||
<a name="sklearn.SklearnQueryClassifier"></a>
|
||||
## SklearnQueryClassifier Objects
|
||||
## SklearnQueryClassifier
|
||||
|
||||
```python
|
||||
class SklearnQueryClassifier(BaseQueryClassifier)
|
||||
@ -81,7 +81,7 @@ queries or statement vs question queries.
|
||||
# Module transformers
|
||||
|
||||
<a name="transformers.TransformersQueryClassifier"></a>
|
||||
## TransformersQueryClassifier Objects
|
||||
## TransformersQueryClassifier
|
||||
|
||||
```python
|
||||
class TransformersQueryClassifier(BaseQueryClassifier)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Module question\_generator
|
||||
|
||||
<a name="question_generator.QuestionGenerator"></a>
|
||||
## QuestionGenerator Objects
|
||||
## QuestionGenerator
|
||||
|
||||
```python
|
||||
class QuestionGenerator(BaseComponent)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Module base
|
||||
|
||||
<a name="base.BaseRanker"></a>
|
||||
## BaseRanker Objects
|
||||
## BaseRanker
|
||||
|
||||
```python
|
||||
class BaseRanker(BaseComponent)
|
||||
@ -55,7 +55,7 @@ position in the ranking of documents the correct document is.
|
||||
# Module sentence\_transformers
|
||||
|
||||
<a name="sentence_transformers.SentenceTransformersRanker"></a>
|
||||
## SentenceTransformersRanker Objects
|
||||
## SentenceTransformersRanker
|
||||
|
||||
```python
|
||||
class SentenceTransformersRanker(BaseRanker)
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user