Extend ObjectStore with structured data reading for evaluation#1590
Draft
dnandakumar-nv wants to merge 13 commits intoNVIDIA:developfrom
Draft
Extend ObjectStore with structured data reading for evaluation#1590dnandakumar-nv wants to merge 13 commits intoNVIDIA:developfrom
dnandakumar-nv wants to merge 13 commits intoNVIDIA:developfrom
Conversation
Introduce dataset store registration system to streamline the handling of dataset configurations and loaders. This includes support for JSON, JSONL, CSV, Parquet, Excel, and custom dataset types. Updated the type registry and evaluation builder to integrate this feature, ensuring seamless interoperability and easier extension.``` Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Documented the process for creating and registering custom dataset stores. Updated relevant sections to highlight built-in and extendable dataset formats. This enhances flexibility for users working with various dataset types. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Renamed all references from "dataset store" to "dataset loader" for clarity and consistency. Updates include class names, function names, documentation, and tests. This change aligns terminology with the primary purpose of loading datasets rather than storing them. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Introduced a new LangSmith dataset loader for fetching evaluation datasets via API. Added corresponding configurations, unit tests, and registration logic to integrate it into the framework. This includes support for customization (keys, splits, limits), ensuring full compatibility and backward support for YAML configurations. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Updated outdated links to the A2A protocol website across documentation. Improved clarity in the dataset loader section by refining descriptions and addressing minor inaccuracies. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
The `dataset_loader` test package is no longer needed and has been completely removed. This cleanup helps reduce unnecessary code and improves maintainability of the repository. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Updated the dataset loader to handle datasets in the example data format specified in the LangSmith documentation. This ensures better compatibility and integration with LangSmith API datasets. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
Replaced specific placeholder paths with more generic and user-friendly ones to improve clarity in example commands and configurations. This makes the examples easier to follow and adapt for users. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
The dataset loader functionality and related tests have been removed as they are no longer relevant or required. Replacement mechanisms and updated configurations have been introduced for more streamlined dataset handling. Signed-off-by: dnandakumar-nv <dnandakumar@nvidia.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
read_dataframe()to the ObjectStore interface so evaluation datasets can be loaded through the existing ObjectStore plugin systemFileObjectStoreimplementation for local filesystem accessLangSmithObjectStorefor loading evaluation datasets from the LangSmith APIEvalDatasetConfig— a single flat configuration for evaluation datasets that supports both local files and named ObjectStore referencesMotivation
Evaluation dataset loading should reuse the existing ObjectStore infrastructure rather than introducing a separate abstraction. ObjectStore already solves the "where does data come from" problem (S3, MySQL, Redis, in-memory), but it only speaks
bytes. By adding aread_dataframe()method, ObjectStore gains the ability to parse structured data — which is exactly what eval needs.This cleanly separates where data comes from (ObjectStore implementations) from what format it's in (format parsers), and makes it trivial to add new data sources (implement ObjectStore) or new formats (add a line to the parser registry).
Design
ObjectStore.read_dataframe(key, format, **kwargs)— Non-abstract method on the existing ABC. Default implementation callsget_object()to fetch bytes, infers format from the key's file extension, and parses via format parsers. All existing ObjectStore implementations (S3, MySQL, Redis, in-memory) gain this capability for free. Subclasses can override for efficiency (e.g.,FileObjectStorepasses file paths directly to pandas,LangSmithObjectStorecalls the API without a bytes intermediary).FileObjectStore— New built-in ObjectStore for local filesystem access. Registered as_type: file. Overridesread_dataframe()to pass file paths directly to pandas readers instead of going through bytes + BytesIO.LangSmithObjectStore— New ObjectStore innvidia_nat_langchainthat fetches evaluation datasets from the LangSmith API. Supports dataset name/ID lookup, splits, version tags, limits, and custom input/output key mapping. Read-only (put/upsert/delete raiseNotImplementedError).EvalDatasetConfig— Flat Pydantic model for dataset configuration. Two modes:file_path: Local file shorthand (creates a transientFileObjectStoreinternally)object_store+key: Reference a named ObjectStore from the workflow configFormat can be specified three ways (in order of precedence):
format:field (e.g.,format: csv)_type:field (accepted as an alias forformat:, e.g.,_type: json)Configuration examples
Local file with
_type(standard):Local file with format inference (format omitted, inferred from
.csvextension):S3 via ObjectStore:
LangSmith via ObjectStore:
Files changed
New files:
nat/object_store/format_parsers.py— Format parsing utilities (CSV, JSON, JSONL, Parquet, Excel)nat/object_store/file_object_store.py—FileObjectStore+FileObjectStoreConfignat/plugins/langchain/object_store/langsmith_object_store.py—LangSmithObjectStore+ configtests/nat/object_store/test_format_parsers.py— 12 teststests/nat/object_store/test_read_dataframe.py— 5 teststests/nat/object_store/test_file_object_store.py— 11 teststests/nat/eval/test_eval_dataset_config.py— 9 teststests/nat/eval/test_dataset_loading_integration.py— 8 integration teststests/object_store/test_langsmith_object_store.py— 16 tests (langchain package)Modified files:
nat/object_store/interfaces.py— Addedread_dataframe()to ObjectStore ABCnat/data_models/dataset_handler.py— NewEvalDatasetConfignat/data_models/evaluate.py— UpdatedEvalGeneralConfig.datasetfield typenat/eval/dataset_handler/dataset_handler.py— Rewired to load data via ObjectStorenat/eval/evaluate.py— Updated caller for async dataset loadingnat/builder/builder.py— Cleaned up EvalBuilder ABCnat/builder/eval_builder.py— Cleaned up WorkflowEvalBuildernat/plugins/langchain/register.py— Added LangSmith ObjectStore registrationBy Submitting this PR I confirm: