-
Notifications
You must be signed in to change notification settings - Fork 124
[model] Allow Random Model Names for Artifact Hub Registrant #722
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Tanishq <[email protected]>
Signed-off-by: Tanishq <[email protected]>
Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack. |
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.
Hello @Tanishq1604, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request addresses issue #14282, where the ArtifactHub registrant required model names to exactly match package names, unlike GitHub. To resolve this, I've modified the ArtifactHub package manager to extract package names from ArtifactHub URLs, specifically the ts_query_web
parameter. If this parameter is found, it's used as the package name; otherwise, the original model name is used. This change ensures a consistent experience between ArtifactHub and GitHub when registering models.
Highlights
- Bug Fix: Fixes issue #14282, which required exact matching of model and package names in ArtifactHub.
- Feature Enhancement: Allows arbitrary model names for ArtifactHub registrant, consistent with GitHub.
- Code Modification: Modified the ArtifactHub package manager to extract package names from URLs.
Changelog
- generators/artifacthub/package_manager.go
- Added
net/url
import to handle URL parsing. - Modified
GetPackage
function to extract package name fromts_query_web
parameter in the URL. - Implemented fallback to the original model name if the package name cannot be extracted from the URL.
- Updated
GetAhPackagesWithName
to use the extracted or original package name for searching. - Updated error message to reflect the extracted or original package name.
- Added
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A name mismatch, a coding plight,
ArtifactHub's rigidity, not quite right.
But a parsed URL,
A fix, not a squall,
Consistency shines, a welcome light.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This PR enhances the ArtifactHub package manager by allowing arbitrary model names, aligning its behavior with GitHub. The implementation is clear and addresses the issue effectively. The demo video is also a great addition for reviewers to understand the changes.
Merge Readiness
The code changes are well-structured and address the issue described in the pull request. I recommend merging this pull request after addressing the comments provided.
parsedURL, err := url.Parse(ahpm.SourceURL) | ||
if err == nil { | ||
// Extract the ts_query_web parameter if it exists | ||
queryParams := parsedURL.Query() | ||
if tsQueryWeb := queryParams.Get("ts_query_web"); tsQueryWeb != "" { | ||
searchName = tsQueryWeb | ||
} | ||
} | ||
} |
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.
if len(pkgs) == 0 { | ||
return nil, ErrNoPackageFound(ahpm.PackageName, "Artifacthub") | ||
return nil, ErrNoPackageFound(searchName, "Artifacthub") |
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.
Consider adding the original package name to the error message for better context. This would help users understand if the issue is with the extracted name or the original name. For example, the error message could be updated to: ErrNoPackageFound(searchName, ahpm.PackageName, "Artifacthub")
return nil, ErrNoPackageFound(searchName, ahpm.PackageName, "Artifacthub")
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.
@Tanishq1604 are we doing same thing for github. If yes then try to use same handler for that, if no then try to do what we are doing for github.
Demo of your solution will be helpful.
Lint failures... |
No activity here... PR abandoned? |
To make Artifact Hub process same as GitHub one, there are too concerns:
considering the points above, I suggest we shouldn't be doing it, what do you think? |
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.
LGTM
@amitamrutiya for now i have done for the artifact hub i am taking the name from the artifact hub url's query |
@Jougan-0 are we good to go here? |
Description
This PR fixes an issue #14282 where ArtifactHub registrant required model names to match package names exactly, while GitHub allowed arbitrary model names. The solution extracts package names from ArtifactHub URLs when possible, making the experience consistent between registrants.
Implementation
Modified the ArtifactHub package manager to:
ts_query_web
parameter which contains the actual package nameREC-20250415221556.mp4
Notes for Reviewers
This change makes ArtifactHub work like GitHub when it comes to model registration. Users can now provide arbitrary model names when using ArtifactHub registrant rather than requiring the model name to exactly match the ArtifactHub package name.