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

[FEATURE] Index records in elasticsearch index with suggestion info (agent, value , and score) #4230

Closed
Tracked by #3849
frascuchon opened this issue Nov 14, 2023 · 0 comments · Fixed by #4317
Closed
Tracked by #3849
Labels
team: backend Indicates that the issue or pull request is owned by the backend team

Comments

@frascuchon
Copy link
Member

frascuchon commented Nov 14, 2023

{ 
	suggestion.question_name.value
	suggestion.question_name.agent
	suggestion.question_name.score
}	
@frascuchon frascuchon added the team: backend Indicates that the issue or pull request is owned by the backend team label Nov 14, 2023
@frascuchon frascuchon linked a pull request Nov 24, 2023 that will close this issue
jfcalvo added a commit that referenced this issue Nov 27, 2023
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

This PR adds support for indexing suggestions when indexing records in
the search index.

In order to be sure that all record attributes are passed when indexing
records, a workaround has been implemented by forcing a record,
responses, and suggestions to refresh before indexing them. Otherwise is
hard to add that info when loading records in the current code base.

This behavior must be reviewed and simplified cc @gabrielmbmb @jfcalvo 

Changes related to tests will be moved into a separate PR since extra
refactoring work must be done. Once this extra PR is merged here, the PR
will be marked as ready for review. Related PR
#4318


Refs: #3849 

Closes #4230

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: José Francisco Calvo <[email protected]>
Co-authored-by: José Francisco Calvo <[email protected]>
frascuchon pushed a commit that referenced this issue Nov 28, 2023
…apping (#4330)

# Description

After testing suggestions creation and indexing we found an error
creating suggestions using ranking questions types. Specifying an
explicit set of properties fix the problem.

This is the script used to test the suggestions index:

```python
import argilla as rg

dataset = rg.FeedbackDataset(
  fields=[rg.TextField(name="text")],
  questions=[
    rg.RatingQuestion(name="rating-question", values=[1, 2, 3, 4]),
    rg.TextQuestion(name="text-question"),
    rg.LabelQuestion(name="label-question", labels=["one", "two"]),
    rg.MultiLabelQuestion(name="multi-label-question", labels=["one", "two", "three"]),
    rg.RankingQuestion(name="ranking-question", values=["ranking-1", "ranking-2", "ranking-3"]),
  ],
)

dataset.add_records(
  records=[
    rg.FeedbackRecord(
      fields={"text": "record-1"},
      suggestions=[
        {"question_name": "rating-question", "value": 1},
        {"question_name": "text-question", "value": "suggestion-1",}
      ]
    ),
    rg.FeedbackRecord(
      fields={"text": "record-2"},
      suggestions=[
        {"question_name": "label-question", "value": "one"},
        {"question_name": "multi-label-question", "value": ["one", "two"]},
        {
          "question_name": "ranking-question",
          "value": [
            {"rank": 1, "value": "ranking-1"},
            {"rank": 2, "value": "ranking-2"},
            {"rank": 3, "value": "ranking-3"}
          ]
        }
      ]
    ),
  ],
)

dataset.push_to_argilla(name="test-dataset")
```

Refs #4230

Kudos to @gabrielmbmb for helping me doing the manual testing using the
SDK.

**Type of change**

- [x] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [x] Manually creating suggestions using SDK and checking integration
with the search engine.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
frascuchon pushed a commit that referenced this issue Nov 28, 2023
# Description

Update a suggestion from the record document on search engine when the
suggestion is updated using the records update suggestion endpoint.

Ref #4230 

**Type of change**

- [x] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [x] Running tests locally.
- [x] Checking manually that updating a suggestion is affecting filters
later on the UI.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
jfcalvo added a commit that referenced this issue Nov 28, 2023
# Description

Delete a suggestion from the record document on search engine when the
suggestion is deleted using it's deletion endpoint.

Ref #4230 

**Type of change**

- [x] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [x] Running tests locally.
- [x] Checking manually that deleting a suggestion is affecting filters
later on the UI.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: Francisco Aranda <[email protected]>
davidberenstein1957 pushed a commit that referenced this issue Nov 29, 2023
# Description

Update a suggestion from the record document on search engine when the
suggestion is updated using the records update suggestion endpoint.

Ref #4230 

**Type of change**

- [x] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [x] Running tests locally.
- [x] Checking manually that updating a suggestion is affecting filters
later on the UI.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
davidberenstein1957 pushed a commit that referenced this issue Nov 29, 2023
# Description

Delete a suggestion from the record document on search engine when the
suggestion is deleted using it's deletion endpoint.

Ref #4230 

**Type of change**

- [x] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [x] Running tests locally.
- [x] Checking manually that deleting a suggestion is affecting filters
later on the UI.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: Francisco Aranda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team: backend Indicates that the issue or pull request is owned by the backend team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant