Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 20, 2024
1 parent 9959d78 commit 4a4781f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion argilla/docs/how_to_guides/record.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ dataset.records.log(records=updated_data)
```

=== "Update vectors"
When a new vector field is added to the dataset settings, or some value for the existing record vectors must updated, you can iterate over the records and update the vectors in the same way as the metadata.
When a new vector field is added to the dataset settings, or some value for the existing record vectors must updated, you can iterate over the records and update the vectors in the same way as the metadata.

```python
updated_records = []
Expand Down
1 change: 1 addition & 0 deletions argilla/src/argilla/_models/_record/_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

FieldValue = Union[str, None]


class RecordModel(ResourceModel):
"""Schema for the records of a `Dataset`"""

Expand Down
1 change: 0 additions & 1 deletion argilla/src/argilla/records/_dataset_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from argilla.settings._metadata import MetadataPropertyBase
from argilla.settings._question import QuestionPropertyBase
from argilla.suggestions import Suggestion
from argilla.vectors import Vector

if TYPE_CHECKING:
from argilla.datasets import Dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

@pytest.fixture
def record():

return rg.Record(
id=uuid.uuid4(),
fields={"text": "Hello World, how are you?"},
Expand All @@ -34,7 +33,6 @@ def record():
responses=[rg.Response("label", "positive", user_id=uuid.uuid4())],
metadata={"source": "twitter", "language": "en"},
vectors={"text": [0, 0, 0]},

)


Expand Down
11 changes: 5 additions & 6 deletions argilla/tests/unit/test_resources/test_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def test_record_repr(self):
responses=[Response(question_name="question", value="answer", user_id=user_id)],
)
assert (
record.__repr__() == f"Record(id={record_id},"
"fields={'name': 'John', 'age': '30'},"
"metadata={'key': 'value'},"
"suggestions={'question': {'value': 'answer', 'score': None, 'agent': None}},"
f"responses={{'question': [{{'value': 'answer'}}]}})"
record.__repr__() == f"Record(id={record_id},"
"fields={'name': 'John', 'age': '30'},"
"metadata={'key': 'value'},"
"suggestions={'question': {'value': 'answer', 'score': None, 'agent': None}},"
f"responses={{'question': [{{'value': 'answer'}}]}})"
)

def test_update_record_metadata_by_key(self):
Expand Down Expand Up @@ -62,4 +62,3 @@ def test_update_record_vectors(self):

record.vectors["new-vector"] = [1.0, 2.0, 3.0]
assert record.vectors == {"vector": [1.0, 2.0, 3.0], "new-vector": [1.0, 2.0, 3.0]}

0 comments on commit 4a4781f

Please sign in to comment.