-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] Get record by ID - refresh record resource #5500
Conversation
selectinload(Record.suggestions), | ||
selectinload(Record.responses), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future step, this can be controlled by with_*
query parameters as we already have for other record endpoints.
"""Retrieves the record from the server.""" | ||
model = self._client.api.records.get(self._server_id) | ||
instance = self.from_model(model, dataset=self.dataset) | ||
self.__dict__ = instance.__dict__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only known way to update the internal instance state. The record from_model
has complex mapping logic to build the record resource properly
@property | ||
def _client(self) -> Optional["Argilla"]: | ||
if self._dataset: | ||
return self.dataset._client | ||
|
||
@property | ||
def _api(self) -> Optional["RecordsAPI"]: | ||
if self._client: | ||
return self._client.api.records | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align the Resource interface definition
Description
This PR adds support to refresh a
rg.Record
from the server, allowing load responses, suggestions and vectors.Type of change
How Has This Been Tested
Checklist