-
Notifications
You must be signed in to change notification settings - Fork 51
List models using open ai api #1234
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
Open
agrimk
wants to merge
17
commits into
main
Choose a base branch
from
list_models_using_openAI_API
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4749ae6
removed log parsing from MD Work request polling
agrimk d280d1d
Merge branch 'track_md_logs_for_error_logging' of github.com:oracle/a…
agrimk 056b442
fixing test cases
agrimk 9f7c2bc
Merge branch 'main' into track_md_logs_for_error_logging
agrimk 2a584b0
updated toml file and release notes
agrimk c60f55f
Releases the ADS v2.13.16
mrDzurb 5f4e080
release of v2.13.16
agrimk d12d982
initial commit for using open AI APIs
agrimk 99814af
Merge branch 'main' of github.com:oracle/accelerated-data-science int…
agrimk fc96e33
Merge branch 'release/v2.13.16' of github.com:oracle/accelerated-data…
agrimk 2e54285
Merge branch 'ODSC-73735/smc-env-config-refractoring' of github.com:o…
agrimk 6257e13
Merge branch 'ODSC-73735/smc-env-config-refractoring' of github.com:o…
agrimk 61fd464
added unit test and addressed PR review comments
agrimk 7f84c36
removed prints
agrimk e8e36db
merge from master
agrimk f007d51
fixed test case for deployment handler
agrimk 4dba7e1
PR review comments
agrimk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,6 +373,40 @@ def post(self, *args, **kwargs): # noqa: ARG002 | |
) | ||
|
||
|
||
class AquaModelListHandler(AquaAPIhandler): | ||
"""Handler for Aqua model list params REST APIs. | ||
|
||
Methods | ||
------- | ||
get(self, *args, **kwargs) | ||
Validates parameters for the given model id. | ||
""" | ||
|
||
@handle_exceptions | ||
def get(self, model_deployment_id): | ||
""" | ||
Handles streaming inference request for the Active Model Deployments | ||
Raises | ||
------ | ||
HTTPError | ||
Raises HTTPError if inputs are missing or are invalid | ||
""" | ||
|
||
self.set_header("Content-Type", "application/json") | ||
endpoint: str = "" | ||
model_deployment = AquaDeploymentApp().get(model_deployment_id) | ||
if model_deployment.endpoint.endswith("/"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can simplify this with something like: |
||
endpoint = model_deployment.endpoint + "predict/v1/models" | ||
else: | ||
endpoint = model_deployment.endpoint + "/predict/v1/models" | ||
aqua_client = Client(endpoint=endpoint) | ||
try: | ||
list_model_result = aqua_client.list_models() | ||
return self.finish(list_model_result) | ||
except Exception as ex: | ||
raise HTTPError(500, str(ex)) | ||
|
||
|
||
__handlers__ = [ | ||
("deployments/?([^/]*)/params", AquaDeploymentParamsHandler), | ||
("deployments/config/?([^/]*)", AquaDeploymentHandler), | ||
|
@@ -381,4 +415,5 @@ def post(self, *args, **kwargs): # noqa: ARG002 | |
("deployments/?([^/]*)/activate", AquaDeploymentHandler), | ||
("deployments/?([^/]*)/deactivate", AquaDeploymentHandler), | ||
("inference/stream/?([^/]*)", AquaDeploymentStreamingInferenceHandler), | ||
("deployments/models/list/?([^/]*)", AquaModelListHandler), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
the logic in this method here seems generic, should we call it
fetch_data
orget_json_response
instead oflist_models
? Also, docstrings need to be changed here.