-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new option to limit the number documents which should be loaded from a dataset. This allows a workload to be generated based on a given dataset but at a reduced document count. Note: If the dataset includes an explicit 'queries' set then that queries set is used unchanged, and hence Recall may be significanlty reduced as the vectors the query expects to find nearby may not exist. As such, it may be desirable to ignore the query set and instead randomly sample from the (limited) documents set using the --pinecone-dataset-ignore-queries option.
- Loading branch information
Showing
4 changed files
with
36 additions
and
4 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,22 @@ | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) | ||
|
||
from dataset import Dataset | ||
import pytest | ||
|
||
|
||
class TestDataset: | ||
|
||
def test_limit(self): | ||
limit = 123 | ||
name = "langchain-python-docs-text-embedding-ada-002" | ||
dataset = Dataset(name) | ||
# Sanity check that the complete dataset size is greater than what | ||
# we are going to limit to. | ||
dataset_info = ([d for d in dataset.list() if d["name"] == name][0]) | ||
assert dataset_info["documents"] > limit, \ | ||
"Too few documents in dataset to be able to limit" | ||
|
||
dataset.load(limit=limit, load_queries=False) | ||
assert len(dataset.documents) == limit |