-
Notifications
You must be signed in to change notification settings - Fork 2
Add Hub client implementation #34
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
- Add Hub client for accessing hub routes - Implement get_health, list_domains, get_schema methods - Add comprehensive test coverage - Update deprecated hub methods to use new client Co-Authored-By: Sudeep Pillai <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
tests/test_hub.py
Outdated
| assert response["status"] == "ok" | ||
| assert response["hub_version"] == "1.0.0" | ||
|
|
||
| # Test convenience method |
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.
Remove this call and the method
vlmrun/client/client.py
Outdated
|
|
||
| def get_hub_version(self): | ||
| raise NotImplementedError("Hub version not yet implemented") | ||
| def get_hub_version(self) -> str: |
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.
Remove this comvenience method
vlmrun/client/client.py
Outdated
| """ | ||
| return self.hub.get_health()["hub_version"] | ||
|
|
||
| # Deprecated methods - use hub resource instead |
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.
Remove this convenience method
vlmrun/client/client.py
Outdated
| """Use client.hub.list_domains() instead. This method is deprecated.""" | ||
| return self.hub.list_domains() | ||
|
|
||
| def submit_hub_item(self, path: str, name: str, version: str): |
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.
Remove this convenience method
vlmrun/client/hub.py
Outdated
| from vlmrun.client.base_requestor import APIRequestor, APIError | ||
|
|
||
|
|
||
| class HubSchemaQueryRequest: |
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.
Use pydantic BaseModel to define these classes instead
vlmrun/client/hub.py
Outdated
| return {"domain": self.domain} | ||
|
|
||
|
|
||
| class HubSchemaQueryResponse: |
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.
Use pydantic BaseModel to define these classes instead under types.py
|
Devin is currently unreachable - the session may have died. |
4 similar comments
|
Devin is currently unreachable - the session may have died. |
|
Devin is currently unreachable - the session may have died. |
|
Devin is currently unreachable - the session may have died. |
|
Devin is currently unreachable - the session may have died. |
… types.py per PR feedback Co-Authored-By: Sudeep Pillai <[email protected]>
| assert kwargs["url"] == "/hub/health" | ||
| return {"status": "ok", "hub_version": "1.0.0"}, 200, {} | ||
|
|
||
| client = Client(api_key="test-key") |
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.
Move this into a pytest fixture that can be reused.
vlmrun/client/client.py
Outdated
| def get_hub_version(self): | ||
| raise NotImplementedError("Hub version not yet implemented") | ||
|
|
||
| # Deprecated methods - use hub resource instead |
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.
Remove these methods, and instead expect the user to only use client.hub.
vlmrun/client/client.py
Outdated
| """Use client.hub.list_domains() instead. This method is deprecated.""" | ||
| return self.hub.list_domains() | ||
|
|
||
| def submit_hub_item(self, path: str, name: str, version: str): |
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.
Remove this
vlmrun/client/client.py
Outdated
| raise NotImplementedError("Hub version not yet implemented") | ||
|
|
||
| # Deprecated methods - use hub resource instead | ||
| def list_hub_items(self): |
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.
Remove this
vlmrun/client/hub.py
Outdated
| This client provides access to the hub routes for managing schemas and domains. | ||
| """ | ||
|
|
||
| def __init__(self, client) -> None: |
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.
Use type annotations for the client
vlmrun/client/hub.py
Outdated
| """ | ||
| self._client = client | ||
|
|
||
| def get_health(self) -> Dict[str, Any]: |
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.
Return a pydantic schema instead. Define the HubHealthResponse in vlmrun/common/types.py
vlmrun/client/hub.py
Outdated
| except Exception as e: | ||
| raise APIError(f"Failed to check hub health: {str(e)}") | ||
|
|
||
| def list_domains(self) -> List[str]: |
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.
Return pydantic types
- Remove deprecated hub methods from client.py - Convert hub models to Pydantic BaseModel - Add proper type annotations and safety checks - Update tests to use new models Co-Authored-By: Sudeep Pillai <[email protected]>
Add Hub client implementation for accessing hub routes
Changes:
The implementation follows the existing SDK patterns and includes:
Implements these hub routes:
All tests passing locally.
Link to Devin run: https://app.devin.ai/sessions/d3e36b9912304dc09775fb7b2f0f4e0a