-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: [sc-26070] Disable adding ".eth" suffix to suggestions #327
Conversation
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.
collection_models.py
Outdated
|
||
|
||
class CollectionName(BaseModel): | ||
name: str = Field(title='name with `.eth`') | ||
name: str = Field(title='name from a collection') | ||
namehash: str = Field(title='namehash of the name') |
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.
Hmm, I'm trying to remember why we had this namehash
field here?
Please note how if we are removing .eth from all name
values, the related namehash
value returned would also need to change.
Potentially we might change this to labelhash
but not sure about the goal of this field? I think we can just remove it.
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.
I don't know why we are returning namehashes.
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 we want to remove the namehash field, should we keep this model with a single field, or should we rather keep the names as a list
of str
inside Collection.top_names
?
Also, if the second option is chosen, should we change Collection.top_names
to Collection.top_labels
?
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.
Maybe the first option. It will not need any changes in the client and in the future will be easy to include additional information about names/labels.
We can rename name
to label
in all places but we need to do it in namekit too.
collection_models.py
Outdated
|
||
class CollectionWithSuggestions(BaseModel): | ||
suggestions: list[SuggestionFromCollection] = Field(title='suggestions from a collection') | ||
name: str = Field(title='collection title', description='kept for backwards compatibility') # todo: remove field if not used |
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.
Please coordinate with @FrancoAguzzi If we need to update any code for this in the old NameHash app Instant Search feature (now at https://alpha.namekit.io). We're going to need to make some changes there no matter what based on the changes in this PR. It should be ok for us to implement those updates.
collection_models.py
Outdated
suggestions: list[SuggestionFromCollection] = Field(title='suggestions from a collection') | ||
name: str = Field(title='collection title', description='kept for backwards compatibility') # todo: remove field if not used | ||
type: Literal['related'] = Field('related', title='category type (always set to \'related\')', | ||
description='kept for backwards compatibility') # todo: remove field if not used |
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.
Please see related comment above for us to remove this field.
web_api.py
Outdated
) | ||
|
||
|
||
def convert_to_suggestion_format( | ||
names: List[GeneratedName], | ||
include_metadata: bool = True | ||
include_metadata: bool = True, | ||
append_eth: bool = True |
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.
Not sure if I understand this append_eth
param? In my understanding it shouldn't exist inside NameGraph
.
Instead the appending of root names would be left to a NameGraph client to implement.
If I'm missing something please let me know 👍
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.
We have removed .eth.
only in collection related endpoints and this code is also used for generator endpoints where we are appending eth
.
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.
@djstrong Ok perfect! That sounds great 🚀
models.py
Outdated
description='label\'s status cached at the time of application startup') | ||
categories: list[str] = Field(title='domain category', | ||
description='can be either available, taken, recently released or on sale') | ||
cached_interesting_score: Optional[float] = Field(title='cached interesting score', |
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.
Should we rename this field to cached_sort_score
?
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.
yes
collection_models.py
Outdated
@@ -65,8 +65,8 @@ class BaseCollectionSearch(BaseCollectionSearchLimitOffsetSort): | |||
description='* set to null if you want to disable the penalization\n' | |||
'* if the penalization algorithm is turned on then 3 times more results (than max_related_collections) are retrieved from Elasticsearch') | |||
name_diversity_ratio: Optional[float] = Field(None, examples=[0.5], ge=0.0, le=1.0, |
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.
Should we rename this field to label_diversity_ratio
?
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.
yes
08bc309
to
dc258b3
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.
} | ||
} | ||
|
||
input_names = ['cat', 'zeus'] |
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.
input_names = ['cat', 'zeus'] | |
input_labels = ['cat', 'zeus'] |
|
||
input_names = ['cat', 'zeus'] | ||
|
||
CAT = set( |
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.
Should each of these be labels without ".eth"?
"categories": { | ||
"related": { | ||
"enable_learning_to_rank": True, | ||
"max_names_per_related_collection": 10, |
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.
"max_names_per_related_collection": 10, | |
"max_labels_per_related_collection": 10, |
r = self.client.post(self.URL, name='suggestions_by_category', json=json) | ||
# print(r.json()) | ||
response = r.json() | ||
names = [] |
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.
names = [] | |
labels = [] |
Ok, I will return to this tomorrow. |
Story details: https://app.shortcut.com/ps-web3/story/26070
TODO:
.eth
for Collections API.eth
for Suggestions/Generator APICollectionLabel