Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: install inference in REST API tests #5252

Merged
merged 7 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rest_api_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Install REST API
run: |
pip install -U "./rest_api[dev]"
pip install ".[dev]"
pip install ".[inference,dev]"
pip install .

- name: Run tests
Expand Down
7 changes: 5 additions & 2 deletions rest_api/rest_api/controller/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging

from fastapi import FastAPI, APIRouter
from haystack.schema import Label
from haystack.schema import Label, Span
from haystack.document_stores import BaseDocumentStore
from rest_api.schema import FilterRequest, CreateLabelSerialized
from rest_api.utils import get_app, get_pipelines
Expand Down Expand Up @@ -113,7 +113,10 @@ def export_feedback(

offset_start_in_document = 0
if label.answer and label.answer.offsets_in_document:
offset_start_in_document = label.answer.offsets_in_document[0].start
if isinstance(label.answer.offsets_in_document[0], Span):
offset_start_in_document = label.answer.offsets_in_document[0].start
else:
offset_start_in_document = label.answer.offsets_in_document[0].row
Comment on lines +116 to +119
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy was failing, so I added this block according to what the TableCell proposal specifies:

This may be confusing to users since it is not obvious that `start` should refer to `row` and `end` should refer to `column`.


if full_document_context:
context = label.document.content
Expand Down