-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
1,049 additions
and
1,718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
In the Python SDK, you can also get a list of feedback records that are semantically close to a given embedding with the `find_similar_records` method. These are the arguments of this function: | ||
|
||
- `vector_name`: The `name` of the vector to use in the search. | ||
- `value`: A vector to use for the similarity search in the form of a `List[float]`. It is necessary to include a `value` **or** a `record`. | ||
- `record`: A `FeedbackRecord` to use as part of the search. It is necessary to include a `value` **or** a `record`. | ||
- `max_results` (optional): The maximum number of results for this search. The default is `50`. | ||
|
||
This returns a list of Tuples with the records and their similarity score (between 0 and 1). | ||
|
||
```python | ||
ds = rg.FeedbackDataset.from_argilla("my_dataset", workspace="my_workspace") | ||
|
||
# using text embeddings | ||
similar_records = ds.find_similar_records( | ||
vector_name="my_vector", | ||
value=embedder_model.embeddings("My text is here") | ||
# value=embedder_model.embeddings("My text is here").tolist() # for numpy arrays | ||
) | ||
|
||
# using another record | ||
similar_records = ds.find_similar_records( | ||
vector_name="my_vector", | ||
record=ds.records[0], | ||
max_results=5 | ||
) | ||
|
||
# work with the resulting tuples | ||
for record, score in similar_records: | ||
... | ||
``` | ||
|
||
You can also combine filters and semantic search like this: | ||
|
||
```python | ||
similar_records = (dataset | ||
.filter_by(metadata=[rg.TermsMetadataFilter(values=["Positive"])]) | ||
.find_similar_records(vector_name="vector", value=model.encode("Another text").tolist()) | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
In Feedback datasets, you can also retrieve records based on their similarity with another record. To do that, make sure you have added `vector_settings` to your [dataset configuration](/practical_guides/create_dataset.md#define-vectors) and that your [records include vectors](/practical_guides/create_dataset.md#configure-the-records). | ||
|
||
In the UI, go to the record you'd like to use for the semantic search and click on `Find similar` at the top right corner of the record card. If there is more than one vector, you will be asked to select which vector to use. You can also select whether you want the most or least similar records and the number of results you would like to see. | ||
|
||
At any time, you can expand or collapse the record that was used for the search as a reference. If you want to undo the search, just click on the cross next to the reference record. | ||
|
||
![Snapshot of semantic search in a Feedback Dataset from Argilla's UI](/_static/images/llms/feedback_semantic_search.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+225 KB
(160%)
docs/_source/_static/images/llms/snapshot-feedback-submitted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.