From 8a6d484ea7ef252bb69925c2e7e47c326b0943c4 Mon Sep 17 00:00:00 2001 From: Ben Burtenshaw Date: Thu, 27 Jun 2024 13:07:46 +0200 Subject: [PATCH] fix: align add records parameters with render function --- argilla/src/argilla/records/_dataset_records.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/argilla/src/argilla/records/_dataset_records.py b/argilla/src/argilla/records/_dataset_records.py index df5e65f1db..251a191c69 100644 --- a/argilla/src/argilla/records/_dataset_records.py +++ b/argilla/src/argilla/records/_dataset_records.py @@ -416,7 +416,7 @@ def _validate_vector_names(self, vector_names: Union[List[str], str]) -> None: def _render_record_mapping( self, - records: List[Dict[str, Any]], + data: Dict[str, Any], mapping: Optional[Dict[str, Union[str, Sequence[str]]]] = None, ) -> Dict[str, Tuple[Optional[str]]]: """Renders a mapping from a list of records and a mapping dictionary, to a singular mapping dictionary.""" @@ -425,7 +425,7 @@ def _render_record_mapping( singular_mapping = defaultdict(dict) # update the mapping with unmapped columns - for key, value in records[0].items(): + for key, value in data.items(): if key not in schema and key not in mapping: warnings.warn( message=f"Record attribute {key} is not in the schema so skipping.", @@ -491,7 +491,7 @@ def _infer_record_from_mapping( """ - mapping = self._render_record_mapping(records=records, mapping=mapping) + mapping = self._render_record_mapping(data=data, mapping=mapping) id_mapping = mapping.get("id", {}) suggestion_mapping = mapping.get("suggestion", {}) response_mapping = mapping.get("response", {})