-
Notifications
You must be signed in to change notification settings - Fork 1
chore: update API to include searchGlobalLeaderboardEntriesProto #102
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
Conversation
Reviewer's GuideAdds a new global leaderboard search client and request model, wires the endpoint into codegen/docs, and regenerates protobuf v3/v4 types to make ForkPoint.parent_project optional and keep descriptors in sync. Sequence diagram for searchGlobalLeaderboardEntriesProto sync request flowsequenceDiagram
actor Caller
participant SearchGlobalLeaderboardEntriesClient
participant AuthenticatedClient
participant HttpxClient
participant NeptuneAPI
Caller->>SearchGlobalLeaderboardEntriesClient: sync(client, body, x_neptune_client_metadata)
SearchGlobalLeaderboardEntriesClient->>SearchGlobalLeaderboardEntriesClient: _get_kwargs(body, x_neptune_client_metadata)
SearchGlobalLeaderboardEntriesClient->>AuthenticatedClient: get_httpx_client()
AuthenticatedClient-->>SearchGlobalLeaderboardEntriesClient: HttpxClient
SearchGlobalLeaderboardEntriesClient->>HttpxClient: request(method=post, url=/api/leaderboard/v1/proto/leaderboard/entries/global/search/, json=body.to_dict(), headers)
HttpxClient->>NeptuneAPI: HTTP POST /api/leaderboard/v1/proto/leaderboard/entries/global/search/
NeptuneAPI-->>HttpxClient: HTTP response (status, content)
HttpxClient-->>SearchGlobalLeaderboardEntriesClient: httpx.Response
SearchGlobalLeaderboardEntriesClient->>SearchGlobalLeaderboardEntriesClient: _build_response(client, response)
SearchGlobalLeaderboardEntriesClient->>SearchGlobalLeaderboardEntriesClient: _parse_response(client, response)
SearchGlobalLeaderboardEntriesClient-->>Caller: parsed result (File or Any or None)
Class diagram for GlobalSearchParamsDTO and related leaderboard search modelsclassDiagram
class GlobalSearchParamsDTO {
+experiment_leader: bool
+pagination: QueryLeaderboardParamsPaginationDTO
+query: NqlQueryParamsDTO
+sorting: QueryLeaderboardParamsSortingParamsDTO
+additional_properties: Dict~str, Any~
+to_dict() Dict~str, Any~
+from_dict(src_dict: Dict~str, Any~) GlobalSearchParamsDTO
+additional_keys() List~str~
+__getitem__(key: str) Any
+__setitem__(key: str, value: Any) None
+__delitem__(key: str) None
+__contains__(key: str) bool
}
class NqlQueryParamsDTO {
}
class QueryLeaderboardParamsPaginationDTO {
}
class QueryLeaderboardParamsSortingParamsDTO {
}
GlobalSearchParamsDTO --> NqlQueryParamsDTO : query
GlobalSearchParamsDTO --> QueryLeaderboardParamsPaginationDTO : pagination
GlobalSearchParamsDTO --> QueryLeaderboardParamsSortingParamsDTO : sorting
Class diagram for ForkPoint with optional parent_project fieldclassDiagram
class Step {
+whole: uint64
+micro: uint64
}
class ForkPoint {
+parent_project: str
+parent_run_id: str
+step: Step
+requested_parent_id: str
+HasField(field_name)
+ClearField(field_name)
+WhichOneof(oneof_group)
}
ForkPoint --> Step : step
class ForkPointParentProjectOneof {
<<oneof>>
+parent_project: str
}
class ForkPointRequestedParentIdOneof {
<<oneof>>
+requested_parent_id: str
}
ForkPoint *-- ForkPointParentProjectOneof : _parent_project
ForkPoint *-- ForkPointRequestedParentIdOneof : _requested_parent_id
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
6c5062a to
7ce3fbe
Compare
7ce3fbe to
8ff048f
Compare
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/neptune_api/api/retrieval/search_global_leaderboard_entries_proto.py:70` </location>
<code_context>
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, File]]:
try:
if response.status_code == HTTPStatus.OK:
response_200 = File(payload=BytesIO(response.content))
return response_200
if response.status_code == HTTPStatus.BAD_REQUEST:
response_400 = cast(Any, None)
return response_400
if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = cast(Any, None)
return response_401
if response.status_code == HTTPStatus.FORBIDDEN:
response_403 = cast(Any, None)
return response_403
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None)
return response_404
if response.status_code == HTTPStatus.REQUEST_TIMEOUT:
response_408 = cast(Any, None)
return response_408
if response.status_code == HTTPStatus.CONFLICT:
response_409 = cast(Any, None)
return response_409
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
response_422 = cast(Any, None)
return response_422
if response.status_code == HTTPStatus.TOO_MANY_REQUESTS:
response_429 = cast(Any, None)
return response_429
except Exception as e:
raise errors.UnableToParseResponse(e, response) from e
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
</code_context>
<issue_to_address>
**issue (code-quality):** Inline variable that is immediately returned [×5] ([`inline-immediately-returned-variable`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/inline-immediately-returned-variable/))
</issue_to_address>
### Comment 2
<location> `src/neptune_api/models/global_search_params_dto.py:75` </location>
<code_context>
def to_dict(self) -> Dict[str, Any]:
experiment_leader = self.experiment_leader
pagination: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.pagination, Unset):
pagination = self.pagination.to_dict()
query: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.query, Unset):
query = self.query.to_dict()
sorting: Union[Unset, Dict[str, Any]] = UNSET
if not isinstance(self.sorting, Unset):
sorting = self.sorting.to_dict()
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if experiment_leader is not UNSET:
field_dict["experimentLeader"] = experiment_leader
if pagination is not UNSET:
field_dict["pagination"] = pagination
if query is not UNSET:
field_dict["query"] = query
if sorting is not UNSET:
field_dict["sorting"] = sorting
return field_dict
</code_context>
<issue_to_address>
**suggestion (code-quality):** Merge dictionary updates via the union operator ([`dict-assign-update-to-union`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/dict-assign-update-to-union/))
```suggestion
field_dict |= self.additional_properties
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| ) -> Optional[Union[Any, File]]: | ||
| try: | ||
| if response.status_code == HTTPStatus.OK: | ||
| response_200 = File(payload=BytesIO(response.content)) |
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.
issue (code-quality): Inline variable that is immediately returned [×5] (inline-immediately-returned-variable)
| sorting = self.sorting.to_dict() | ||
|
|
||
| field_dict: Dict[str, Any] = {} | ||
| field_dict.update(self.additional_properties) |
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.
suggestion (code-quality): Merge dictionary updates via the union operator (dict-assign-update-to-union)
| field_dict.update(self.additional_properties) | |
| field_dict |= self.additional_properties |
Summary by Sourcery
Add a new global leaderboard search API endpoint and corresponding request model, while updating protobuf typings for ForkPoint optional fields.
New Features:
Enhancements: